[orca] Fix regression in mouse clicking resulting from cache clearing
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix regression in mouse clicking resulting from cache clearing
- Date: Thu, 10 Dec 2020 09:47:45 +0000 (UTC)
commit 3eec0df9f3e372cf2476f104be5e2d7e88d6da59
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Dec 10 10:43:16 2020 +0100
Fix regression in mouse clicking resulting from cache clearing
When the caret moves, we compare the object emitting the event with
the current context, searching for that context if it doesn't yet
exist. When initially clicking inside a web page, the context might
not yet exist because we cleared the cache in response to a children-
changed event. Thus when we search for the context, the result is
where we just clicked, so we say nothing. Fix this by adding an
option to not search for the context when it doesn't exist.
src/orca/scripts/web/script.py | 13 ++-----------
src/orca/scripts/web/script_utilities.py | 6 +++++-
2 files changed, 7 insertions(+), 12 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index b82b66741..d6f19e37e 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1540,19 +1540,10 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg, True)
return False
- obj, offset = self.utilities.getCaretContext(getZombieReplicant=False)
+ obj, offset = self.utilities.getCaretContext(getZombieReplicant=False, searchIfNeeded=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)
@@ -1564,7 +1555,7 @@ class Script(default.Script):
return True
if self._lastCommandWasMouseButton:
- if (event.source, event.detail1) == self.utilities.getCaretContext():
+ if (event.source, event.detail1) == (obj, offset):
msg = "WEB: Event is for current caret context."
debug.println(debug.LEVEL_INFO, msg, True)
return True
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9a0a47a24..2bd298796 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4546,15 +4546,19 @@ class Utilities(script_utilities.Utilities):
return obj, offset
- def getCaretContext(self, documentFrame=None, getZombieReplicant=False):
+ def getCaretContext(self, documentFrame=None, getZombieReplicant=False, searchIfNeeded=True):
if not documentFrame or self.isZombie(documentFrame):
documentFrame = self.documentFrame()
if not documentFrame:
+ if not searchIfNeeded:
+ return None, -1
return self._getCaretContextViaLocusOfFocus()
context = self._caretContexts.get(hash(documentFrame.parent))
if not context or documentFrame != self.getTopLevelDocumentForObject(context[0]):
+ if not searchIfNeeded:
+ return None, -1
obj, offset = self.searchForCaretContext(documentFrame)
elif not getZombieReplicant:
return context
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]