[orca] Be sure we have the top level document before sanity-checking context
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Be sure we have the top level document before sanity-checking context
- Date: Wed, 21 Aug 2019 21:04:59 +0000 (UTC)
commit 50ecb8ad74c0ae600935bfe56b5d7e387954a790
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Aug 21 17:04:37 2019 -0400
Be sure we have the top level document before sanity-checking context
src/orca/scripts/web/script_utilities.py | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 76be6f696..2610f942d 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -243,6 +243,16 @@ class Utilities(script_utilities.Utilities):
return pyatspi.findAncestor(obj, self.isDocument)
+ def getTopLevelDocumentForObject(self, obj):
+ document = self.getDocumentForObject(obj)
+ while document:
+ ancestor = pyatspi.findAncestor(document, self.isDocument)
+ if not ancestor or ancestor == document:
+ break
+ document = ancestor
+
+ return document
+
def _getDocumentsEmbeddedBy(self, frame):
if not frame:
return []
@@ -4027,7 +4037,7 @@ class Utilities(script_utilities.Utilities):
return self._getCaretContextViaLocusOfFocus()
context = self._caretContexts.get(hash(documentFrame.parent))
- if not context or documentFrame != self.getDocumentForObject(context[0]):
+ if not context or documentFrame != self.getTopLevelDocumentForObject(context[0]):
obj, offset = self.searchForCaretContext(documentFrame)
elif not getZombieReplicant:
return context
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]