[orca] Don't re-announce focus when entry children emit caret-moved events



commit afb0a3050571c4a5ce3a3fc33b069574d6d37397
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Feb 7 14:41:06 2018 -0500

    Don't re-announce focus when entry children emit caret-moved events

 src/orca/scripts/web/script.py           |    6 ++++--
 src/orca/scripts/web/script_utilities.py |   15 +++++++++++++++
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index f4ac5b9..cca826b 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1362,7 +1362,8 @@ class Script(default.Script):
             msg = "WEB: Event handled: Last command was mouse button"
             debug.println(debug.LEVEL_INFO, msg, True)
             self.utilities.setCaretContext(event.source, event.detail1)
-            orca.setLocusOfFocus(event, event.source)
+            notify = not self.utilities.isEntryDescendant(event.source)
+            orca.setLocusOfFocus(event, event.source, notify)
             return True
 
         if self.utilities.inFindToolbar():
@@ -1409,7 +1410,8 @@ class Script(default.Script):
             msg = "WEB: In content editable with embedded objects"
             debug.println(debug.LEVEL_INFO, msg, True)
             self.utilities.setCaretContext(obj, offset)
-            notify = not self.utilities.lastInputEventWasCharNav()
+            notify = not self.utilities.lastInputEventWasCharNav() \
+                     and not self.utilities.isEntryDescendant(obj)
             orca.setLocusOfFocus(event, event.source, notify)
             return False
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 27dc182..b0c9ffb 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -57,6 +57,7 @@ class Utilities(script_utilities.Utilities):
         self._inTopLevelWebApp = {}
         self._isTextBlockElement = {}
         self._isContentEditableWithEmbeddedObjects = {}
+        self._isEntryDescendant = {}
         self._isGridDescendant = {}
         self._isLabelDescendant = {}
         self._isMenuDescendant = {}
@@ -122,6 +123,7 @@ class Utilities(script_utilities.Utilities):
         self._inTopLevelWebApp = {}
         self._isTextBlockElement = {}
         self._isContentEditableWithEmbeddedObjects = {}
+        self._isEntryDescendant = {}
         self._isGridDescendant = {}
         self._isLabelDescendant = {}
         self._isMenuDescendant = {}
@@ -2131,6 +2133,19 @@ class Utilities(script_utilities.Utilities):
         self._isGridDescendant[hash(obj)] = rv
         return rv
 
+    def isEntryDescendant(self, obj):
+        if not obj:
+            return False
+
+        rv = self._isEntryDescendant.get(hash(obj))
+        if rv is not None:
+            return rv
+
+        isEntry = lambda x: x and x.getRole() == pyatspi.ROLE_ENTRY
+        rv = pyatspi.findAncestor(obj, isEntry) is not None
+        self._isEntryDescendant[hash(obj)] = rv
+        return rv
+
     def isLabelDescendant(self, obj):
         if not obj:
             return False


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