[orca] Treat articles as large objects for the purpose of structural navigation



commit 39404cfd764a0e9d3205b3c8eab4108c3eec7b95
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Tue Jul 18 13:13:27 2017 +0200

    Treat articles as large objects for the purpose of structural navigation

 src/orca/formatting.py                   |    9 +++++++++
 src/orca/scripts/web/script_utilities.py |    3 ++-
 src/orca/structural_navigation.py        |   26 ++++++++++++++++++--------
 3 files changed, 29 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 80ab4dc..93627ac 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -132,6 +132,10 @@ formatting = {
         pyatspi.ROLE_ANIMATION: {
             'unfocused': 'labelAndName'
             },
+        pyatspi.ROLE_ARTICLE: {
+            'focused': 'labelOrName + roleName',
+            'unfocused': 'labelOrName + roleName + pause + currentLineText + allTextSelection',
+            },
         pyatspi.ROLE_BLOCK_QUOTE: {
             'focused' : 'leaving or (roleName + pause + nestingLevel)',
             'unfocused': 'roleName + pause + nestingLevel + pause + displayedText',
@@ -511,6 +515,11 @@ formatting = {
             'unfocused': '[Component(obj,\
                                      asString(label + displayedText + roleName + (description and space(": 
") + description)))]',
             },
+        pyatspi.ROLE_ARTICLE: {
+            'unfocused': '((substring and ' + BRAILLE_TEXT + ')\
+                          or ([Component(obj, asString(labelAndName + roleName))]\
+                             + (childWidget and ([Region(" ")] + childWidget))))'
+            },
         #pyatspi.ROLE_ARROW: 'default'
         pyatspi.ROLE_CANVAS: {
             'unfocused': '[Component(obj,\
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index becc6ed..9feca55 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1590,7 +1590,8 @@ class Utilities(script_utilities.Utilities):
         return False
 
     def _textBlockElementRoles(self):
-        roles = [pyatspi.ROLE_CAPTION,
+        roles = [pyatspi.ROLE_ARTICLE,
+                 pyatspi.ROLE_CAPTION,
                  pyatspi.ROLE_COLUMN_HEADER,
                  pyatspi.ROLE_DOCUMENT_FRAME,
                  pyatspi.ROLE_DOCUMENT_WEB,
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 903625d..c3d6dad 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -603,6 +603,7 @@ class StructuralNavigation:
                     pyatspi.ROLE_TABLE_CELL,
                     pyatspi.ROLE_TEXT,
                     pyatspi.ROLE_SECTION,
+                    pyatspi.ROLE_ARTICLE,
                     pyatspi.ROLE_DOCUMENT_EMAIL,
                     pyatspi.ROLE_DOCUMENT_FRAME,
                     pyatspi.ROLE_DOCUMENT_PRESENTATION,
@@ -1654,15 +1655,24 @@ class StructuralNavigation:
           the criteria (e.g. the level of a heading).
         """
 
-        if obj and obj.getRole() in self.OBJECT_ROLES:
-            text = self._script.utilities.queryNonEmptyText(obj)
-            if not (text and text.characterCount > settings.largeObjectTextLength):
-                return False
+        if not obj:
+            return False
 
-            string = text.getText(0, -1)
-            eocs = string.count(self._script.EMBEDDED_OBJECT_CHARACTER)
-            if eocs/text.characterCount < 0.05:
-                return True
+        role = obj.getRole()
+        if role not in self.OBJECT_ROLES:
+            return False
+
+        if role == pyatspi.ROLE_ARTICLE:
+            return True
+
+        text = self._script.utilities.queryNonEmptyText(obj)
+        if not (text and text.characterCount > settings.largeObjectTextLength):
+            return False
+
+        string = text.getText(0, -1)
+        eocs = string.count(self._script.EMBEDDED_OBJECT_CHARACTER)
+        if eocs/text.characterCount < 0.05:
+            return True
 
         return False
 


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