[orca] Web: Don't depend on browser exposure of both rowindex and colindex



commit 3985169dd6fdd89a9ff8ce6989da6573241eb8e7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 20 18:44:54 2022 +0200

    Web: Don't depend on browser exposure of both rowindex and colindex
    
    We were assuming that if an author provided explicit values for
    aria-{row,col}index but not aria-{col,row}index, user agents would
    do the calculation of the absent value so that assistive technologies
    could just look in one place (object attributes) rather than two
    (object attributes followed by table/tablecell interface). That
    assumption has proven to be wrong. This commit fixes that.

 src/orca/scripts/web/script_utilities.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index bb720af4d..1ad2964f6 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2990,12 +2990,23 @@ class Utilities(script_utilities.Utilities):
         if not (obj and obj.getRole() in roles):
             return -1, -1
 
-        if preferAttribute:
-            rowindex, colindex = self._rowAndColumnIndices(obj)
-            if rowindex is not None and colindex is not None:
-                return int(rowindex) - 1, int(colindex) - 1
+        if not preferAttribute:
+            return super().coordinatesForCell(obj, preferAttribute)
+
+        rvRow = rvCol = None
+        rowindex, colindex = self._rowAndColumnIndices(obj)
+        if rowindex is None or colindex is None:
+            nativeRowindex, nativeColindex = super().coordinatesForCell(obj, False)
+            if rowindex is not None:
+                rvRow = int(rowindex) - 1
+            else:
+                rvRow = nativeRowindex
+            if colindex is not None:
+                rvCol = int(colindex) - 1
+            else:
+                rvCol = nativeColindex
 
-        return super().coordinatesForCell(obj, preferAttribute)
+        return rvRow, rvCol
 
     def setSizeUnknown(self, obj):
         if super().setSizeUnknown(obj):


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