[orca] Attempt to find replicants for Gecko Zombie parents when getting caret positions



commit e894ee1ec813c523dc7b1ffd50902811258517cb
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jun 2 13:06:10 2015 -0400

    Attempt to find replicants for Gecko Zombie parents when getting caret positions

 .../scripts/toolkits/Gecko/script_utilities.py     |   36 ++++++++++++++-----
 1 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index f587c7d..0215562 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -1867,15 +1867,23 @@ class Utilities(script_utilities.Utilities):
         if self.isSameObject(obj, documentFrame):
             return None, -1
 
-        while obj.parent and not self.isZombie(obj.parent):
+        while obj.parent:
+            parent = obj.parent
+            if self.isZombie(parent):
+                replicant = self.findReplicant(self.documentFrame(), parent)
+                if replicant and not self.isZombie(replicant):
+                    parent = replicant
+                else:
+                    break
+
             start, end, length = self._rangeInParentWithLength(obj)
             if start + 1 == end and 0 <= start < end <= length:
-                return self.findNextCaretInOrder(obj.parent, start)
+                return self.findNextCaretInOrder(parent, start)
 
             index = obj.getIndexInParent() + 1
-            if 0 <= index < obj.parent.childCount:
-                return self.findNextCaretInOrder(obj.parent[index], -1)
-            obj = obj.parent
+            if 0 <= index < parent.childCount:
+                return self.findNextCaretInOrder(parent[index], -1)
+            obj = parent
 
         return None, -1
 
@@ -1908,15 +1916,23 @@ class Utilities(script_utilities.Utilities):
         if self.isSameObject(obj, documentFrame):
             return None, -1
 
-        while obj.parent and not self.isZombie(obj.parent):
+        while obj.parent:
+            parent = obj.parent
+            if self.isZombie(parent):
+                replicant = self.findReplicant(self.documentFrame(), parent)
+                if replicant and not self.isZombie(replicant):
+                    parent = replicant
+                else:
+                    break
+
             start, end, length = self._rangeInParentWithLength(obj)
             if start + 1 == end and 0 <= start < end <= length:
-                return self.findPreviousCaretInOrder(obj.parent, start)
+                return self.findPreviousCaretInOrder(parent, start)
 
             index = obj.getIndexInParent() - 1
-            if 0 <= index < obj.parent.childCount:
-                return self.findPreviousCaretInOrder(obj.parent[index], -1)
-            obj = obj.parent
+            if 0 <= index < parent.childCount:
+                return self.findPreviousCaretInOrder(parent[index], -1)
+            obj = parent
 
         return None, -1
 


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