[orca] Chromium: Ignore text-selection-change events from list item markers



commit 1ef49d13289c3577167947a95e9d61d8bb761aad
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Jun 7 12:33:47 2019 -0400

    Chromium: Ignore text-selection-change events from list item markers
    
    We don't yet have accessible text-selection support for Chromium.
    And the selection isn't changing in this case regardless.

 src/orca/scripts/toolkits/Chromium/script.py           |  5 +++++
 src/orca/scripts/toolkits/Chromium/script_utilities.py | 17 +++++++++++++++++
 2 files changed, 22 insertions(+)
---
diff --git a/src/orca/scripts/toolkits/Chromium/script.py b/src/orca/scripts/toolkits/Chromium/script.py
index 243e6a863..d06967e8b 100644
--- a/src/orca/scripts/toolkits/Chromium/script.py
+++ b/src/orca/scripts/toolkits/Chromium/script.py
@@ -383,6 +383,11 @@ class Script(web.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return
 
+        if self.utilities.isListItemMarker(event.source):
+            msg = "CHROMIUM: Ignoring event from list item marker"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return
+
         if super().onTextSelectionChanged(event):
             return
 
diff --git a/src/orca/scripts/toolkits/Chromium/script_utilities.py 
b/src/orca/scripts/toolkits/Chromium/script_utilities.py
index 5ff0b59e6..234617e73 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -45,11 +45,13 @@ class Utilities(web.Utilities):
         super().__init__(script)
         self._isStaticTextLeaf = {}
         self._isPseudoElement = {}
+        self._isListItemMarker = {}
 
     def clearCachedObjects(self):
         super().clearCachedObjects()
         self._isStaticTextLeaf = {}
         self._isPseudoElement = {}
+        self._isListItemMarker = {}
 
     def isStaticTextLeaf(self, obj, checkSiblings=True):
         if not (obj and self.inDocumentContent(obj)):
@@ -99,6 +101,21 @@ class Utilities(web.Utilities):
         self._isPseudoElement[hash(obj)] = rv
         return rv
 
+    def isListItemMarker(self, obj):
+        if not (obj and self.inDocumentContent(obj)):
+            return False
+
+        rv = self._isListItemMarker.get(hash(obj))
+        if rv is not None:
+            return rv
+
+        rv = obj.getRole() == pyatspi.ROLE_STATIC and not self._getTag(obj) \
+            and obj.parent.getRole() == pyatspi.ROLE_LIST_ITEM \
+            and obj.getIndexInParent() == 0
+
+        self._isListItemMarker[hash(obj)] = rv
+        return rv
+
     def selectedChildCount(self, obj):
         count = super().selectedChildCount(obj)
         if count or "Selection" in pyatspi.listInterfaces(obj):


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