[orca] Prefer table cell interface for getting row and column span



commit eaaeb02d9e9fe8b09cf9a6858b8c36523956b632
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Oct 7 14:37:18 2022 +0200

    Prefer table cell interface for getting row and column span

 src/orca/script_utilities.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 16e9c2358..9bfadc9fa 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4585,9 +4585,24 @@ class Utilities:
         return table.getRowAtIndex(index), table.getColumnAtIndex(index)
 
     def rowAndColumnSpan(self, obj):
-        if not (obj and obj.getRole() == pyatspi.ROLE_TABLE_CELL):
+        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
 
+        if 'TableCell' in pyatspi.listInterfaces(obj):
+            tableCell = obj.queryTableCell()
+            try:
+                rowSpan, colSpan = tableCell.rowSpan, tableCell.columnSpan
+            except:
+                msg = "INFO: Exception getting table row and col span of %s" % obj
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                return rowSpan, colSpan
+
         isTable = lambda x: x and 'Table' in pyatspi.listInterfaces(x)
         parent = pyatspi.findAncestor(obj, isTable)
         try:


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