[orca] Web: Prevent getting stuck/looping in offscreen single-char-lines text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Web: Prevent getting stuck/looping in offscreen single-char-lines text
- Date: Mon, 22 Feb 2021 11:59:22 +0000 (UTC)
commit 5b039cef18d4cdd4916b84921b0d65e7f8a5797c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Feb 22 12:42:26 2021 +0100
Web: Prevent getting stuck/looping in offscreen single-char-lines text
When we search for the first valid caret position at/after a specified
offset, we typically descend the element if the character at offset is
an embedded object character. In the case of offscreen text which is
exposed to us as one character per line, this can lead to getting stuck
or looping because we always return a range of 0:length for the broken
element.
src/orca/scripts/web/script_utilities.py | 9 +++++++++
1 file changed, 9 insertions(+)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 787a6c779..942ebd1b7 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4869,6 +4869,9 @@ class Utilities(script_utilities.Utilities):
self._contextPathsRolesAndNames[hash(parent)] = path, role, name
def findFirstCaretContext(self, obj, offset):
+ msg = "WEB: Looking for first caret context for %s, %i" % (obj, offset)
+ debug.println(debug.LEVEL_INFO, msg, True)
+
try:
role = obj.getRole()
except:
@@ -4918,6 +4921,12 @@ class Utilities(script_utilities.Utilities):
debug.println(debug.LEVEL_INFO, msg, True)
return obj, offset
+ # Descending an element that we're treating as a whole can lead to looping/getting stuck.
+ if self.elementLinesAreSingleChars(obj):
+ msg = "WEB: EOC in single-char-lines element. Returning %s, %i unchanged." % (obj, offset)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return obj, offset
+
child = self.getChildAtOffset(obj, offset)
if not child:
msg = "WEB: Child at offset is null. Returning %s, %i unchanged." % (obj, offset)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]