[orca] Chromium: Update support in response to bug fixes
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Chromium: Update support in response to bug fixes
- Date: Fri, 19 Apr 2019 22:31:06 +0000 (UTC)
commit 4adb5faf3c163b54bebd6e90f1f18e0c52bdd0eb
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Apr 19 18:29:35 2019 -0400
Chromium: Update support in response to bug fixes
src/orca/scripts/toolkits/Chromium/script.py | 34 ++++++++--------------
.../scripts/toolkits/Chromium/script_utilities.py | 30 +++++++++++++++++++
2 files changed, 42 insertions(+), 22 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Chromium/script.py b/src/orca/scripts/toolkits/Chromium/script.py
index d38040d4b..19fa503e1 100644
--- a/src/orca/scripts/toolkits/Chromium/script.py
+++ b/src/orca/scripts/toolkits/Chromium/script.py
@@ -163,6 +163,11 @@ class Script(web.Script):
def onCaretMoved(self, event):
"""Callback for object:text-caret-moved accessibility events."""
+ if self.utilities.isRedundantAutocompleteEvent(event):
+ msg = "CHROMIUM: Ignoring redundant autocomplete event"
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return
+
if super().onCaretMoved(event):
return
@@ -287,31 +292,16 @@ class Script(web.Script):
def onSelectedChanged(self, event):
"""Callback for object:state-changed:selected accessibility events."""
- if event.source.getRole() == pyatspi.ROLE_PAGE_TAB and event.detail1:
- oldName = event.source.name
- event.source.clearCache()
- newName = event.source.name
- if oldName != newName:
- msg = "CHROMIUM: NO NAME CHANGE HACK: (name should be: '%s')" % newName
- debug.println(debug.LEVEL_INFO, msg, True)
+ if super().onSelectedChanged(event):
+ return
- # Other apps and toolkits implement the selection interface, which is
- # what we use to present active-descendanty selection changes, leaving
- # state-changed:selected for notifications related to toggling the
- # selected state of the currently-focused item (e.g. pressing ctrl+space
- # in a file explorer). While handling active-descendanty changes here is
- # not technically a HACK, once Chromium implements the selection interface,
- # we should remove this code and defer to Orca's default handling.
- if event.detail1 and not self.utilities.isLayoutOnly(event.source) \
- and not "Selection" in pyatspi.listInterfaces(event.source.parent) \
- and self.utilities.canBeActiveWindow(self.utilities.topLevelObject(event.source)):
- msg = "CHROMIUM: NO SELECTION IFACE HACK: Setting %s to locusOfFocus" % event.source
+ # HACK: Remove this -- or more likely move this -- when we start getting
+ # selection-changed events from the omnibox popup.
+ if event.source.getRole() == pyatspi.ROLE_LIST_ITEM \
+ and self.utilities.isBrowserAutocompletePopup(event.source.parent):
+ msg = "CHROMIUM: NO SELECTION EVENT HACK: Setting locusOfFocus to %s" % event.source
debug.println(debug.LEVEL_INFO, msg, True)
orca.setLocusOfFocus(event, event.source)
- return
-
- if super().onSelectedChanged(event):
- return
msg = "CHROMIUM: Passing along event to default script"
debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/src/orca/scripts/toolkits/Chromium/script_utilities.py
b/src/orca/scripts/toolkits/Chromium/script_utilities.py
index 9b368734e..006151fd8 100644
--- a/src/orca/scripts/toolkits/Chromium/script_utilities.py
+++ b/src/orca/scripts/toolkits/Chromium/script_utilities.py
@@ -176,6 +176,36 @@ class Utilities(web.Utilities):
debug.println(debug.LEVEL_INFO, msg, True)
return menu
+ def isBrowserAutocompletePopup(self, obj):
+ if not obj or self.inDocumentContent(obj):
+ return False
+
+ # If we clear the cache, other objects (like the listbox parent as well as the
+ # selected list item) then claim to have role of redundant-object. Re-test after
+ # we get children-changed events.
+ if obj.getRole() == pyatspi.ROLE_REDUNDANT_OBJECT:
+ msg = "CHROMIUM: WARNING: Suspected bogus role on %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+
+ popupFor = lambda r: r.getRelationType() == pyatspi.RELATION_POPUP_FOR
+ relations = list(filter(popupFor, obj.getRelationSet()))
+ if not relations:
+ return False
+
+ target = relations[0].getTarget(0)
+ return target and target.getRole() == pyatspi.ROLE_AUTOCOMPLETE
+
+ def isRedundantAutocompleteEvent(self, event):
+ if event.source.getRole() != pyatspi.ROLE_AUTOCOMPLETE:
+ return False
+
+ if event.type.startswith("object:text-caret-moved"):
+ lastKey, mods = self.lastKeyAndModifiers()
+ if lastKey in ["Down", "Up"]:
+ return True
+
+ return False
+
def grabFocusWhenSettingCaret(self, obj):
# HACK: Remove this when setting the caret updates focus.
msg = "CHROMIUM: HACK: Doing focus grab when setting caret on %s" % obj
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]