[orca] Fix bug presenting existing context as new context



commit 15bdb5523b4daa7361b635231599e24320d97d12
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 10 09:40:44 2017 -0500

    Fix bug presenting existing context as new context

 src/orca/speech_generator.py |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 2a8a0d4..658aa32 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -1672,6 +1672,17 @@ class SpeechGenerator(generator.Generator):
 
         presentOnce = [pyatspi.ROLE_BLOCK_QUOTE, pyatspi.ROLE_LIST]
 
+        presentCommonAncestor = False
+        if commonAncestor and not leaving:
+            commonRole = self._getAlternativeRole(commonAncestor)
+            if commonRole in presentOnce:
+                pred = lambda x: x and self._getAlternativeRole(x) == commonRole
+                objAncestor = pyatspi.findAncestor(obj, pred)
+                priorAncestor = pyatspi.findAncestor(priorObj, pred)
+                objLevel = self._script.utilities.nestingLevel(objAncestor)
+                priorLevel = self._script.utilities.nestingLevel(priorAncestor)
+                presentCommonAncestor = objLevel != priorLevel
+
         ancestors, ancestorRoles = [], []
         parent = obj.parent
         while parent and parent != parent.parent:
@@ -1684,7 +1695,7 @@ class SpeechGenerator(generator.Generator):
                 pass
             elif self._script.utilities.isLayoutOnly(parent):
                 pass
-            elif parent != commonAncestor or (not leaving and parentRole in presentOnce):
+            elif parent != commonAncestor or presentCommonAncestor:
                 ancestors.append(parent)
                 ancestorRoles.append(parentRole)
 


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