[orca/gnome-3-34] Web: Return early in coordinates for cell if the object lacks the right role



commit 196cbc80226f86c4a8f1749c7350475662cc8f9c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 3 15:30:20 2020 -0500

    Web: Return early in coordinates for cell if the object lacks the right role
    
    Because web objects expose cell information via object attribute, we
    were checking there first, even for non-cell-like objects.

 src/orca/scripts/web/script_utilities.py | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9cf0a6f5a..b58a8a4f4 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2523,6 +2523,14 @@ class Utilities(script_utilities.Utilities):
         return ''
 
     def coordinatesForCell(self, obj):
+        roles = [pyatspi.ROLE_TABLE_CELL,
+                 pyatspi.ROLE_TABLE_COLUMN_HEADER,
+                 pyatspi.ROLE_TABLE_ROW_HEADER,
+                 pyatspi.ROLE_COLUMN_HEADER,
+                 pyatspi.ROLE_ROW_HEADER]
+        if not (obj and obj.getRole() in roles):
+            return -1, -1
+
         rowindex, colindex = self._rowAndColumnIndices(obj)
         if rowindex is not None and colindex is not None:
             return int(rowindex) - 1, int(colindex) - 1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]