[orca] Ignore page loads for non-active documents
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Ignore page loads for non-active documents
- Date: Tue, 8 Jan 2019 20:04:15 +0000 (UTC)
commit 2f76cf9d8d37a34ad6c1d467188c63687be6e49c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Jan 8 15:03:40 2019 -0500
Ignore page loads for non-active documents
src/orca/scripts/web/script.py | 9 +++++++--
src/orca/scripts/web/script_utilities.py | 16 +++++++++++-----
2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 5c4536389..96a2d6b5c 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1273,8 +1273,6 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg, True)
return True
- self._loadingDocumentContent = event.detail1
-
obj, offset = self.utilities.getCaretContext()
if not obj or self.utilities.isZombie(obj):
self.utilities.clearCaretContext()
@@ -1289,6 +1287,13 @@ class Script(default.Script):
else:
self.presentMessage(messages.PAGE_LOADING_END)
+ activeDocument = self.utilities.activeDocument()
+ if activeDocument and activeDocument != event.source:
+ msg = "WEB: Ignoring: Event source is not active document"
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return True
+
+ self._loadingDocumentContent = event.detail1
if event.detail1:
return True
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index e3ec1d387..6b0d89cb0 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -274,13 +274,19 @@ class Utilities(script_utilities.Utilities):
orca_state.activeWindow = window
return True
+ def activeDocument(self):
+ isShowing = lambda x: x and x.getState().contains(pyatspi.STATE_SHOWING)
+ documents = self._getDocumentsEmbeddedBy(orca_state.activeWindow)
+ documents = list(filter(isShowing, documents))
+ if len(documents) == 1:
+ return documents[0]
+ return None
+
def documentFrame(self, obj=None):
if self.sanityCheckActiveWindow():
- isShowing = lambda x: x and x.getState().contains(pyatspi.STATE_SHOWING)
- documents = self._getDocumentsEmbeddedBy(orca_state.activeWindow)
- documents = list(filter(isShowing, documents))
- if len(documents) == 1:
- return documents[0]
+ document = self.activeDocument()
+ if document:
+ return document
return self.getDocumentForObject(obj or orca_state.locusOfFocus)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]