[orca] Move ARIA landmark types out of settings and into script utilities
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Move ARIA landmark types out of settings and into script utilities
- Date: Thu, 19 Nov 2015 00:24:05 +0000 (UTC)
commit 00a87058381be77a8e8350d656dc4fba7c6c2a3c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Nov 18 19:13:29 2015 -0500
Move ARIA landmark types out of settings and into script utilities
ARIA landmarks are not a setting; they are dictated by the W3C ARIA spec.
src/orca/script_utilities.py | 13 +++++++++++++
src/orca/scripts/web/script_utilities.py | 2 +-
src/orca/settings.py | 10 ----------
src/orca/structural_navigation.py | 16 +++-------------
4 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 7e1c41a..a1f633f 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -620,6 +620,9 @@ class Utilities:
def isHidden(self, obj):
return False
+ def isLandmark(self, obj):
+ return False
+
def speakMathSymbolNames(self, obj=None):
return False
@@ -728,6 +731,16 @@ class Utilities:
def getMathNestingLevel(self, obj, test=None):
return 0
+ def getLandmarkTypes(self):
+ return ["banner",
+ "complementary",
+ "contentinfo",
+ "form",
+ "main",
+ "navigation",
+ "region",
+ "search"]
+
def isStatic(self, obj):
role = obj.getRole()
try:
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index b1faadf..3ffbcc5 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2011,7 +2011,7 @@ class Utilities(script_utilities.Utilities):
attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
except:
attrs = {}
- rv = attrs.get('xml-roles') in settings.ariaLandmarks
+ rv = attrs.get('xml-roles') in self.getLandmarkTypes()
self._isLandmark[hash(obj)] = rv
return rv
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 83501ed..46db573 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -272,16 +272,6 @@ skipBlankCells = False
largeObjectTextLength = 75
wrappedStructuralNavigation = True
inferLiveRegions = True
-ariaLandmarks = [
- "banner",
- "complementary",
- "contentinfo",
- "form",
- "main",
- "navigation",
- "region",
- "search",
-]
# Chat
chatMessageVerbosity = CHAT_SPEAK_ALL
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index fa1b27f..cee5280 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -2141,7 +2141,8 @@ class StructuralNavigation:
# into for the landmark roles.
#
attrs = []
- for landmark in settings.ariaLandmarks:
+ landmarkTypes = self._script.utilities.getLandmarkTypes()
+ for landmark in landmarkTypes:
attrs.append('xml-roles:' + landmark)
return MatchCriteria(collection, objAttrs=attrs)
@@ -2156,18 +2157,7 @@ class StructuralNavigation:
the criteria (e.g. the level of a heading).
"""
- if obj is None:
- return False
-
- attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
- try:
- if set(attrs['xml-roles']).intersection(\
- set(settings.ariaLandmarks)):
- return True
- else:
- return False
- except KeyError:
- return False
+ return self._script.utilities.isLandmark(obj)
def _landmarkPresentation(self, obj, arg=None):
"""Presents the landmark or indicates that one was not found.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]