[orca] Simplify the logic for zombie recovery when children are added



commit e2408e45fa464ed2dd35bbc2c03aef8c714b255b
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Apr 1 15:18:46 2020 -0400

    Simplify the logic for zombie recovery when children are added
    
    We have newer logic that handles this condition for focus changes,
    and does so more reliably and in a more performant fashion than
    a tree dive looking for the replicant of a now-defunct object.

 src/orca/scripts/web/script.py | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index b66032f92..7fdaa4ee7 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1691,31 +1691,13 @@ class Script(default.Script):
         debug.println(debug.LEVEL_INFO, msg, True)
 
         if self.utilities.isZombie(obj):
-            obj, offset = self.utilities.getCaretContext(getZombieReplicant=True)
-            if not obj:
-                if self._inFocusMode:
-                    if event.source.getState().contains(pyatspi.STATE_FOCUSED) \
-                       and not self.utilities.isTextBlockElement(event.source):
-                        msg = "WEB: Event handled by updating locusOfFocus and context"
-                        debug.println(debug.LEVEL_INFO, msg, True)
-                        orca.setLocusOfFocus(event, event.source, False)
-                        self.utilities.setCaretContext(event.source, 0)
-                        return True
-
-                    msg = "WEB: Not looking for replicant due to focus mode."
-                    debug.println(debug.LEVEL_INFO, msg, True)
-                    return False
-
-                obj = self.utilities.findReplicant(event.source, obj)
-                if obj:
-                    # Refrain from actually touching the replicant by grabbing
-                    # focus or setting the caret in it. Doing so will only serve
-                    # to anger it.
-                    msg = "WEB: Event handled by updating locusOfFocus and context"
-                    debug.println(debug.LEVEL_INFO, msg, True)
-                    orca.setLocusOfFocus(event, obj, False)
-                    self.utilities.setCaretContext(obj, offset)
-                    return True
+            obj, offset = self.utilities.searchForCaretContext(event.source)
+            if obj:
+                msg = "WEB: Event handled by updating locusOfFocus and context"
+                debug.println(debug.LEVEL_INFO, msg, True)
+                orca.setLocusOfFocus(event, obj, False)
+                self.utilities.setCaretContext(obj, offset)
+                return True
 
         childRole = event.any_data.getRole()
         if childRole == pyatspi.ROLE_ALERT:


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