[orca] Ascend ancestry when trying to find current flat review location



commit a3865e91ed95ec88c584dba314edbbd49953f5d4
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jul 17 12:29:12 2018 -0400

    Ascend ancestry when trying to find current flat review location

 src/orca/flat_review.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/flat_review.py b/src/orca/flat_review.py
index ebebf8d12..78065cba6 100644
--- a/src/orca/flat_review.py
+++ b/src/orca/flat_review.py
@@ -807,6 +807,15 @@ class Context:
 
         return zones
 
+    def _isOrIsIn(self, child, parent):
+        if not (child and parent):
+            return False
+
+        if child == parent:
+            return True
+
+        return pyatspi.findAncestor(child, lambda x: x == parent)
+
     def getShowingZones(self, root, boundingbox=None):
         """Returns an unsorted list of all the zones under root and the focusZone."""
 
@@ -829,7 +838,7 @@ class Context:
                 continue
 
             allZones.extend(zones)
-            if not focusZone and zones and self.focusObj and self.focusObj in [o, o.parent]:
+            if not focusZone and zones and self.focusObj and self._isOrIsIn(o, self.focusObj):
                 zones = list(filter(lambda z: z.hasCaret(), zones)) or zones
                 focusZone = zones[0]
 


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