[orca] Flat review: Clear cache when filler reports 0 children



commit bba896a49d56baacf2755dac2f8900808f549381
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 26 11:00:01 2021 +0100

    Flat review: Clear cache when filler reports 0 children
    
    It's extremely rare that a filler would have 0 children. If it claims
    to have 0, that suggests the app/toolkit is failing to emit children-
    changed:add events. Clearing the cache can sometimes work around this
    problem, but it is not 100% reliable and can require multiple attempts.

 src/orca/script_utilities.py | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 2f01f8b3d..1a2944dab 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2114,6 +2114,13 @@ class Utilities:
            and not self.isInOpenMenuBarMenu(root):
             return [root]
 
+        if role == pyatspi.ROLE_FILLER and not root.childCount:
+            msg = "INFO: %s is empty filler. Clearing cache." % root
+            debug.println(debug.LEVEL_INFO, msg, True)
+            root.clearCache()
+            msg = "INFO: %s reports %i children" % (root, root.childCount)
+            debug.println(debug.LEVEL_INFO, msg, True)
+
         if extents is None:
             try:
                 component = root.queryComponent()


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