[orca] Add objects w/o size and parents of a null child to non-caret-context objects



commit f8902af192fd919da66f166767b00b56c36ed41f
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Apr 22 21:07:34 2019 -0400

    Add objects w/o size and parents of a null child to non-caret-context objects

 src/orca/scripts/web/script_utilities.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 8cfa28533..f0232a520 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3561,6 +3561,14 @@ class Utilities(script_utilities.Utilities):
             msg = "WEB: Empty anchor cannot have caret context %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
+        if self.hasNoSize(obj):
+            msg = "WEB: Sizeless object cannot have caret context %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+        if self.isParentOfNullChild(obj):
+            msg = "WEB: Parent of null child cannot have caret context %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
 
         return True
 
@@ -3861,8 +3869,7 @@ class Utilities(script_utilities.Utilities):
                         return obj, i
             elif not self.doNotDescendForCaret(obj) and obj.childCount:
                 return self.findNextCaretInOrder(obj[0], -1)
-            elif offset < 0 and not self.isTextBlockElement(obj) and not self.hasNoSize(obj) \
-                 and not self.isUselessImage(obj) and not self.isParentOfNullChild(obj):
+            elif offset < 0 and not self.isTextBlockElement(obj) and self._canHaveCaretContext(obj):
                 return obj, 0
 
         # If we're here, start looking up the the tree, up to the document.
@@ -3926,8 +3933,7 @@ class Utilities(script_utilities.Utilities):
                         return obj, i
             elif not self.doNotDescendForCaret(obj) and obj.childCount:
                 return self.findPreviousCaretInOrder(obj[obj.childCount - 1], -1)
-            elif offset < 0 and not self.isTextBlockElement(obj) and not self.hasNoSize(obj) \
-                 and not self.isUselessImage(obj) and not self.isParentOfNullChild(obj):
+            elif offset < 0 and not self.isTextBlockElement(obj) and self._canHaveCaretContext(obj):
                 return obj, 0
 
         # If we're here, start looking up the the tree, up to the document.


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