[orca] More cleanup and additional debugging related to valid caret context objects
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] More cleanup and additional debugging related to valid caret context objects
- Date: Tue, 23 Apr 2019 00:56:57 +0000 (UTC)
commit 25cb81bf897ffa5b2530242795c198eaeef46797
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Apr 22 20:55:47 2019 -0400
More cleanup and additional debugging related to valid caret context objects
src/orca/scripts/web/script_utilities.py | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index bb235ab80..8cfa28533 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3529,11 +3529,37 @@ class Utilities(script_utilities.Utilities):
return rv
def _canHaveCaretContext(self, obj):
+ if not obj:
+ msg = "WEB: Null object cannot have caret context"
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+ if self.isDead(obj):
+ msg = "WEB: Dead object cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+ if self.isZombie(obj):
+ msg = "WEB: Zombie object cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
if self.isHidden(obj):
+ msg = "WEB: Hidden object cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
return False
if self.isOffScreenLabel(obj):
+ msg = "WEB: Off-screen label cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
return False
if self.isNonNavigablePopup(obj):
+ msg = "WEB: Non-navigable popup cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+ if self.isUselessImage(obj):
+ msg = "WEB: Useless image cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+ if self.isEmptyAnchor(obj):
+ msg = "WEB: Empty anchor cannot have caret context %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
return False
return True
@@ -3829,8 +3855,7 @@ class Utilities(script_utilities.Utilities):
child = self.getChildAtOffset(obj, i)
if child and self._treatTextObjectAsWhole(child):
return child, 0
- if child and not self.isZombie(child) and not self.isEmptyAnchor(child) \
- and not self.isUselessImage(child):
+ if self._canHaveCaretContext(child):
return self.findNextCaretInOrder(child, -1)
if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):
return obj, i
@@ -3895,8 +3920,7 @@ class Utilities(script_utilities.Utilities):
child = self.getChildAtOffset(obj, i)
if child and self._treatTextObjectAsWhole(child):
return child, 0
- if child and not self.isZombie(child) and not self.isEmptyAnchor(child) \
- and not self.isUselessImage(child):
+ if self._canHaveCaretContext(child):
return self.findPreviousCaretInOrder(child, -1)
if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):
return obj, i
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]