[orca] Don't use cached attributes for posinset and setsize



commit 75639f7ae0664886a4f9e2d39bb0cf7e0f505a3e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 20 16:39:23 2020 +0100

    Don't use cached attributes for posinset and setsize
    
    In a dynamic or editable list, these values can change.

 src/orca/scripts/web/script_utilities.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 06034e0b9..8442b62a2 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -518,13 +518,14 @@ class Utilities(script_utilities.Utilities):
 
         return lastChild
 
-    def objectAttributes(self, obj):
+    def objectAttributes(self, obj, useCache=True):
         if not (obj and self.inDocumentContent(obj)):
             return super().objectAttributes(obj)
 
-        rv = self._objectAttributes.get(hash(obj))
-        if rv is not None:
-            return rv
+        if useCache:
+            rv = self._objectAttributes.get(hash(obj))
+            if rv is not None:
+                return rv
 
         try:
             rv = dict([attr.split(':', 1) for attr in obj.getAttributes()])
@@ -551,7 +552,7 @@ class Utilities(script_utilities.Utilities):
         return rv
 
     def getPositionInSet(self, obj):
-        attrs = self.objectAttributes(obj)
+        attrs = self.objectAttributes(obj, False)
         position = attrs.get('posinset')
         if position is not None:
             return int(position)
@@ -559,7 +560,7 @@ class Utilities(script_utilities.Utilities):
         return None
 
     def getSetSize(self, obj):
-        attrs = self.objectAttributes(obj)
+        attrs = self.objectAttributes(obj, False)
         setsize = attrs.get('setsize')
         if setsize is not None:
             return int(setsize)


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