[orca/gnome-3-34] Chromium: Update support for list item marker change



commit aeb5a80ecf7f79c329b089ee5953f6b1fc7fd360
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sat Jan 18 13:10:18 2020 -0500

    Chromium: Update support for list item marker change
    
    Chromium used to expose list item markers to us as static text leaf
    nodes; now they appear in a container. This makes it possible to
    simplify our support, but we also need to eliminate presentation of
    the new panel role we're seeing.
    
    Also improve logic regarding what is a list item marker so we do
    not double-present text in an inline list.

 src/orca/braille_generator.py                       |  5 -----
 src/orca/formatting.py                              |  8 ++++----
 src/orca/generator.py                               | 15 ---------------
 src/orca/script_utilities.py                        |  3 ---
 .../scripts/toolkits/Chromium/script_utilities.py   | 15 +++------------
 .../scripts/toolkits/Chromium/speech_generator.py   |  6 ++++++
 src/orca/scripts/web/script_utilities.py            | 21 ---------------------
 src/orca/speech_generator.py                        |  8 --------
 src/orca/structural_navigation.py                   |  4 ----
 9 files changed, 13 insertions(+), 72 deletions(-)
---
diff --git a/src/orca/braille_generator.py b/src/orca/braille_generator.py
index 498e29d60..416bb6e63 100644
--- a/src/orca/braille_generator.py
+++ b/src/orca/braille_generator.py
@@ -117,11 +117,6 @@ class BrailleGenerator(generator.Generator):
                  and region.accessible.parent == obj:
                 focusedRegion = region
                 break
-            elif role == pyatspi.ROLE_LIST_ITEM:
-                marker = self._script.utilities.getListItemMarkerText(obj)
-                if marker and marker == region.string:
-                    focusedRegion = region
-                    break
 
         return [result, focusedRegion]
 
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 8384242b0..e2c411a84 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -283,8 +283,8 @@ formatting = {
             },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState',
-            'unfocused': '(labelOrName or (listItemMarker + displayedText + allTextSelection)) + pause + 
expandableState + pause + positionInList + pause + listBoxItemWidgets',
-            'basicWhereAmI': 'label + roleName + pause + (name or (listItemMarker + displayedText)) + pause 
+ positionInList + pause + expandableState + (nodeLevel or nestingLevel) + pause'
+            'unfocused': '(labelOrName or (displayedText + allTextSelection)) + pause + expandableState + 
pause + positionInList + pause + listBoxItemWidgets',
+            'basicWhereAmI': 'label + roleName + pause + (name or displayedText) + pause + positionInList + 
pause + expandableState + (nodeLevel or nestingLevel) + pause'
             },
         pyatspi.ROLE_MATH: {
             'unfocused': 'math',
@@ -646,12 +646,12 @@ formatting = {
                                      asString(label) and (len(asString(label)) + 1) or 0)]'
         },
         pyatspi.ROLE_LIST_ITEM: {
-            'focused':   '((substring and ([Region(asString(listItemMarker))] + ' + BRAILLE_TEXT + '))\
+            'focused':   '((substring and ' + BRAILLE_TEXT + ')\
                           or ([Component(obj,\
                                      asString(label + displayedText + expandableState + roleName + 
availability) + asString(accelerator))]\
                           + (nestingLevel and [Region(" " + asString(nestingLevel))])\
                           + (listBoxItemWidgets and ([Region(" ")] + listBoxItemWidgets))))',
-            'unfocused': '((substring and ([Region(asString(listItemMarker))] + ' + BRAILLE_TEXT + '))\
+            'unfocused': '((substring and ' + BRAILLE_TEXT + ')\
                           or ([Component(obj, asString(labelOrName + expandableState))]\
                               + (nestingLevel and [Region(" " + asString(nestingLevel))])\
                               + (listBoxItemWidgets and ([Region(" ")] + listBoxItemWidgets))))',
diff --git a/src/orca/generator.py b/src/orca/generator.py
index b5a9a3f0b..46e2b140e 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1003,21 +1003,6 @@ class Generator:
 
         return [displayedText]
 
-    def _generateListItemMarker(self, obj, **args):
-        startOffset = args.get('startOffset', 0)
-        if not (0 <= startOffset <= 1):
-            return []
-
-        endOffset = args.get('endOffset')
-        if endOffset is not None and endOffset == startOffset:
-            return []
-
-        listItemMarker = self._script.utilities.getListItemMarkerText(obj)
-        if listItemMarker:
-            return [listItemMarker]
-
-        return []
-
     #####################################################################
     #                                                                   #
     # Tree interface information                                        #
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index a04d33f00..8d16cebf3 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1978,9 +1978,6 @@ class Utilities:
     def isListItemMarker(self, obj):
         return False
 
-    def getListItemMarkerText(self, obj):
-        return ""
-
     def getOnScreenObjects(self, root, extents=None):
         if not self.isOnScreen(root, extents):
             return []
diff --git a/src/orca/scripts/toolkits/Chromium/script_utilities.py 
b/src/orca/scripts/toolkits/Chromium/script_utilities.py
index 89aa566cf..535880c75 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -99,23 +99,14 @@ class Utilities(web.Utilities):
         if rv is not None:
             return rv
 
-        rv = obj.getRole() == pyatspi.ROLE_STATIC and not self._getTag(obj) \
+        rv = not self._getTag(obj) \
             and obj.parent.getRole() == pyatspi.ROLE_LIST_ITEM \
-            and obj.getIndexInParent() == 0
+            and obj.getIndexInParent() == 0 \
+            and obj.parent.queryText().getText(0, 1) == self.EMBEDDED_OBJECT_CHARACTER
 
         self._isListItemMarker[hash(obj)] = rv
         return rv
 
-    def getListItemMarkerText(self, obj):
-        if obj.getRole() != pyatspi.ROLE_LIST_ITEM:
-            return ""
-
-        for child in obj:
-            if self.isListItemMarkerInSimpleItem(child):
-                return child.name
-
-        return ""
-
     def selectedChildCount(self, obj):
         count = super().selectedChildCount(obj)
         if count or "Selection" in pyatspi.listInterfaces(obj):
diff --git a/src/orca/scripts/toolkits/Chromium/speech_generator.py 
b/src/orca/scripts/toolkits/Chromium/speech_generator.py
index fcc088512..bcafe736a 100644
--- a/src/orca/scripts/toolkits/Chromium/speech_generator.py
+++ b/src/orca/scripts/toolkits/Chromium/speech_generator.py
@@ -64,6 +64,12 @@ class SpeechGenerator(web.SpeechGenerator):
 
         return super()._generateListBoxItemWidgets(obj, **args)
 
+    def _generateRoleName(self, obj, **args):
+        if self._script.utilities.isListItemMarker(obj):
+            return []
+
+        return super()._generateRoleName(obj, **args)
+
     def generateSpeech(self, obj, **args):
         if self._script.utilities.inDocumentContent(obj):
             return super().generateSpeech(obj, **args)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9d73456c4..9cf0a6f5a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2900,16 +2900,6 @@ class Utilities(script_utilities.Utilities):
 
         return False
 
-    def isListItemMarkerInSimpleItem(self, obj):
-        if not self.isListItemMarker(obj):
-            return False
-
-        for i in range(1, obj.parent.childCount):
-            if not self.isStaticTextLeaf(obj.parent[i]):
-                return False
-
-        return True
-
     def isInferredLabelForContents(self, content, contents):
         obj, start, end, string = content
         objs = list(filter(self.shouldInferLabelFor, [x[0] for x in contents]))
@@ -3973,10 +3963,6 @@ class Utilities(script_utilities.Utilities):
             msg = "WEB: Static text leaf cannot have caret context %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
-        if self.isListItemMarkerInSimpleItem(obj):
-            msg = "WEB: List item marker in simple item cannot have caret context %s" % obj
-            debug.println(debug.LEVEL_INFO, msg, True)
-            return False
 
         return True
 
@@ -4160,13 +4146,6 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             return self.findFirstCaretContext(obj[0], 0)
 
-        if self.isListItemMarker(obj):
-            nextObj, nextOffset = obj, offset
-            while nextObj and self.isListItemMarker(nextObj):
-                nextObj, nextOffset = self.nextContext(nextObj, nextOffset)
-            if nextObj:
-                obj, offset = nextObj, nextOffset
-
         text = self.queryNonEmptyText(obj)
         if not text:
             if self._advanceCaretInEmptyObject(obj) \
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index ca410882e..a5b3a5c37 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1285,14 +1285,6 @@ class SpeechGenerator(generator.Generator):
         result.extend(self.voice(SYSTEM))
         return result
 
-    def _generateListItemMarker(self, obj, **args):
-        result = super()._generateListItemMarker(obj, **args)
-        if result and result[0]:
-            result[0] = result[0].strip()
-            result.extend(self.voice(DEFAULT))
-
-        return result
-
     def _generateNestingLevel(self, obj, **args):
         result = super()._generateNestingLevel(obj, **args)
         if result:
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 24819b70d..86709ac1f 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -1303,10 +1303,6 @@ class StructuralNavigation:
         if not text and obj.getRole() == pyatspi.ROLE_LIST:
             children = [x for x in obj if x.getRole() == pyatspi.ROLE_LIST_ITEM]
             text = " ".join(list(map(self._getText, children)))
-        if obj.getRole() == pyatspi.ROLE_LIST_ITEM:
-            marker = self._script.utilities.getListItemMarkerText(obj)
-            if text and marker and not text.startswith(marker):
-                text = "%s %s" % (marker.strip(), text)
 
         return text
 


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