[orca] Chromium: Ensure list item markers get presented
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Chromium: Ensure list item markers get presented
- Date: Fri, 7 Jun 2019 19:46:20 +0000 (UTC)
commit b203aad3a190cd1f555c9a8dbd838065757bfc50
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Jun 7 15:38:34 2019 -0400
Chromium: Ensure list item markers get presented
List item markers are not exposed in the list item text like they are
in other user agents. Therefore we have to add their content to what
gets presented.
src/orca/formatting.py | 8 ++++----
src/orca/generator.py | 11 +++++++++++
src/orca/script_utilities.py | 3 +++
src/orca/scripts/toolkits/Chromium/script_utilities.py | 10 ++++++++++
4 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index fb19114af..2ac39d5d5 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 (displayedText + allTextSelection)) + pause + expandableState +
pause + positionInList + pause + listBoxItemWidgets',
- 'basicWhereAmI': 'label + roleName + pause + (name or displayedText) + pause + positionInList +
pause + expandableState + (nodeLevel or nestingLevel) + pause'
+ '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'
},
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 ' + BRAILLE_TEXT + ')\
+ 'focused': '((substring and ([Region(asString(listItemMarker))] + ' + 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 ' + BRAILLE_TEXT + ')\
+ 'unfocused': '((substring and ([Region(asString(listItemMarker))] + ' + 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 1a630c1d8..a339113c8 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1001,6 +1001,17 @@ class Generator:
return [displayedText]
+ def _generateListItemMarker(self, obj, **args):
+ startOffset = args.get('startOffset', 0)
+ if not (0 <= startOffset <= 1):
+ 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 b019831bf..bcf34ff73 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1963,6 +1963,9 @@ 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 1a0377c5d..a0cb61c66 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -117,6 +117,16 @@ class Utilities(web.Utilities):
self._isListItemMarker[hash(obj)] = rv
return rv
+ def getListItemMarkerText(self, obj):
+ if obj.getRole() != pyatspi.ROLE_LIST_ITEM:
+ return ""
+
+ listItemMarker = pyatspi.findDescendant(obj, self.isListItemMarker)
+ if listItemMarker:
+ return listItemMarker.name
+
+ return ""
+
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]