[orca/gnome-3-34] Move getChildAtOffset() out of web script so other scripts can use it
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-34] Move getChildAtOffset() out of web script so other scripts can use it
- Date: Tue, 24 Sep 2019 11:19:22 +0000 (UTC)
commit 1bb90a41ccbb892a86f0ab86d85971e0180e9e83
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Sep 24 13:18:52 2019 +0200
Move getChildAtOffset() out of web script so other scripts can use it
src/orca/script_utilities.py | 27 +++++++++++++++++++++++++++
src/orca/scripts/web/script_utilities.py | 27 ---------------------------
2 files changed, 27 insertions(+), 27 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index cee9d87e1..9e6751769 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2630,6 +2630,33 @@ class Utilities:
return rv
+ def getChildAtOffset(self, obj, offset):
+ try:
+ hypertext = obj.queryHypertext()
+ except NotImplementedError:
+ msg = "INFO: %s does not implement the hypertext interface" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return None
+ except:
+ msg = "INFO: Exception querying hypertext interface for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return None
+
+ index = hypertext.getLinkIndex(offset)
+ if index == -1:
+ return None
+
+ hyperlink = hypertext.getLink(index)
+ if not hyperlink:
+ msg = "INFO: No hyperlink object at index %i for %s" % (index, obj)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return None
+
+ child = hyperlink.getObject(0)
+ msg = "INFO: Hyperlink object at index %i for %s is %s" % (index, obj, child)
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return child
+
def characterOffsetInParent(self, obj):
"""Returns the character offset of the embedded object
character for this object in its parent's accessible text.
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 374c000bb..5306c69de 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3859,33 +3859,6 @@ class Utilities(script_utilities.Utilities):
start, end = self.getHyperlinkRange(obj)
return start, end, text.characterCount
- def getChildAtOffset(self, obj, offset):
- try:
- hypertext = obj.queryHypertext()
- except NotImplementedError:
- msg = "WEB: %s does not implement the hypertext interface" % obj
- debug.println(debug.LEVEL_INFO, msg, True)
- return None
- except:
- msg = "WEB: Exception querying hypertext interface for %s" % obj
- debug.println(debug.LEVEL_INFO, msg, True)
- return None
-
- index = hypertext.getLinkIndex(offset)
- if index == -1:
- return None
-
- hyperlink = hypertext.getLink(index)
- if not hyperlink:
- msg = "ERROR: No hyperlink object at index %i for %s" % (index, obj)
- debug.println(debug.LEVEL_INFO, msg, True)
- return None
-
- child = hyperlink.getObject(0)
- msg = "WEB: Hyperlink object at index %i for %s is %s" % (index, obj, child)
- debug.println(debug.LEVEL_INFO, msg, True)
- return child
-
def getError(self, obj):
if not (obj and self.inDocumentContent(obj)):
return super().getError(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]