[orca] Also verbalize punctuation on descendants of the new ARIA code role



commit 79331e735efbbf0d7a1036cebfecb13e06a89769
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Mar 26 12:25:25 2020 -0400

    Also verbalize punctuation on descendants of the new ARIA code role

 src/orca/script_utilities.py             |  5 ++++-
 src/orca/scripts/web/script_utilities.py | 14 ++++++++++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 734445c04..b719ddc66 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -744,6 +744,9 @@ class Utilities:
     def isCode(self, obj):
         return False
 
+    def isCodeDescendant(self, obj):
+        return False
+
     def isDesktop(self, obj):
         try:
             role = obj.getRole()
@@ -3144,7 +3147,7 @@ class Utilities:
         return line
 
     def shouldVerbalizeAllPunctuation(self, obj):
-        if not self.isCode(obj):
+        if not (self.isCode(obj) or self.isCodeDescendant(obj)):
             return False
 
         # If the user has set their punctuation level to All, then the synthesizer will
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 4956bde35..a0b85076a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -61,6 +61,7 @@ class Utilities(script_utilities.Utilities):
         self._inTopLevelWebApp = {}
         self._isTextBlockElement = {}
         self._isContentEditableWithEmbeddedObjects = {}
+        self._isCodeDescendant = {}
         self._isEntryDescendant = {}
         self._isGridDescendant = {}
         self._isLabelDescendant = {}
@@ -133,6 +134,7 @@ class Utilities(script_utilities.Utilities):
         self._inTopLevelWebApp = {}
         self._isTextBlockElement = {}
         self._isContentEditableWithEmbeddedObjects = {}
+        self._isCodeDescendant = {}
         self._isEntryDescendant = {}
         self._isGridDescendant = {}
         self._isLabelDescendant = {}
@@ -3221,6 +3223,18 @@ class Utilities(script_utilities.Utilities):
         self._isClickableElement[hash(obj)] = rv
         return rv
 
+    def isCodeDescendant(self, obj):
+        if not (obj and self.inDocumentContent(obj)):
+            return super().isCodeDescendant(obj)
+
+        rv = self._isCodeDescendant.get(hash(obj))
+        if rv is not None:
+            return rv
+
+        rv = pyatspi.findAncestor(obj, self.isCode) is not None
+        self._isCodeDescendant[hash(obj)] = rv
+        return rv
+
     def isCode(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return super().isCode(obj)


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