[orca] Add an additional sanity check for objects which can have the caret context
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Add an additional sanity check for objects which can have the caret context
- Date: Tue, 23 Apr 2019 01:23:32 +0000 (UTC)
commit 68f2717913f82b0405b5d0f5ee270bbaf301ea20
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Apr 22 21:22:48 2019 -0400
Add an additional sanity check for objects which can have the caret context
src/orca/scripts/web/script_utilities.py | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index f0232a520..f5662d052 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3867,10 +3867,11 @@ class Utilities(script_utilities.Utilities):
return self.findNextCaretInOrder(child, -1)
if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):
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 self._canHaveCaretContext(obj):
- return obj, 0
+ elif self._canHaveCaretContext(obj):
+ if not self.doNotDescendForCaret(obj) and obj.childCount:
+ return self.findNextCaretInOrder(obj[0], -1)
+ elif offset < 0 and not self.isTextBlockElement(obj):
+ return obj, 0
# If we're here, start looking up the the tree, up to the document.
documentFrame = self.documentFrame()
@@ -3931,10 +3932,11 @@ class Utilities(script_utilities.Utilities):
return self.findPreviousCaretInOrder(child, -1)
if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):
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 self._canHaveCaretContext(obj):
- return obj, 0
+ elif self._canHaveCaretContext(obj):
+ if not self.doNotDescendForCaret(obj) and obj.childCount:
+ return self.findPreviousCaretInOrder(obj[obj.childCount - 1], -1)
+ elif offset < 0 and not self.isTextBlockElement(obj):
+ return obj, 0
# If we're here, start looking up the the tree, up to the document.
documentFrame = self.documentFrame()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]