[orca] Chromium: Eliminate chattiness from omnibox



commit 253e713538c221e83f7bae4303982f87696ef856
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri May 8 13:14:15 2020 -0400

    Chromium: Eliminate chattiness from omnibox
    
    When the user presses return in the omnibox, we get various and sundry
    events including text-caret-moved, text-selection-changed, text-changed-
    delete. Presenting these changes just adds chattiness before presenting
    the important information (i.e. about the newly-loaded page). Therefore,
    try to identify and ignore these events.

 src/orca/script_utilities.py             | 15 +++++++++++++++
 src/orca/scripts/web/script.py           | 10 ++++++++++
 src/orca/scripts/web/script_utilities.py |  3 +++
 src/orca/speech_generator.py             |  4 ++--
 4 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 373036f6e..d9eebc2e0 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4002,6 +4002,21 @@ class Utilities:
 
         return False
 
+    def isSingleLineAutocompleteEntry(self, obj):
+        try:
+            role = obj.getRole()
+            state = obj.getState()
+        except:
+            msg = "ERROR: Exception getting role and state for %s" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        if role != pyatspi.ROLE_ENTRY:
+            return False
+
+        return state.contains(pyatspi.STATE_SUPPORTS_AUTOCOMPLETION) \
+            and state.contains(pyatspi.STATE_SINGLE_LINE)
+
     def isEntryCompletionPopupItem(self, obj):
         return False
 
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 65497a141..53c9c1137 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1483,6 +1483,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if self.utilities.eventIsBrowserUINoise(event):
+            msg = "WEB: Ignoring event believed to be browser UI noise"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         if not self.utilities.inDocumentContent(event.source):
             msg = "WEB: Event source is not in document content"
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -2254,6 +2259,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        if self.utilities.eventIsBrowserUINoise(event):
+            msg = "WEB: Ignoring event believed to be browser UI noise"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         if not self.utilities.inDocumentContent(event.source):
             msg = "WEB: Event source is not in document content"
             debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 63381fc94..1d91a5525 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -4097,6 +4097,9 @@ class Utilities(script_utilities.Utilities):
             return False
 
         eType = event.type
+        if eType.startswith("object:text-") and self.isSingleLineAutocompleteEntry(event.source):
+            lastKey, mods = self.lastKeyAndModifiers()
+            return lastKey == "Return"
         if eType.startswith("object:text-") or eType.endswith("accessible-name"):
             return role in [pyatspi.ROLE_STATUS_BAR, pyatspi.ROLE_LABEL]
         if eType.startswith("object:children-changed"):
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 13b2a36c3..cf6bcad3a 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -552,10 +552,10 @@ class SpeechGenerator(generator.Generator):
         if role == pyatspi.ROLE_MENU and parentRole == pyatspi.ROLE_COMBO_BOX:
             return self._generateRoleName(obj.parent)
 
-        if role == pyatspi.ROLE_ENTRY \
-           and obj.getState().contains(pyatspi.STATE_SUPPORTS_AUTOCOMPLETION):
+        if self._script.utilities.isSingleLineAutocompleteEntry(obj):
             result.append(self.getLocalizedRoleName(obj, role=pyatspi.ROLE_AUTOCOMPLETE))
             result.extend(acss)
+            return result
 
         if role == pyatspi.ROLE_PANEL and obj.getState().contains(pyatspi.STATE_SELECTED):
             return []


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