[orca] Chromium: Use caret-moved event to recover from object destruction
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Chromium: Use caret-moved event to recover from object destruction
- Date: Fri, 24 Apr 2020 21:54:01 +0000 (UTC)
commit 6cb974736fc99d2b9fd0a9f306f9f29e35a88f63
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Apr 24 17:48:11 2020 -0400
Chromium: Use caret-moved event to recover from object destruction
Sometimes when objects are destroyed as a side effect of caret navigation,
Chromium gives us a caret-moved event for the new location. Using this
event allows us to gracefully and efficiently recover from the destruction.
Solves (at least) the problem of Orca's caret-navigation failing after
Github's actions drop-down is accessed in Browse mode and then collapses.
src/orca/scripts/web/script.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 2dea942d8..5c6878b70 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1266,6 +1266,11 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg, True)
contents = self.utilities.getLineContentsAtOffset(newFocus, 0)
utterances = self.speechGenerator.generateContents(contents)
+ elif self.utilities.lastInputEventWasLineNav() and self.utilities.isZombie(oldFocus):
+ msg = "WEB: Last input event was line nav; oldFocus is zombie. Generating line contents."
+ debug.println(debug.LEVEL_INFO, msg, True)
+ contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
+ utterances = self.speechGenerator.generateContents(contents)
else:
msg = "WEB: New focus %s is not a special case. Generating speech." % newFocus
debug.println(debug.LEVEL_INFO, msg, True)
@@ -1477,6 +1482,19 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg, True)
return False
+ obj, offset = self.utilities.getCaretContext(getZombieReplicant=False)
+ msg = "WEB: Context: %s, %i (focus: %s)" % (obj, offset, orca_state.locusOfFocus)
+ debug.println(debug.LEVEL_INFO, msg, True)
+
+ if not obj or self.utilities.isZombie(obj):
+ obj, offset = self.utilities.findFirstCaretContext(event.source, event.detail1)
+ if obj:
+ msg = "WEB: Event handled by updating locusOfFocus and context"
+ debug.println(debug.LEVEL_INFO, msg, True)
+ orca.setLocusOfFocus(event, obj, True)
+ self.utilities.setCaretContext(obj, offset)
+ return True
+
if self._lastCommandWasCaretNav:
msg = "WEB: Event ignored: Last command was caret nav"
debug.println(debug.LEVEL_INFO, msg, True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]