[orca] Web: Return early in coordinates for cell if the object lacks the right role



commit 46f5e6af4b2787b18c28d6cf634ba65facda58f8
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 a5cf96bc6..b59e62814 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2627,6 +2627,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]