[orca] Ignore a bogus object from the Gecko accessibility tree



commit 0710a741e218589f4d06232a6ac5bbec1ed63cd7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Nov 20 18:18:07 2019 -0500

    Ignore a bogus object from the Gecko accessibility tree

 src/orca/script_utilities.py                        |  6 ++++++
 src/orca/scripts/toolkits/Gecko/script_utilities.py | 11 +++++++++++
 2 files changed, 17 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index a1ab98048..7e65c7615 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4093,11 +4093,17 @@ class Utilities:
     def _objectBoundsMightBeBogus(self, obj):
         return False
 
+    def _objectMightBeBogus(self, obj):
+        return False
+
     def containsPoint(self, obj, x, y, coordType, margin=2):
         if self._objectBoundsMightBeBogus(obj) \
            and self.textAtPoint(obj, x, y, coordType) == ("", 0, 0):
             return False
 
+        if self._objectMightBeBogus(obj):
+            return False
+
         try:
             component = obj.queryComponent()
         except:
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index c1277d474..1b344a25b 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -184,6 +184,17 @@ class Utilities(web.Utilities):
 
         return False
 
+    def _objectMightBeBogus(self, obj):
+        if not obj:
+            return False
+
+        if obj.getRole() == pyatspi.ROLE_SECTION and obj.parent.getRole() == pyatspi.ROLE_FRAME:
+            msg = "GECKO: %s is believed to be a bogus object" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
+        return False
+
     def canBeActiveWindow(self, window, clearCache=False):
         # We apparently having missing events from Gecko requiring
         # we update the cache. This is not performant. :(


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