[orca] Chromium: Fix another issue getting child position in Google Drive



commit fbd68d9729fa17547e97ed7548b16dec1aba86c1
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 3 12:25:11 2020 +0100

    Chromium: Fix another issue getting child position in Google Drive
    
    When the table is arranged as a list, there can be section children
    of the row (whereas cell children are expected). Therefore, check the
    first child with a cell role type for its rowindex value.

 src/orca/scripts/web/script_utilities.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 2cfcb695e..ba1f31f71 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -562,7 +562,10 @@ class Utilities(script_utilities.Utilities):
         if obj.getRole() == pyatspi.ROLE_TABLE_ROW:
             rowindex = attrs.get('rowindex')
             if rowindex is None and obj.childCount:
-                rowindex = self.objectAttributes(obj[0], False).get('rowindex')
+                roles = self._cellRoles()
+                cell = pyatspi.findDescendant(obj, lambda x: x and x.getRole() in roles)
+                rowindex = self.objectAttributes(cell, False).get('rowindex')
+
             if rowindex is not None:
                 return int(rowindex)
 
@@ -1924,6 +1927,15 @@ class Utilities(script_utilities.Utilities):
 
         return False
 
+    def _cellRoles(self):
+        roles = [pyatspi.ROLE_TABLE_CELL,
+                 pyatspi.ROLE_TABLE_COLUMN_HEADER,
+                 pyatspi.ROLE_TABLE_ROW_HEADER,
+                 pyatspi.ROLE_ROW_HEADER,
+                 pyatspi.ROLE_COLUMN_HEADER]
+
+        return roles
+
     def _textBlockElementRoles(self):
         roles = [pyatspi.ROLE_ARTICLE,
                  pyatspi.ROLE_CAPTION,


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