[orca] Web: Prevent trees and tree items from being presented on the same line



commit b0280c5013ba67ba9a96bfbefe1fe7090d8ffb0f
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Mar 23 11:44:18 2021 +0100

    Web: Prevent trees and tree items from being presented on the same line
    
    Trees can be read via browse mode if the user opts to do so. However,
    depending on the associated markup, the items might be rendered on
    the same line. Even in browse mode, we don't want to treat trees and
    tree items as if they are on the same line beacuse it can be confusing
    and chatty.

 src/orca/scripts/web/script_utilities.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 677f933d7..97252b6d5 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1032,7 +1032,7 @@ class Utilities(script_utilities.Utilities):
         if not self.inDocumentContent(obj):
             return rv
 
-        if rv and self._treatObjectAsWhole(obj) and obj.name and not self.isCellWithNameFromHeader(obj):
+        if rv and self._treatObjectAsWhole(obj, -1) and obj.name and not self.isCellWithNameFromHeader(obj):
             msg = "WEB: Treating %s as non-text: named object treated as whole." % obj
             debug.println(debug.LEVEL_INFO, msg, True)
             rv = False
@@ -1746,6 +1746,9 @@ class Utilities(script_utilities.Utilities):
                         return False
                 elif self.isBlockListDescendant(obj) != self.isBlockListDescendant(xObj):
                     return False
+                elif obj.getRole() in [pyatspi.ROLE_TREE, pyatspi.ROLE_TREE_ITEM] \
+                     and xObj.getRole() in [pyatspi.ROLE_TREE, pyatspi.ROLE_TREE_ITEM]:
+                    return False
 
             if self.isMathTopLevel(xObj) or self.isMath(obj):
                 onSameLine = self.extentsAreOnSameLine(extents, xExtents, extents[3])
@@ -5031,7 +5034,7 @@ class Utilities(script_utilities.Utilities):
                 for i in range(offset + 1, len(allText)):
                     child = self.getChildAtOffset(obj, i)
                     if self._canHaveCaretContext(child):
-                        if self._treatObjectAsWhole(child, 0):
+                        if self._treatObjectAsWhole(child, -1):
                             return child, 0
                         return self.findNextCaretInOrder(child, -1)
                     if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):
@@ -5097,7 +5100,7 @@ class Utilities(script_utilities.Utilities):
                 for i in range(offset - 1, -1, -1):
                     child = self.getChildAtOffset(obj, i)
                     if self._canHaveCaretContext(child):
-                        if self._treatObjectAsWhole(child, 0):
+                        if self._treatObjectAsWhole(child, -1):
                             return child, 0
                         return self.findPreviousCaretInOrder(child, -1)
                     if allText[i] not in (self.EMBEDDED_OBJECT_CHARACTER, self.ZERO_WIDTH_NO_BREAK_SPACE):


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