[orca] Improve logic of shouldReadFullRow for web content



commit 6ff8e912ecb035e849bac633bfb4f2b07e65b817
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Tue Jan 21 11:09:58 2020 -0500

    Improve logic of shouldReadFullRow for web content
    
    * Don't cache results because navigation types change
    * Don't use focusable cells as the sole indication that we should
      only read the focused cell
    * Base decision on grid descendants on whether or not we're in
      focus mode, because authors cannot be trusted to manage descendants
      like the ARIA spec states they should

 src/orca/scripts/web/script_utilities.py | 24 ++++--------------------
 src/orca/scripts/web/speech_generator.py |  3 ---
 2 files changed, 4 insertions(+), 23 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 213e43f74..1e4024e6d 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -108,7 +108,6 @@ class Utilities(script_utilities.Utilities):
         self._preferDescriptionOverName = {}
         self._shouldFilter = {}
         self._shouldInferLabelFor = {}
-        self._shouldReadFullRow = {}
         self._text = {}
         self._tag = {}
         self._xmlRoles = {}
@@ -190,7 +189,6 @@ class Utilities(script_utilities.Utilities):
         self._preferDescriptionOverName = {}
         self._shouldFilter = {}
         self._shouldInferLabelFor = {}
-        self._shouldReadFullRow = {}
         self._tag = {}
         self._xmlRoles = {}
         self._treatAsDiv = {}
@@ -2570,27 +2568,13 @@ class Utilities(script_utilities.Utilities):
         if not (obj and self.inDocumentContent(obj)):
             return super().shouldReadFullRow(obj)
 
-        rv = self._shouldReadFullRow.get(hash(obj))
-        if rv is not None:
-            return rv
-
-        try:
-            role = obj.getRole()
-            state = obj.getState()
-        except:
-            msg = "ERROR: Exception getting role and state for %s" % obj
-            debug.println(debug.LEVEL_INFO, msg, True)
+        if not super().shouldReadFullRow(obj):
             return False
 
-        if role == pyatspi.ROLE_TABLE_CELL and state.contains(pyatspi.STATE_FOCUSABLE):
-            msg = "WEB: Should not read full row: focusable cell %s" % obj
-            debug.println(debug.LEVEL_INFO, msg, True)
-            rv = False
-        else:
-            rv = super().shouldReadFullRow(obj)
+        if self.isGridDescendant(obj):
+            return not self._script.inFocusMode()
 
-        self._shouldReadFullRow[hash(obj)] = rv
-        return rv
+        return True
 
     def isEntryDescendant(self, obj):
         if not obj:
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index fd05dd6c7..8b6e8eb84 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -634,9 +634,6 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         return result
 
     def _generateTableCellRow(self, obj, **args):
-        if not self._script.inFocusMode():
-            return super()._generateTableCellRow(obj, **args)
-
         if not self._script.utilities.shouldReadFullRow(obj):
             return self._generateRealTableCell(obj, **args)
 


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