[orca] Generate new ancestors for list descendants on same line
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Generate new ancestors for list descendants on same line
- Date: Wed, 12 Feb 2020 17:22:41 +0000 (UTC)
commit fc5a40c2c515063a058553f1e10043a8eeffca67
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Feb 12 18:19:33 2020 +0100
Generate new ancestors for list descendants on same line
Authors can position a list so that it starts on the same line as some
other object. We need to present the list context for the first item.
src/orca/scripts/web/script_utilities.py | 17 +++++++++++++++++
src/orca/scripts/web/speech_generator.py | 3 ++-
2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9d2023e88..768004ec3 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -87,6 +87,7 @@ class Utilities(script_utilities.Utilities):
self._isInlineListDescendant = {}
self._isLandmark = {}
self._isLink = {}
+ self._isListDescendant = {}
self._isNonNavigablePopup = {}
self._isNonEntryTextWidget = {}
self._isUselessImage = {}
@@ -157,6 +158,7 @@ class Utilities(script_utilities.Utilities):
self._isInlineListDescendant = {}
self._isLandmark = {}
self._isLink = {}
+ self._isListDescendant = {}
self._isNonNavigablePopup = {}
self._isNonEntryTextWidget = {}
self._isUselessImage = {}
@@ -3287,6 +3289,21 @@ class Utilities(script_utilities.Utilities):
self._isInlineListItem[hash(obj)] = rv
return rv
+ def isListDescendant(self, obj):
+ if not (obj and self.inDocumentContent(obj)):
+ return False
+
+ rv = self._isListDescendant.get(hash(obj))
+ if rv is not None:
+ return rv
+
+ isList = lambda x: x and x.getRole() == pyatspi.ROLE_LIST
+ ancestor = pyatspi.findAncestor(obj, isList)
+ rv = ancestor is not None
+
+ self._isListDescendant[hash(obj)] = rv
+ return rv
+
def isInlineListDescendant(self, obj):
if not (obj and self.inDocumentContent(obj)):
return False
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index df448cf8d..a551cfac0 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -56,7 +56,8 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
return super()._generateOldAncestors(obj, **args)
def _generateNewAncestors(self, obj, **args):
- if args.get('index', 0) > 0:
+ if args.get('index', 0) > 0 \
+ and not self._script.utilities.isListDescendant(obj):
return []
if self._script.utilities.isInlineIframeDescendant(obj):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]