[orca] Work around Gecko's broken table cell interface get_position



commit 3343a3b2a9b4ad5fc2847693761e3fa73e763cb0
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Oct 7 14:05:43 2022 +0200

    Work around Gecko's broken table cell interface get_position
    
    Orca now prefers the table cell interface over the table interface to
    get a cell's position. Gecko implements the table cell interface, but
    instead of returning (row, col), it returns (col, row). This can cause
    Orca to (among other things) not announce row and/or column headers.
    See https://bugzilla.mozilla.org/show_bug.cgi?id=1794100
    
    Work around that by not using the table cell interface for cell position
    in Gecko apps until the bug is fixed and has been fixed for a while.
    (E.g. in an ESR release)

 src/orca/script_utilities.py                        | 6 +++++-
 src/orca/scripts/toolkits/Gecko/script_utilities.py | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 21e87c8f1..16e9c2358 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4546,6 +4546,9 @@ class Utilities:
         rowIndex, columnIndex = self.coordinatesForCell(obj)
         return table.getRowHeader(rowIndex)
 
+    def _shouldUseTableCellInterfaceForCoordinates(self):
+        return True
+
     def coordinatesForCell(self, obj, preferAttribute=True, findCellAncestor=False):
         roles = [pyatspi.ROLE_TABLE_CELL,
                  pyatspi.ROLE_TABLE_COLUMN_HEADER,
@@ -4559,7 +4562,8 @@ class Utilities:
             cell = pyatspi.findAncestor(obj, lambda x: x and x.getRole() in roles)
             return self.coordinatesForCell(cell, preferAttribute, False)
 
-        if 'TableCell' in pyatspi.listInterfaces(obj):
+        if 'TableCell' in pyatspi.listInterfaces(obj) \
+           and self._shouldUseTableCellInterfaceForCoordinates():
             tableCell = obj.queryTableCell()
             try:
                 successful, row, col = tableCell.position
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index a7acf4629..b34711d88 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -358,3 +358,7 @@ class Utilities(web.Utilities):
 
     def unrelatedLabels(self, root, onlyShowing=True, minimumWords=3):
         return super().unrelatedLabels(root, onlyShowing, minimumWords=1)
+
+    def _shouldUseTableCellInterfaceForCoordinates(self):
+        # https://bugzilla.mozilla.org/show_bug.cgi?id=1794100
+        return False


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