[orca] Mouse review: Don't present object consisting solely of embedded objects



commit 25ab3d66868b1630be410dc34b151dee1391651a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon May 25 14:39:18 2020 -0400

    Mouse review: Don't present object consisting solely of embedded objects
    
    If the deepest descendant under the mouse pointer consists solely of
    embedded objects, and the mouse pointer is not over any of those objects,
    we have nothing to present. And we certainly don't want to present the
    full container's worth of objects.

 src/orca/mouse_review.py     | 5 +++++
 src/orca/script_utilities.py | 8 ++++++++
 2 files changed, 13 insertions(+)
---
diff --git a/src/orca/mouse_review.py b/src/orca/mouse_review.py
index c9c38b9ae..086d4f6ed 100644
--- a/src/orca/mouse_review.py
+++ b/src/orca/mouse_review.py
@@ -292,6 +292,11 @@ class _ItemContext:
         if self._frame and self._frame != prior._frame:
             self._script.presentObject(self._frame, alreadyFocused=True, inMouseReview=True)
 
+        if self._script.utilities.containsOnlyEOCs(self._obj):
+            msg = "MOUSE REVIEW: Not presenting object which contains only EOCs"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
         if self._obj and self._obj != prior._obj:
             priorObj = prior._obj or self._getContainer()
             orca.emitRegionChanged(self._obj, mode=orca.MOUSE_REVIEW)
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 125612b6e..f5d3db5b1 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2816,6 +2816,14 @@ class Utilities:
         for i in range(text.getNSelections()):
             text.removeSelection(i)
 
+    def containsOnlyEOCs(self, obj):
+        try:
+            string = obj.queryText().getText(0, -1)
+        except:
+            return False
+
+        return string and not re.search(r"[^\ufffc]", string)
+
     def expandEOCs(self, obj, startOffset=0, endOffset=-1):
         """Expands the current object replacing EMBEDDED_OBJECT_CHARACTERS
         with their text.


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