[orca] Web: Treat pre elements as plain text for broken text recovery



commit cc66e8aa1424244e8d0caf6f6c68a37892a972ba
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Feb 17 14:57:34 2021 +0100

    Web: Treat pre elements as plain text for broken text recovery
    
    For some browsers (currently just Gecko-based ones), we sanity-check
    all results we get from the AtkText implementations because there are
    many bogus results. Sometimes, however, we get zero-length text at
    offset results which are valid. This happens in plain-text documents.
    Turns out it can also happen in preformatted-text elements. In these
    instances, other AtkText bugs (e.g. bogus text-range extents) can
    prevent our hack around from obtaining the right text range for the
    specified offset and we wind up treating all the text as if it were
    on a single line. Treating preformatted-text elements as plain text
    causes us to not attempt broken text recovery when we shouldn't.

 src/orca/scripts/web/script_utilities.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index c7ae50e73..0fa5f60ba 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1294,7 +1294,7 @@ class Utilities(script_utilities.Utilities):
                   % (offset, obj, boundary, s1, start, end, text.characterCount, s2)
             debug.println(debug.LEVEL_INFO, msg, True)
             needSadHack = True
-        elif not (start <= offset < end) and not self.isPlainText():
+        elif not (start <= offset < end) and not (self.isPlainText() or self.elementIsPreformattedText(obj)):
             s1 = string.replace(self.EMBEDDED_OBJECT_CHARACTER, "[OBJ]").replace("\n", "\\n")
             msg = "FAIL: Bad results for text at offset %i for %s using %s:\n" \
                   "      String: '%s', Start: %i, End: %i.\n" \


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