[orca] Chromium: Work around bogus text range extents



commit 6cd7304938ac198bc26834747c3ee16416d9f6c8
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 17 20:52:21 2020 +0100

    Chromium: Work around bogus text range extents

 src/orca/scripts/web/script_utilities.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index a46685725..ce33bfcb3 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -764,16 +764,24 @@ class Utilities(script_utilities.Utilities):
         if not obj:
             return [0, 0, 0, 0]
 
+        result = [0, 0, 0, 0]
         try:
             text = obj.queryText()
             if text.characterCount and 0 <= startOffset < endOffset:
-                return list(text.getRangeExtents(startOffset, endOffset, 0))
+                result = list(text.getRangeExtents(startOffset, endOffset, 0))
         except NotImplementedError:
             pass
         except:
             msg = "WEB: Exception getting range extents for %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             return [0, 0, 0, 0]
+        else:
+            if result[0] and result[1] and (result[2] == 0 or result[3] == 0):
+                msg = "WEB: Suspected bogus range extents for %s (chars: %i, %i): %s" % \
+                    (obj, startOffset, endOffset, result)
+                debug.println(debug.LEVEL_INFO, msg, True)
+            else:
+                return result
 
         role = obj.getRole()
         try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]