[orca] Web: Ensure we dump content cache for editable text deletions



commit 126a0dff5ffa9b9f6b4bf27b80c80232bde48cec
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 7 13:55:22 2021 +0200

    Web: Ensure we dump content cache for editable text deletions
    
    We were not dumping our content cache in editable-text elements. Then,
    in order to ensure we didn't present stale information, we didn't use
    the cached content when speaking the word or line at offset if the
    element was editable. This can increase lagginess in rich text editors
    (e.g. Google Docs) in response to caret-moved events when braille is
    enabled because we build the line twice: once for braille and once
    for speech of an editable element. We can eliminate some lagginess by
    ensuring we dump the content cache for text deletions, and then using
    the updated cache when we speak the new position.

 src/orca/scripts/web/script.py | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 402662b84..1f6a6e98f 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -933,7 +933,7 @@ class Script(default.Script):
         if keyString == "Right":
             offset -= 1
 
-        wordContents = self.utilities.getWordContentsAtOffset(obj, offset, useCache=not isEditable)
+        wordContents = self.utilities.getWordContentsAtOffset(obj, offset, useCache=True)
         textObj, startOffset, endOffset, word = wordContents[0]
         self.speakMisspelledIndicator(textObj, startOffset)
         self.speakContents(wordContents)
@@ -952,7 +952,7 @@ class Script(default.Script):
             priorObj, priorOffset = self.utilities.getPriorContext()
 
         obj, offset = self.utilities.getCaretContext(documentFrame=None)
-        contents = self.utilities.getLineContentsAtOffset(obj, offset, useCache=not isEditable)
+        contents = self.utilities.getLineContentsAtOffset(obj, offset, useCache=True)
         self.speakContents(contents, priorObj=priorObj)
         self.pointOfReference["lastTextUnitSpoken"] = "line"
 
@@ -2256,16 +2256,6 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
-        if self.utilities.textEventIsDueToDeletion(event):
-            msg = "WEB: Event believed to be due to editable text deletion"
-            debug.println(debug.LEVEL_INFO, msg, True)
-            return False
-
-        if self.utilities.textEventIsDueToInsertion(event):
-            msg = "WEB: Ignoring event believed to be due to text insertion"
-            debug.println(debug.LEVEL_INFO, msg, True)
-            return True
-
         if self.utilities.eventIsSpinnerNoise(event):
             msg = "WEB: Ignoring: Event believed to be spinner noise"
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -2276,6 +2266,20 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return True
 
+        msg = "WEB: Clearing content cache due to text deletion"
+        debug.println(debug.LEVEL_INFO, msg, True)
+        self.utilities.clearContentCache()
+
+        if self.utilities.textEventIsDueToDeletion(event):
+            msg = "WEB: Event believed to be due to editable text deletion"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
+        if self.utilities.textEventIsDueToInsertion(event):
+            msg = "WEB: Ignoring event believed to be due to text insertion"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return True
+
         obj, offset = self.utilities.getCaretContext(getZombieReplicant=False)
         if obj and obj != event.source \
            and not pyatspi.findAncestor(obj, lambda x: x == event.source):
@@ -2297,10 +2301,6 @@ class Script(default.Script):
             msg = "WEB: Unable to get non-null, non-zombie context object"
             debug.println(debug.LEVEL_INFO, msg, True)
 
-        msg = "WEB: Clearing content cache due to text deletion"
-        debug.println(debug.LEVEL_INFO, msg, True)
-        self.utilities.clearContentCache()
-
         document = self.utilities.getDocumentForObject(event.source)
         if document:
             msg = "WEB: Clearing structural navigation cache for %s" % document


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