[orca] Use our revised getChildAtOffset() instead of getChildIndex() + direct access
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Use our revised getChildAtOffset() instead of getChildIndex() + direct access
- Date: Tue, 23 Apr 2019 06:40:09 +0000 (UTC)
commit bd6b956e2a1c52dd00acbba3b641db75590abb91
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Apr 23 02:38:30 2019 -0400
Use our revised getChildAtOffset() instead of getChildIndex() + direct access
src/orca/scripts/web/script_utilities.py | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index e5633907d..094a5a575 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1195,12 +1195,8 @@ class Utilities(script_utilities.Utilities):
pass
else:
if char == self.EMBEDDED_OBJECT_CHARACTER:
- childIndex = self.getChildIndex(obj, offset)
- try:
- child = obj[childIndex]
- except:
- pass
- else:
+ child = self.getChildAtOffset(obj, offset)
+ if child:
return self._getContentsForObj(child, 0, boundary)
ranges = [m.span() for m in re.finditer("[^\ufffc]+", string)]
@@ -3448,21 +3444,6 @@ class Utilities(script_utilities.Utilities):
start, end = self.getHyperlinkRange(obj)
return start, end, text.characterCount
- @staticmethod
- def getChildIndex(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 -1
- except:
- msg = "WEB: Exception querying hypertext interface for %s" % obj
- debug.println(debug.LEVEL_INFO, msg, True)
- return -1
-
- return hypertext.getLinkIndex(offset)
-
def getChildAtOffset(self, obj, offset):
try:
hypertext = obj.queryHypertext()
@@ -3609,9 +3590,9 @@ class Utilities(script_utilities.Utilities):
obj = None
else:
contextObj, contextOffset = obj, offset
- childIndex = self.getChildIndex(obj, offset)
- if childIndex >= 0 and obj.childCount:
- obj = obj[childIndex]
+ child = self.getChildAtOffset(obj, offset)
+ if child:
+ obj = child
else:
break
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]