[orca] Handle caret-moved event emitted before focus events in newly-loaded page



commit 9a1a8b31294db43f0b8a23ee097b1362b8fe1b4a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Apr 22 15:02:33 2020 -0400

    Handle caret-moved event emitted before focus events in newly-loaded page
    
    Sometimes we get a caret-moved event for a fragment before the page
    has finished loading and/or the document claimed focus. In this case,
    the eventIsFromLocusOfFocusDocument() test fails because the locusOfFocus
    document is a zombie. Therefore, if we detect this condition, compare
    the event.source document with the active document based on the embeds
    relation.

 src/orca/scripts/web/script_utilities.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9ce4d151e..6999bc4e5 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4141,10 +4141,19 @@ class Utilities(script_utilities.Utilities):
     def eventIsFromLocusOfFocusDocument(self, event):
         source = self.getDocumentForObject(event.source)
         focus = self.getDocumentForObject(orca_state.locusOfFocus)
-        rv = source and focus and source == focus
-        msg = "WEB: Event doc %s is same as focus doc %s: %s" % (source, focus, rv)
-        debug.println(debug.LEVEL_INFO, msg, True)
-        return rv
+        if not (source and focus):
+            return False
+
+        if source == focus:
+            return True
+
+        if self.isZombie(focus) and not self.isZombie(source):
+            if self.activeDocument() == source:
+                msg = "WEB: Treating active doc as locusOfFocus doc"
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return True
+
+        return False
 
     def textEventIsDueToDeletion(self, event):
         if not self.inDocumentContent(event.source) \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]