[orca] Handle implementations which do not give us all the headers for a cell



commit 716b3644207bacfbb3dd268000818ef74ecca359
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Oct 7 16:55:54 2022 +0200

    Handle implementations which do not give us all the headers for a cell
    
    This change retrieves all the headers for a cell for implementations
    which do the following:
    
    1. Only give us the innermost/closest header for a cell
    2. Support returning the header of a header
    
    Firefox is such an implementation; Chromium is not. While Chromium does
    give us all the headers for a cell (good; nothing to work around), it
    does not support returning the header of a header. Thus when navigating
    in a nested row/column header, we cannot present the changed outer
    header. That should be fixed in Chromium.
    
    Fixes issue #269 (to the extent we can do so in Orca)

 src/orca/script_utilities.py | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index adbda530f..2a3a1952c 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4479,6 +4479,19 @@ class Utilities:
         return pyatspi.findAncestor(obj, isHeader)
 
     def columnHeadersForCell(self, obj):
+        result = self._columnHeadersForCell(obj)
+        # There either are no headers, or we got all of them.
+        if len(result) != 1:
+            return result
+
+        others = self._columnHeadersForCell(result[0])
+        while len(others) == 1 and others[0] not in result:
+            result.insert(0, others[0])
+            others = self._columnHeadersForCell(result[0])
+
+        return result
+
+    def _columnHeadersForCell(self, obj):
         if 'TableCell' in pyatspi.listInterfaces(obj):
             tableCell = obj.queryTableCell()
             try:
@@ -4506,6 +4519,19 @@ class Utilities:
         return headers
 
     def rowHeadersForCell(self, obj):
+        result = self._rowHeadersForCell(obj)
+        # There either are no headers, or we got all of them.
+        if len(result) != 1:
+            return result
+
+        others = self._rowHeadersForCell(result[0])
+        while len(others) == 1 and others[0] not in result:
+            result.insert(0, others[0])
+            others = self._rowHeadersForCell(result[0])
+
+        return result
+
+    def _rowHeadersForCell(self, obj):
         if 'TableCell' in pyatspi.listInterfaces(obj):
             tableCell = obj.queryTableCell()
             try:


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