[orca] Remove some more special handling of ARIA widgets
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Remove some more special handling of ARIA widgets
- Date: Fri, 8 Aug 2014 15:13:53 +0000 (UTC)
commit ecc7f54de4e208f3f077a43587668a69f3ba1dcc
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Aug 8 11:12:59 2014 -0400
Remove some more special handling of ARIA widgets
Widgets are widgets whether they are ARIA or not.
src/orca/scripts/toolkits/Gecko/formatting.py | 73 -------------------------
src/orca/scripts/toolkits/Gecko/script.py | 73 +++++--------------------
2 files changed, 13 insertions(+), 133 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/formatting.py b/src/orca/scripts/toolkits/Gecko/formatting.py
index d800e26..a99e597 100644
--- a/src/orca/scripts/toolkits/Gecko/formatting.py
+++ b/src/orca/scripts/toolkits/Gecko/formatting.py
@@ -26,21 +26,12 @@ __copyright__ = "Copyright (c) 2005-2009 Sun Microsystems Inc."
__license__ = "LGPL"
import copy
-
import pyatspi
import orca.formatting
-import orca.settings
# pylint: disable-msg=C0301
-########################################################################
-# #
-# Formatting for things that are not ARIA widgets. For things that #
-# are ARIA widgets, we use the default formatting (see the #
-# getFormat method). #
-# #
-########################################################################
formatting = {
'speech': {
'suffix': {
@@ -74,58 +65,6 @@ formatting = {
'unfocused': '[]'
},
},
- 'braille': {
- # [[[TODO: WDW - we're doing very little here. The goal for
- # autocomplete boxes at the moment is that their children (e.g.,
- # a text area, a menu, etc., do all the interactive work and
- # the autocomplete acts as more of a container.]]]
- #
- pyatspi.ROLE_AUTOCOMPLETE: {
- 'unfocused': '[Component(obj, asString(roleName))]'
- },
- pyatspi.ROLE_CHECK_BOX: {
- 'unfocused': '[Component(obj,\
- asString((not inDocumentContent\
- and (label + displayedText)\
- or (label and [""] or name))\
- + roleName),\
- indicator=asString(checkedState))]'
- },
- pyatspi.ROLE_COMBO_BOX: {
- 'unfocused': '[Component(obj,\
- asString(label + name + roleName),\
- asString(label) and (len(asString(label)) + 1) or 0)]'
- },
- pyatspi.ROLE_IMAGE: {
- 'unfocused': '(imageLink\
- and [Link(obj, (asString(label + displayedText)\
- or asString(name))\
- + " " + asString(value + roleName))]\
- or [Component(obj,\
- asString(label + displayedText + value + roleName))])'
- },
- # [[[TODO: WDW - yikes! We need more parameters to send to
- # the Link constructor.]]]
- #
- pyatspi.ROLE_LINK: {
- 'unfocused': '[Link(obj, asString(currentLineText)\
- or asString(displayedText)\
- or asString(name))]',
- },
- # If we're in document content, we present the indicator followed
- # immediately by the role, followed by the label/displayed text,
- # etc. The label/displayed text is obtained as part of the line
- # contents, therefore we do not want to include it here.
- #
- pyatspi.ROLE_RADIO_BUTTON: {
- 'unfocused': '[Component(obj,\
- asString((not inDocumentContent\
- and ((label + displayedText) or description)\
- or [""])\
- + roleName),\
- indicator=asString(radioState))]'
- }
- }
}
class Formatting(orca.formatting.Formatting):
@@ -135,15 +74,3 @@ class Formatting(orca.formatting.Formatting):
def __init__(self, script):
orca.formatting.Formatting.__init__(self, script)
self.update(copy.deepcopy(formatting))
- # This is a copy of the default formatting, which we will
- # use for ARIA widgets.
- #
- self._defaultFormatting = orca.formatting.Formatting(script)
-
- def getFormat(self, **args):
- # ARIA widgets get treated like regular default widgets.
- #
- if args.get('useDefaultFormatting', False):
- return self._defaultFormatting.getFormat(**args)
- else:
- return orca.formatting.Formatting.getFormat(self, **args)
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 8d2834b..fa3da4b 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -846,7 +846,7 @@ class Script(default.Script):
if contextObj and contextObj.parent == firstObj:
return
- if self.isAriaWidget(obj) or not self.inDocumentContent(obj):
+ if not self.inDocumentContent(obj):
default.Script.onCaretMoved(self, event)
return
@@ -944,8 +944,6 @@ class Script(default.Script):
return
if role != pyatspi.ROLE_DOCUMENT_FRAME:
return
- if self.isAriaWidget(obj.parent):
- return
try:
focusRole = orca_state.locusOfFocus.getRole()
@@ -1037,7 +1035,7 @@ class Script(default.Script):
return
if childRole == pyatspi.ROLE_DIALOG:
- if self.isAriaWidget(event.source):
+ if self.inDocumentContent(event.source):
orca.setLocusOfFocus(event, child)
return
@@ -1135,7 +1133,7 @@ class Script(default.Script):
return
obj = event.source
- if self.isAriaWidget(obj) or not self.inDocumentContent(obj):
+ if not self.inDocumentContent(obj):
default.Script.onFocusedChanged(self, event)
return
@@ -1362,13 +1360,18 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, "BRAILLE: update disabled")
return
- if self.isAriaWidget(obj) or not self.inDocumentContent():
+ if not self.inDocumentContent():
default.Script.updateBraille(self, obj, extraRegion)
return
if not obj:
return
+ if obj.getState().contains(pyatspi.STATE_FOCUSED) \
+ and obj.getRole() not in [pyatspi.ROLE_LINK, pyatspi.ROLE_ALERT]:
+ default.Script.updateBraille(self, obj, extraRegion)
+ return
+
line = self.getNewBrailleLine(clearBraille=True, addLine=True)
# Some text areas have a character offset of -1 when you tab
@@ -1394,15 +1397,6 @@ class Script(default.Script):
lineContentsOffset = max(0, focusedCharacterOffset - 1)
needToRefresh = True
- # Sometimes we just want to present the current object rather
- # than the full line. For instance, if we're on a slider we
- # should just present that slider. We'll assume we want the
- # full line, however.
- #
- presentOnlyFocusedObj = False
- if focusedObj and focusedObj.getRole() == pyatspi.ROLE_SLIDER:
- presentOnlyFocusedObj = True
-
contents = self.currentLineContents
index = self.findObjectOnLine(focusedObj,
max(0, lineContentsOffset),
@@ -1426,13 +1420,12 @@ class Script(default.Script):
[obj, startOffset, endOffset, string] = content
if not obj:
continue
- elif presentOnlyFocusedObj and not isFocusedObj:
- continue
role = obj.getRole()
if (not len(string) and role != pyatspi.ROLE_PARAGRAPH) \
or self.utilities.isEntry(obj) \
or self.utilities.isPasswordText(obj) \
+ or obj.name \
or role in [pyatspi.ROLE_LINK, pyatspi.ROLE_PUSH_BUTTON]:
[regions, fRegion] = \
self.brailleGenerator.generateBraille(obj)
@@ -1648,7 +1641,6 @@ class Script(default.Script):
entire document.
"""
if self.flatReviewContext \
- or self.isAriaWidget(orca_state.locusOfFocus) \
or not self.inDocumentContent() \
or not self.isBrailleBeginningShowing():
default.Script.panBrailleLeft(self, inputEvent, panAmount)
@@ -1664,7 +1656,6 @@ class Script(default.Script):
entire document.
"""
if self.flatReviewContext \
- or self.isAriaWidget(orca_state.locusOfFocus) \
or not self.inDocumentContent() \
or not self.isBrailleEndShowing():
default.Script.panBrailleRight(self, inputEvent, panAmount)
@@ -1866,41 +1857,6 @@ class Script(default.Script):
return False
- def isAriaWidget(self, obj=None):
- """Returns True if the object being examined is an ARIA widget.
-
- Arguments:
- - obj: The accessible object of interest. If None, the
- locusOfFocus is examined.
- """
- try:
- return self.generatorCache['isAria'][obj]
- except:
- pass
- obj = obj or orca_state.locusOfFocus
-
- # TODO - JD: It seems insufficient to take a "if it's ARIA, use
- # the default script" approach. For instance, an ARIA dialog does
- # not have "unrelated labels"; it has embedded object characters
- # just like other Gecko content. Unless and until Gecko exposes
- # ARIA widgets as proper widgets, we'll need to not be so trusting.
- # For now, just add hacks on a per-case basis until there is time
- # to properly review this code.
- try:
- role = obj.getRole()
- except:
- pass
- else:
- if role in [pyatspi.ROLE_DIALOG, pyatspi.ROLE_ALERT]:
- return False
-
- attrs = self._getAttrDictionary(obj)
- if 'isAria' not in self.generatorCache:
- self.generatorCache['isAria'] = {}
- self.generatorCache['isAria'][obj] = \
- ('xml-roles' in attrs and 'live' not in attrs)
- return self.generatorCache['isAria'][obj]
-
def _getAttrDictionary(self, obj):
if not obj:
return {}
@@ -2752,8 +2708,7 @@ class Script(default.Script):
return previousObj.parent.parent
elif role == pyatspi.ROLE_LIST_ITEM:
parent = previousObj.parent
- if parent.getState().contains(pyatspi.STATE_FOCUSABLE) \
- and not self.isAriaWidget(parent):
+ if parent.getState().contains(pyatspi.STATE_FOCUSABLE):
return parent
while previousObj.childCount:
@@ -2762,8 +2717,7 @@ class Script(default.Script):
if role in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_LIST_BOX, pyatspi.ROLE_MENU]:
break
elif role == pyatspi.ROLE_LIST \
- and state.contains(pyatspi.STATE_FOCUSABLE) \
- and not self.isAriaWidget(previousObj):
+ and state.contains(pyatspi.STATE_FOCUSABLE):
break
elif previousObj.childCount > 1000:
break
@@ -2819,8 +2773,7 @@ class Script(default.Script):
if role in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_LIST_BOX, pyatspi.ROLE_MENU]:
descend = False
elif role == pyatspi.ROLE_LIST \
- and obj.getState().contains(pyatspi.STATE_FOCUSABLE) \
- and not self.isAriaWidget(obj):
+ and obj.getState().contains(pyatspi.STATE_FOCUSABLE):
descend = False
elif obj.childCount > 1000:
descend = False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]