[orca/gnome-3-14] Use labelOrName rather than labelAndName for widgets typically lacking both



commit c741c849a790596279a3a5707c45b7644667e63a
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Sep 7 02:28:16 2014 -0400

    Use labelOrName rather than labelAndName for widgets typically lacking both
    
    Orca tries extremely hard to find presentable information for the user,
    falling back on inference for labels and displayed text for names as a
    last resort. Many widgets have a label or a name; not both, and all the
    fallbacks do with those widgets is add noise.

 src/orca/formatting.py                             |  119 ++++++++++----------
 src/orca/generator.py                              |    7 +-
 src/orca/script_utilities.py                       |    2 +
 src/orca/scripts/toolkits/Gecko/formatting.py      |    7 +-
 .../scripts/toolkits/Gecko/speech_generator.py     |   19 +---
 test/keystrokes/firefox/aria_button_dojo.py        |   28 +++---
 test/keystrokes/firefox/aria_button_uiuc.py        |   58 +++++-----
 test/keystrokes/firefox/aria_radio_button_uiuc.py  |   15 +--
 test/keystrokes/firefox/aria_treegrid.py           |    6 +-
 9 files changed, 120 insertions(+), 141 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index f787b34..8c12c05 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -102,12 +102,12 @@ formatting = {
             },
         'default': {
             'focused': '[]',
-            'unfocused': 'labelAndName + allTextSelection + roleName + availability + ' + MNEMONIC + ' + 
accelerator + childWidget',
-            'basicWhereAmI': 'labelAndName + roleName',
+            'unfocused': 'labelOrName + allTextSelection + roleName + availability + ' + MNEMONIC + ' + 
accelerator + childWidget',
+            'basicWhereAmI': 'labelOrName + roleName',
             'detailedWhereAmI' : '[]'
             },
         pyatspi.ROLE_ALERT: {
-            'unfocused': 'labelAndName + unrelatedLabels'
+            'unfocused': 'labelOrName + unrelatedLabels'
             },
         pyatspi.ROLE_ANIMATION: {
             'unfocused': 'labelAndName'
@@ -120,13 +120,13 @@ formatting = {
             },
         pyatspi.ROLE_CHECK_BOX: {
             'focused': 'checkedState',
-            'unfocused': 'labelAndName + roleName + checkedState + required + availability + ' + MNEMONIC + 
' + accelerator',
-            'basicWhereAmI': 'namedContainingPanel + labelAndName + roleName + checkedState + ' + MNEMONIC + 
' + accelerator + required'
+            'unfocused': 'labelOrName + roleName + checkedState + required + availability + ' + MNEMONIC + ' 
+ accelerator',
+            'basicWhereAmI': 'namedContainingPanel + labelOrName + roleName + checkedState + ' + MNEMONIC + 
' + accelerator + required'
             },
         pyatspi.ROLE_CHECK_MENU_ITEM: {
             'focused': 'checkedState',
-            'unfocused': 'labelAndName + roleName + checkedState + required + availability + ' + MNEMONIC + 
' + accelerator + positionInList',
-            'basicWhereAmI': 'ancestors + labelAndName + roleName + checkedState + accelerator + 
positionInList + ' + MNEMONIC
+            'unfocused': 'labelOrName + roleName + checkedState + required + availability + ' + MNEMONIC + ' 
+ accelerator + positionInList',
+            'basicWhereAmI': 'ancestors + labelOrName + roleName + checkedState + accelerator + 
positionInList + ' + MNEMONIC
             },
         pyatspi.ROLE_COLOR_CHOOSER: {
             'focused': 'value',
@@ -144,9 +144,10 @@ formatting = {
             'basicWhereAmI': 'labelOrName + roleName + value + percentage + ' + MNEMONIC + ' + accelerator + 
required'
             },
         pyatspi.ROLE_DIALOG: {
-            'unfocused': 'labelAndName + unrelatedLabels'
+            'unfocused': 'labelOrName + unrelatedLabels'
             },
         pyatspi.ROLE_DOCUMENT_FRAME: {
+            'unfocused': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
             'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
             'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC + ' + ' + TUTORIAL
             },
@@ -161,10 +162,11 @@ formatting = {
             'detailedWhereAmI': 'labelOrName + placeholderText + readOnly + textRole + 
textContentWithAttributes + anyTextSelection + ' + MNEMONIC + ' + ' + TUTORIAL
             },
         pyatspi.ROLE_FRAME: {
-            'focused': 'labelAndName + roleName',
-            'unfocused': 'labelAndName + allTextSelection + roleName + unfocusedDialogCount + availability'
+            'focused': 'labelOrName + roleName',
+            'unfocused': 'labelOrName + allTextSelection + roleName + unfocusedDialogCount + availability'
             },
         pyatspi.ROLE_HEADING: {
+            'unfocused': 'displayedText + roleName + expandableState + availability + ' + MNEMONIC,
             'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
             'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC + ' + ' + TUTORIAL
             },
@@ -178,7 +180,7 @@ formatting = {
             'unfocused': 'labelAndName + unrelatedLabels'
             },
         pyatspi.ROLE_LABEL: {
-            'basicWhereAmI': 'labelAndName + allTextSelection + roleName'
+            'basicWhereAmI': 'labelOrName + allTextSelection + roleName'
             },
         pyatspi.ROLE_LAYERED_PANE: {
             'focused': 'labelAndName + allTextSelection + roleName + availability + noShowingChildren',
@@ -187,7 +189,7 @@ formatting = {
             'detailedWhereAmI': 'labelAndName + roleName + selectedItemCount + selectedItems'
             },
         pyatspi.ROLE_LINK: {
-            'unfocused': 'labelAndName + roleName + expandableState + availability + ' + MNEMONIC,
+            'unfocused': '(displayedText or name) + roleName + expandableState + availability + ' + MNEMONIC,
             'basicWhereAmI': 'linkInfo + siteDescription + fileSize + ' + MNEMONIC
             },
         pyatspi.ROLE_LIST: {
@@ -200,18 +202,18 @@ formatting = {
             },
         pyatspi.ROLE_LIST_ITEM: {
             'focused': 'expandableState + availability',
-            'unfocused': 'labelAndName + allTextSelection + expandableState + availability + positionInList 
+ childWidget',
+            'unfocused': 'label + displayedText + allTextSelection + expandableState + availability + 
positionInList + childWidget',
             'basicWhereAmI': 'label + roleName + name + positionInList + expandableState + (nodeLevel or 
nestingLevel)'
             },
         pyatspi.ROLE_MENU: {
-            'focused': 'labelAndName + roleName',
-            'unfocused': 'labelAndName + allTextSelection + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
-            'basicWhereAmI': '(ancestors or parentRoleName) + labelAndName + roleName +  positionInList + ' 
+ MNEMONIC
+            'focused': 'labelOrName + roleName',
+            'unfocused': 'labelOrName + allTextSelection + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
+            'basicWhereAmI': '(ancestors or parentRoleName) + labelOrName + roleName +  positionInList + ' + 
MNEMONIC
             },
         pyatspi.ROLE_MENU_ITEM: {
             'focused': 'expandableState',
-            'unfocused': 'labelAndName + menuItemCheckedState + expandableState + availability + ' + 
MNEMONIC + ' + accelerator + positionInList',
-            'basicWhereAmI': 'ancestors + labelAndName + accelerator + positionInList + ' + MNEMONIC
+            'unfocused': 'labelOrName + menuItemCheckedState + expandableState + availability + ' + MNEMONIC 
+ ' + accelerator + positionInList',
+            'basicWhereAmI': 'ancestors + labelOrName + accelerator + positionInList + ' + MNEMONIC
             },
         pyatspi.ROLE_NOTIFICATION: {
             'unfocused': 'roleName + unrelatedLabels'
@@ -223,9 +225,9 @@ formatting = {
             'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC
             },
         pyatspi.ROLE_PAGE_TAB: {
-            'focused': 'labelAndName + roleName + positionInList + ' + MNEMONIC + ' + accelerator',
-            'unfocused': 'labelAndName + roleName + positionInList + ' + MNEMONIC + ' + accelerator',
-            'basicWhereAmI': 'parentRoleName + labelAndName + roleName + positionInList + ' + MNEMONIC + ' + 
accelerator'
+            'focused': 'labelOrName + roleName + positionInList + ' + MNEMONIC + ' + accelerator',
+            'unfocused': 'labelOrName + roleName + positionInList + ' + MNEMONIC + ' + accelerator',
+            'basicWhereAmI': 'parentRoleName + labelOrName + roleName + positionInList + ' + MNEMONIC + ' + 
accelerator'
             },
         pyatspi.ROLE_PANEL: {
             'focused': 'labelAndName + roleName',
@@ -248,13 +250,13 @@ formatting = {
             },
         pyatspi.ROLE_PUSH_BUTTON: {
             'focused': 'expandableState',
-            'unfocused': 'labelAndName + expandableState + roleName + availability + ' + MNEMONIC + ' + 
accelerator',
-            'basicWhereAmI': 'labelAndName + expandableState + roleName + ' + MNEMONIC + ' + accelerator'
+            'unfocused': 'labelOrName + expandableState + roleName + availability + ' + MNEMONIC + ' + 
accelerator',
+            'basicWhereAmI': 'labelOrName + expandableState + roleName + ' + MNEMONIC + ' + accelerator'
             },
         pyatspi.ROLE_RADIO_BUTTON: {
             'focused': 'radioState',
-            'unfocused': 'labelAndName + radioState + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
-            'basicWhereAmI': 'radioButtonGroup + labelAndName + roleName + radioState + positionInGroup + ' 
+ MNEMONIC + ' + accelerator'
+            'unfocused': 'labelOrName + radioState + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
+            'basicWhereAmI': 'radioButtonGroup + labelOrName + roleName + radioState + positionInGroup + ' + 
MNEMONIC + ' + accelerator'
             },
         pyatspi.ROLE_RADIO_MENU_ITEM: {
             # OpenOffice check menu items currently have a role of "menu item"
@@ -264,9 +266,9 @@ formatting = {
             # menu item" that is currently unchecked and speak that state.
             # See Orca bug #433398 for more details.
             #
-            'focused': 'labelAndName + radioState + roleName + availability + positionInList',
-            'unfocused': 'labelAndName + radioState + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
-            'basicWhereAmI': 'ancestors + labelAndName + roleName + radioState + accelerator + 
positionInList + ' + MNEMONIC
+            'focused': 'labelOrName + radioState + roleName + availability + positionInList',
+            'unfocused': 'labelOrName + radioState + roleName + availability + ' + MNEMONIC + ' + 
accelerator + positionInList',
+            'basicWhereAmI': 'ancestors + labelOrName + roleName + radioState + accelerator + positionInList 
+ ' + MNEMONIC
             },
         pyatspi.ROLE_SCROLL_BAR: {
             'focused': 'value',
@@ -274,8 +276,8 @@ formatting = {
             'basicWhereAmI': 'labelOrName + roleName + value + percentage + ' + MNEMONIC + ' + accelerator + 
required'
             },
         pyatspi.ROLE_SECTION: {
-            'basicWhereAmI': 'label + readOnly + textRole + textContent + anyTextSelection + ' + MNEMONIC,
-            'detailedWhereAmI': 'label + readOnly + textRole + textContentWithAttributes + anyTextSelection 
+ ' + MNEMONIC + ' + ' + TUTORIAL
+            'focused': 'labelOrName + readOnly + textRole + currentLineText + allTextSelection',
+            'unfocused': 'labelOrName + readOnly + textRole + currentLineText + allTextSelection + ' + 
MNEMONIC,
             },
         pyatspi.ROLE_SLIDER: {
             'focused': 'value',
@@ -321,7 +323,7 @@ formatting = {
             },
         pyatspi.ROLE_TEAROFF_MENU_ITEM: {
             'focused': '[]',
-            'unfocused': 'labelAndName + allTextSelection + roleName + availability '
+            'unfocused': 'labelOrName + allTextSelection + roleName + availability '
             },
         pyatspi.ROLE_TERMINAL: {
             'focused': 'terminal',
@@ -337,8 +339,8 @@ formatting = {
             },
         pyatspi.ROLE_TOGGLE_BUTTON: {
             'focused': 'expandableState or toggleState',
-            'unfocused': 'labelAndName + roleName + (expandableState or toggleState) + availability + ' + 
MNEMONIC + ' + accelerator',
-            'basicWhereAmI': 'labelAndName + roleName + (expandableState or toggleState)'
+            'unfocused': 'labelOrName + roleName + (expandableState or toggleState) + availability + ' + 
MNEMONIC + ' + accelerator',
+            'basicWhereAmI': 'labelOrName + roleName + (expandableState or toggleState)'
             },
         pyatspi.ROLE_TOOL_TIP: {
             'unfocused': 'labelAndName',
@@ -489,22 +491,22 @@ formatting = {
             },
         pyatspi.ROLE_MENU: {
             'focused':   '[Component(obj,\
-                                     asString(labelAndName + roleName + availability) + 
asString(accelerator))]',
+                                     asString(labelOrName + roleName + availability) + 
asString(accelerator))]',
             'unfocused': '[Component(obj,\
-                                     asString(labelAndName + roleName))]',
+                                     asString(labelOrName + roleName))]',
             },
         #pyatspi.ROLE_MENU_BAR: 'default'
         pyatspi.ROLE_MENU_ITEM: {
             'unfocused': '[Component(obj,\
-                                     asString(labelAndName + expandableState + availability) + 
asString(accelerator),\
+                                     asString(labelOrName + expandableState + availability) + 
asString(accelerator),\
                                      indicator=asString(menuItemCheckedState))]'
             },
         #pyatspi.ROLE_OPTION_PANE: 'default'
         pyatspi.ROLE_PAGE_TAB: {
             'focused':   '[Component(obj,\
-                                     asString(labelAndName + roleName + availability) + 
asString(accelerator))]',
+                                     asString(labelOrName + roleName + availability) + 
asString(accelerator))]',
             'unfocused': '[Component(obj,\
-                                     asString(labelAndName + roleName))]'
+                                     asString(labelOrName + roleName))]'
             },
         #pyatspi.ROLE_PAGE_TAB_LIST: 'default'
         pyatspi.ROLE_PANEL: {
@@ -512,29 +514,26 @@ formatting = {
                                      asString(labelAndName + roleName))]\
                           + (childWidget and ([Region(" ")] + childWidget))'
             },
-        pyatspi.ROLE_PARAGRAPH: {
-            'unfocused': BRAILLE_TEXT
-            },
         pyatspi.ROLE_PASSWORD_TEXT: {
             'unfocused': BRAILLE_TEXT
             },
         #pyatspi.ROLE_PROGRESS_BAR: 'default'
         pyatspi.ROLE_PUSH_BUTTON: {
             'unfocused': '[Component(obj,\
-                                     asString((labelAndName or description) + expandableState + roleName))]'
+                                     asString((labelOrName or description) + expandableState + roleName))]'
             },
         pyatspi.ROLE_RADIO_BUTTON: {
             'unfocused': '[Component(obj,\
-                                     asString((labelAndName or description) + roleName),\
+                                     asString((labelOrName or description) + roleName),\
                                      indicator=asString(radioState))]'
             },
         pyatspi.ROLE_RADIO_MENU_ITEM: {
             'focused':   '[Component(obj,\
-                                     asString((labelAndName or description) + roleName + availability)\
+                                     asString((labelOrName or description) + roleName + availability)\
                                      + asString(accelerator),\
                                      indicator=asString(radioState))]',
             'unfocused': '[Component(obj,\
-                                     asString(labelAndName or description)\
+                                     asString(labelOrName or description)\
                                      + asString(accelerator),\
                                      indicator=asString(radioState))]'
             },
@@ -586,7 +585,7 @@ formatting = {
             },
         pyatspi.ROLE_TOGGLE_BUTTON: {
             'unfocused': '[Component(obj,\
-                                     asString((labelAndName or description) + expandableState + roleName),\
+                                     asString((labelOrName or description) + expandableState + roleName),\
                                      indicator=asString(toggleState))]'
             },
         #pyatspi.ROLE_TOOL_BAR: 'default'
@@ -604,13 +603,15 @@ if settings.useExperimentalSpeechProsody:
     formatting['speech'][pyatspi.ROLE_CANVAS]['detailedWhereAmI'] = \
         'parentRoleName + pause + labelAndName + pause + selectedItemCount + pause + selectedItems + pause'
     formatting['speech'][pyatspi.ROLE_CHECK_MENU_ITEM]['unfocused'] = \
-        'labelAndName + roleName + checkedState + required + availability + ' + MNEMONIC + ' + accelerator + 
pause + positionInList'
+        'labelOrName + roleName + checkedState + required + availability + ' + MNEMONIC + ' + accelerator + 
pause + positionInList'
     formatting['speech'][pyatspi.ROLE_CHECK_MENU_ITEM]['basicWhereAmI'] = \
-        'ancestors + pause + labelAndName + roleName + checkedState + pause + accelerator + pause + 
positionInList + ' + MNEMONIC
+        'ancestors + pause + labelOrName + roleName + checkedState + pause + accelerator + pause + 
positionInList + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_COMBO_BOX]['focused'] = 'expandableState'
     formatting['speech'][pyatspi.ROLE_COMBO_BOX]['unfocused'] = 'label + name + roleName + pause + 
positionInList + ' + MNEMONIC + ' + accelerator'
     formatting['speech'][pyatspi.ROLE_COMBO_BOX]['basicWhereAmI'] = \
         'label + roleName + pause + name + positionInList + ' + MNEMONIC + ' + accelerator'
+    formatting['speech'][pyatspi.ROLE_HEADING]['unfocused'] = \
+        'displayedText + roleName + expandableState + availability + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_HEADING]['basicWhereAmI'] = \
         'label + readOnly + textRole + pause + textContent + anyTextSelection + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_HEADING]['detailedWhereAmI'] = \
@@ -626,7 +627,7 @@ if settings.useExperimentalSpeechProsody:
     formatting['speech'][pyatspi.ROLE_LAYERED_PANE]['detailedWhereAmI'] = \
         'labelAndName + pause + roleName + pause + selectedItemCount + pause+ selectedItems + pause'
     formatting['speech'][pyatspi.ROLE_LINK]['unfocused'] = \
-        'labelAndName + roleName + pause + expandableState + availability + ' + MNEMONIC
+        '(displayedText or name) + roleName + pause + expandableState + availability + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_LINK]['basicWhereAmI'] = \
         'linkInfo + pause + siteDescription + pause + fileSize + pause + ' + MNEMONIC
     formatting['speech'][pyatspi.ROLE_LIST]['unfocused'] = \
@@ -634,23 +635,23 @@ if settings.useExperimentalSpeechProsody:
     formatting['speech'][pyatspi.ROLE_LIST_BOX]['unfocused'] = \
         'labelOrName + pause + focusedItem + pause + multiselectableState + numberOfChildren + pause'
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['unfocused'] = \
-        'labelAndName + allTextSelection + pause + expandableState + pause + availability + positionInList + 
pause + childWidget'
+        'label + displayedText + allTextSelection + pause + expandableState + pause + availability + 
positionInList + pause + childWidget'
     formatting['speech'][pyatspi.ROLE_LIST_ITEM]['basicWhereAmI'] = \
         'label + roleName + pause + name + pause + positionInList + pause + expandableState + (nodeLevel or 
nestingLevel) + pause'
-    formatting['speech'][pyatspi.ROLE_MENU]['unfocused'] = 'labelAndName + allTextSelection + roleName + 
availability + ' + MNEMONIC + ' + accelerator + pause + positionInList'
+    formatting['speech'][pyatspi.ROLE_MENU]['unfocused'] = 'labelOrName + allTextSelection + roleName + 
availability + ' + MNEMONIC + ' + accelerator + pause + positionInList'
     formatting['speech'][pyatspi.ROLE_MENU]['basicWhereAmI'] = \
-        '(ancestors or parentRoleName) + pause + labelAndName + roleName + pause +  positionInList + ' + 
MNEMONIC
-    formatting['speech'][pyatspi.ROLE_MENU_ITEM]['unfocused'] = 'labelAndName + menuItemCheckedState + 
expandableState + availability + ' + MNEMONIC + ' + accelerator + pause + positionInList'
+        '(ancestors or parentRoleName) + pause + labelOrName + roleName + pause +  positionInList + ' + 
MNEMONIC
+    formatting['speech'][pyatspi.ROLE_MENU_ITEM]['unfocused'] = 'labelOrName + menuItemCheckedState + 
expandableState + availability + ' + MNEMONIC + ' + accelerator + pause + positionInList'
     formatting['speech'][pyatspi.ROLE_MENU_ITEM]['basicWhereAmI'] = \
-        'ancestors + pause + labelAndName + pause + accelerator + pause + positionInList + ' + MNEMONIC
-    formatting['speech'][pyatspi.ROLE_PAGE_TAB]['focused'] = 'labelAndName + roleName + pause + 
positionInList + ' + MNEMONIC + ' + accelerator'
-    formatting['speech'][pyatspi.ROLE_PAGE_TAB]['unfocused'] = 'labelAndName + roleName + pause + 
positionInList + ' + MNEMONIC + ' + accelerator'
+        'ancestors + pause + labelOrName + pause + accelerator + pause + positionInList + ' + MNEMONIC
+    formatting['speech'][pyatspi.ROLE_PAGE_TAB]['focused'] = 'labelOrName + roleName + pause + 
positionInList + ' + MNEMONIC + ' + accelerator'
+    formatting['speech'][pyatspi.ROLE_PAGE_TAB]['unfocused'] = 'labelOrName + roleName + pause + 
positionInList + ' + MNEMONIC + ' + accelerator'
     formatting['speech'][pyatspi.ROLE_PAGE_TAB]['basicWhereAmI'] = \
-        'parentRoleName + pause + labelAndName + roleName + pause + positionInList + ' + MNEMONIC + ' + 
accelerator'
+        'parentRoleName + pause + labelOrName + roleName + pause + positionInList + ' + MNEMONIC + ' + 
accelerator'
     formatting['speech'][pyatspi.ROLE_RADIO_BUTTON]['unfocused'] = \
-        'labelAndName + pause + radioState + roleName + availability + lineBreak + ' + MNEMONIC + ' + 
accelerator + pause + positionInList + pause'
+        'labelOrName + pause + radioState + roleName + availability + lineBreak + ' + MNEMONIC + ' + 
accelerator + pause + positionInList + pause'
     formatting['speech'][pyatspi.ROLE_RADIO_BUTTON]['basicWhereAmI'] = \
-        'radioButtonGroup + pause + labelAndName + roleName + pause + radioState + pause + positionInGroup + 
' + MNEMONIC + ' + accelerator'
+        'radioButtonGroup + pause + labelOrName + roleName + pause + radioState + pause + positionInGroup + 
' + MNEMONIC + ' + accelerator'
     formatting['speech'][pyatspi.ROLE_TABLE]['focused'] = \
         'labelAndName + pause + table'
     formatting['speech'][pyatspi.ROLE_TABLE]['unfocused'] = \
diff --git a/src/orca/generator.py b/src/orca/generator.py
index 28acbe7..7a70ea0 100644
--- a/src/orca/generator.py
+++ b/src/orca/generator.py
@@ -1076,11 +1076,8 @@ class Generator:
         found.  Otherwise, an empty array is returned.
         """
         result = []
-        text = self._script.utilities.displayedText(
-            self._script.utilities.realActiveDescendant(obj))
-        if text:
-            result = [text]
-        return result
+        rad = self._script.utilities.realActiveDescendant(obj)
+        return self._generateDisplayedText(rad, **args)
 
     def _generateRealActiveDescendantRoleName(self, obj, **args ):
         """Objects, such as tables and trees, can represent individual cells
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c5c2663..e2b88a8 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -802,6 +802,8 @@ class Utilities:
                 layoutOnly = True
             elif obj.parent.getRole() == pyatspi.ROLE_TABLE:
                 layoutOnly = self.isLayoutOnly(obj.parent)
+        elif role == pyatspi.ROLE_SECTION:
+            layoutOnly = True
         elif role == pyatspi.ROLE_FILLER:
             layoutOnly = True
         elif role == pyatspi.ROLE_SCROLL_PANE:
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index 0b1c003..1af6928 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -47,13 +47,10 @@ formatting = {
             'detailedWhereAmI' : 'pageSummary'
             },
         pyatspi.ROLE_ALERT: {
-            'unfocused': 'expandedEOCs or (labelAndName + unrelatedLabels)'
+            'unfocused': 'expandedEOCs or (labelOrName + unrelatedLabels)'
             },
         pyatspi.ROLE_DIALOG: {
-            'unfocused': 'expandedEOCs or (labelAndName + unrelatedLabels)'
-            },
-        pyatspi.ROLE_DOCUMENT_FRAME: {
-            'unfocused': 'name + roleName'
+            'unfocused': 'expandedEOCs or (labelOrName + unrelatedLabels)'
             },
         # [[[TODO: JD - We should decide if we want to provide
         # information about the table dimensions, whether or not
diff --git a/src/orca/scripts/toolkits/Gecko/speech_generator.py 
b/src/orca/scripts/toolkits/Gecko/speech_generator.py
index 0c9c9b3..a6a3ff5 100644
--- a/src/orca/scripts/toolkits/Gecko/speech_generator.py
+++ b/src/orca/scripts/toolkits/Gecko/speech_generator.py
@@ -140,6 +140,7 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         # We'll attempt to infer the label under some circumstances.
         #
         if not len(result) \
+           and not obj.name \
            and role in [pyatspi.ROLE_CHECK_BOX,
                         pyatspi.ROLE_COMBO_BOX,
                         pyatspi.ROLE_ENTRY,
@@ -172,24 +173,6 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
 
         return result
 
-    def _generateLabelAndName(self, obj, **args):
-        result = []
-        role = args.get('role', obj.getRole())
-        # For radio buttons, the label is handled as a context and we
-        # assume we don't have to guess it.  If we need to guess it,
-        # we need to add it to utterances.
-        #
-        if role == pyatspi.ROLE_RADIO_BUTTON \
-           and self._script.utilities.displayedLabel(obj):
-            result.extend(
-                speech_generator.SpeechGenerator._generateName(
-                    self, obj, **args))
-        else:
-            result.extend(
-                speech_generator.SpeechGenerator._generateLabelAndName(
-                    self, obj, **args))
-        return result
-
     def _generateLabelOrName(self, obj, **args):
         role = args.get('role', obj.getRole())
         if role == pyatspi.ROLE_TEXT:
diff --git a/test/keystrokes/firefox/aria_button_dojo.py b/test/keystrokes/firefox/aria_button_dojo.py
index bf65a08..66c7b9f 100644
--- a/test/keystrokes/firefox/aria_button_dojo.py
+++ b/test/keystrokes/firefox/aria_button_dojo.py
@@ -140,7 +140,7 @@ sequence.append(utils.AssertPresentationAction(
      "BRAILLE LINE:  'Cut'",
      "     VISIBLE:  'Cut', cursor=1",
      "SPEECH OUTPUT: 'Edit! edit title panel'",
-     "SPEECH OUTPUT: 'Edit! Edit! edit title menu'",
+     "SPEECH OUTPUT: 'Edit! menu'",
      "SPEECH OUTPUT: 'Cut'",
      "SPEECH OUTPUT: 'Focus mode' voice=system"]))
 
@@ -214,7 +214,7 @@ sequence.append(utils.AssertPresentationAction(
      "BRAILLE LINE:  'Submenu menu'",
      "     VISIBLE:  'Submenu menu', cursor=1",
      "SPEECH OUTPUT: 'Edit! edit title panel'",
-     "SPEECH OUTPUT: 'Edit! Edit! edit title menu'",
+     "SPEECH OUTPUT: 'Edit! menu'",
      "SPEECH OUTPUT: 'Submenu menu'"]))
 
 sequence.append(utils.StartRecordingAction())
@@ -288,24 +288,24 @@ sequence.append(KeyComboAction("space"))
 sequence.append(utils.AssertPresentationAction(
     "28. Toggle the state of the toggle me off button",
     ["KNOWN ISSUE: This seems an excessive amount of braille updating",
-     "BRAILLE LINE:  '& y toggle me on Toggle me off toggle button Toggle me off Toggle me'",
-     "     VISIBLE:  '& y toggle me on Toggle me off t', cursor=1",
-     "BRAILLE LINE:  '& y toggle me on Toggle me off toggle button toggle me on Toggle me'",
-     "     VISIBLE:  '& y toggle me on Toggle me off t', cursor=1",
-     "BRAILLE LINE:  '& y toggle me on Toggle me off toggle button toggle me on Toggle me'",
-     "     VISIBLE:  '& y toggle me on Toggle me off t', cursor=1",
+     "BRAILLE LINE:  '& y toggle me on toggle button Toggle me off Toggle me'",
+     "     VISIBLE:  '& y toggle me on toggle button T', cursor=1",
+     "BRAILLE LINE:  '& y toggle me on toggle button toggle me on Toggle me'",
+     "     VISIBLE:  '& y toggle me on toggle button t', cursor=1",
+     "BRAILLE LINE:  '& y toggle me on toggle button toggle me on Toggle me'",
+     "     VISIBLE:  '& y toggle me on toggle button t', cursor=1",
      "SPEECH OUTPUT: 'not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("space"))
 sequence.append(utils.AssertPresentationAction(
     "29. Toggle the state of the toggle me off button",
-    ["BRAILLE LINE:  '&=y toggle me off Toggle me off toggle button toggle me on Toggle me'",
-     "     VISIBLE:  '&=y toggle me off Toggle me off ', cursor=1",
-     "BRAILLE LINE:  '&=y toggle me off Toggle me off toggle button toggle me off Toggle me'",
-     "     VISIBLE:  '&=y toggle me off Toggle me off ', cursor=1",
-     "BRAILLE LINE:  '&=y toggle me off Toggle me off toggle button toggle me off Toggle me'",
-     "     VISIBLE:  '&=y toggle me off Toggle me off ', cursor=1",
+    ["BRAILLE LINE:  '&=y toggle me off toggle button toggle me on Toggle me'",
+     "     VISIBLE:  '&=y toggle me off toggle button ', cursor=1",
+     "BRAILLE LINE:  '&=y toggle me off toggle button toggle me off Toggle me'",
+     "     VISIBLE:  '&=y toggle me off toggle button ', cursor=1",
+     "BRAILLE LINE:  '&=y toggle me off toggle button toggle me off Toggle me'",
+     "     VISIBLE:  '&=y toggle me off toggle button ', cursor=1",
      "SPEECH OUTPUT: 'pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
diff --git a/test/keystrokes/firefox/aria_button_uiuc.py b/test/keystrokes/firefox/aria_button_uiuc.py
index b4d0655..907bca6 100644
--- a/test/keystrokes/firefox/aria_button_uiuc.py
+++ b/test/keystrokes/firefox/aria_button_uiuc.py
@@ -15,30 +15,30 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(utils.AssertPresentationAction(
     "1. Tab to first button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Font Larger + toggle button ', cursor=1",
-     "BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Font Larger + toggle button ', cursor=1",
-     "SPEECH OUTPUT: 'Font Larger + toggle button not pressed'"]))
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Font Larger toggle button & ', cursor=1",
+     "BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Font Larger toggle button & ', cursor=1",
+     "SPEECH OUTPUT: 'Font Larger toggle button not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("KP_Enter"))
 sequence.append(utils.AssertPresentationAction(
     "2. Basic whereamI",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Font Larger + toggle button ', cursor=1",
-     "SPEECH OUTPUT: 'Font Larger +'",
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Font Larger toggle button & ', cursor=1",
+     "SPEECH OUTPUT: 'Font Larger'",
      "SPEECH OUTPUT: 'toggle button not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(utils.AssertPresentationAction(
     "3. Tab to second button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Font Smaller - toggle button', cursor=1",
-     "BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Font Smaller - toggle button', cursor=1",
-     "SPEECH OUTPUT: 'Font Smaller - toggle button not pressed'"]))
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Font Smaller toggle button &', cursor=1",
+     "BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Font Smaller toggle button &', cursor=1",
+     "SPEECH OUTPUT: 'Font Smaller toggle button not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction(" "))
@@ -51,44 +51,44 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(utils.AssertPresentationAction(
     "5. Tab to third button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '&=y Italic i toggle button & y B', cursor=1",
-     "BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button &=y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '&=y Italic i toggle button & y B', cursor=1",
-     "SPEECH OUTPUT: 'Italic i toggle button pressed'"]))
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '&=y Italic toggle button & y Bol', cursor=1",
+     "BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button &=y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '&=y Italic toggle button & y Bol', cursor=1",
+     "SPEECH OUTPUT: 'Italic toggle button pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction(" "))
 sequence.append(utils.AssertPresentationAction(
     "6. Push third button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button & y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Italic i toggle button & y B', cursor=1",
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button & y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Italic toggle button & y Bol', cursor=1",
      "SPEECH OUTPUT: 'not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(utils.AssertPresentationAction(
     "7. Tab to fourth button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button & y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Bold B toggle button', cursor=1",
-     "BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button & y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Bold B toggle button', cursor=1",
-     "SPEECH OUTPUT: 'Bold B toggle button not pressed'"]))
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button & y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Bold toggle button', cursor=1",
+     "BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button & y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Bold toggle button', cursor=1",
+     "SPEECH OUTPUT: 'Bold toggle button not pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction(" "))
 sequence.append(utils.AssertPresentationAction(
     "8. Push fourth button",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button & y Italic i toggle 
button &=y Bold B toggle button'",
-     "     VISIBLE:  '&=y Bold B toggle button', cursor=1",
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button & y Italic toggle button 
&=y Bold toggle button'",
+     "     VISIBLE:  '&=y Bold toggle button', cursor=1",
      "SPEECH OUTPUT: 'pressed'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction(" "))
 sequence.append(utils.AssertPresentationAction(
     "9. Push fourth button again",
-    ["BRAILLE LINE:  '& y Font Larger + toggle button & y Font Smaller - toggle button & y Italic i toggle 
button & y Bold B toggle button'",
-     "     VISIBLE:  '& y Bold B toggle button', cursor=1",
+    ["BRAILLE LINE:  '& y Font Larger toggle button & y Font Smaller toggle button & y Italic toggle button 
& y Bold toggle button'",
+     "     VISIBLE:  '& y Bold toggle button', cursor=1",
      "SPEECH OUTPUT: 'not pressed'"]))
 
 sequence.append(utils.AssertionSummaryAction())
diff --git a/test/keystrokes/firefox/aria_radio_button_uiuc.py 
b/test/keystrokes/firefox/aria_radio_button_uiuc.py
index 1d1c2bd..2c7e9ba 100644
--- a/test/keystrokes/firefox/aria_radio_button_uiuc.py
+++ b/test/keystrokes/firefox/aria_radio_button_uiuc.py
@@ -16,22 +16,20 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Tab"))
 sequence.append(utils.AssertPresentationAction(
     "1. Tab to first radio button",
-    ["KNOWN ISSUE: We should not be speaking 'Jimmy Johns'",
-     "BRAILLE LINE:  '&=y Radio Maria radio button'",
+    ["BRAILLE LINE:  '&=y Radio Maria radio button'",
      "     VISIBLE:  '&=y Radio Maria radio button', cursor=1",
      "BRAILLE LINE:  '&=y Radio Maria radio button'",
      "     VISIBLE:  '&=y Radio Maria radio button', cursor=1",
      "SPEECH OUTPUT: 'Lunch Options panel'",
-     "SPEECH OUTPUT: 'Jimmy Johns Radio Maria selected radio button'"]))
+     "SPEECH OUTPUT: 'Radio Maria selected radio button'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("KP_Enter"))
 sequence.append(utils.AssertPresentationAction(
     "2. Basic whereamI",
-    ["KNOWN ISSUE: We should not be speaking 'Jimmy Johns'",
-     "BRAILLE LINE:  '&=y Radio Maria radio button'",
+    ["BRAILLE LINE:  '&=y Radio Maria radio button'",
      "     VISIBLE:  '&=y Radio Maria radio button', cursor=1",
-     "SPEECH OUTPUT: 'Lunch Options Jimmy Johns Radio Maria'",
+     "SPEECH OUTPUT: 'Lunch Options Radio Maria'",
      "SPEECH OUTPUT: 'radio button selected'"]))
 
 sequence.append(utils.StartRecordingAction())
@@ -49,10 +47,9 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("KP_Enter"))
 sequence.append(utils.AssertPresentationAction(
     "4. Basic whereamI",
-    ["KNOWN ISSUE: We should not be speaking 'Radio Maria'",
-     "BRAILLE LINE:  '&=y Rainbow Gardens radio button'",
+    ["BRAILLE LINE:  '&=y Rainbow Gardens radio button'",
      "     VISIBLE:  '&=y Rainbow Gardens radio button', cursor=1",
-     "SPEECH OUTPUT: 'Lunch Options Radio Maria Rainbow Gardens'",
+     "SPEECH OUTPUT: 'Lunch Options Rainbow Gardens'",
      "SPEECH OUTPUT: 'radio button selected'"]))
 
 sequence.append(utils.StartRecordingAction())
diff --git a/test/keystrokes/firefox/aria_treegrid.py b/test/keystrokes/firefox/aria_treegrid.py
index a0f23f6..23a89f9 100644
--- a/test/keystrokes/firefox/aria_treegrid.py
+++ b/test/keystrokes/firefox/aria_treegrid.py
@@ -66,7 +66,8 @@ sequence.append(utils.AssertPresentationAction(
     "6. basic whereAmI",
     ["BRAILLE LINE:  '+A Question of Love table cell'",
      "     VISIBLE:  '+A Question of Love table cell', cursor=1",
-     "SPEECH OUTPUT: 'table row +A Question of Love'"]))
+     "SPEECH OUTPUT: 'table row'",
+     "SPEECH OUTPUT: '+A Question of Love'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(TypeAction(" "))
@@ -84,7 +85,8 @@ sequence.append(utils.AssertPresentationAction(
     "8. basic whereAmI",
     ["BRAILLE LINE:  '-A Question of Love table cell'",
      "     VISIBLE:  '-A Question of Love table cell', cursor=1",
-     "SPEECH OUTPUT: 'table row -A Question of Love'"]))
+     "SPEECH OUTPUT: 'table row'",
+     "SPEECH OUTPUT: '-A Question of Love'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Down"))



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