[orca] Adjust bounding box height to take newline chars into account during review



commit 87ba9654886f774a9b4c17824005f7a4a6e4a0da
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jul 9 11:44:11 2019 -0400

    Adjust bounding box height to take newline chars into account during review

 src/orca/mouse_review.py | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index 0a980e331..1bc824328 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -99,6 +99,14 @@ class _StringContext:
         if otherBox == (0, 0, 0, 0):
             return False
 
+        # We get various and sundry results for the bounding box if the implementor
+        # included newline characters as part of the word or line at offset. Try to
+        # detect this and adjust the bounding boxes before getting the intersection.
+        if thisBox[3] != otherBox[3] and self._obj == other._obj:
+            thisNewLineCount = self._string.count("\n")
+            if thisNewLineCount and thisBox[3] / thisNewLineCount == otherBox[3]:
+                thisBox = *thisBox[0:3], otherBox[3]
+
         if self._script.utilities.intersection(thisBox, otherBox) != thisBox:
             return False
 


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