summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorklink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 22:29:28 +0000
committerklink@chromium.org <klink@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 22:29:28 +0000
commitb45243c422ce9eddf818d25777fea0f7e7f94e85 (patch)
treece75b7f20e3718fea6f04d619099c53c7901ab55 /webkit
parenta24cb443103a83d16744b74808226aec6ff57aef (diff)
downloadchromium_src-b45243c422ce9eddf818d25777fea0f7e7f94e85.zip
chromium_src-b45243c422ce9eddf818d25777fea0f7e7f94e85.tar.gz
chromium_src-b45243c422ce9eddf818d25777fea0f7e7f94e85.tar.bz2
Adds support for an initial set of WAI-ARIA roles, needed to support screen readers in AJAX web applications (e.g. Gmail).
BUG=None TEST=None Review URL: http://codereview.chromium.org/149265 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/glue_accessibility_object.cc109
-rw-r--r--webkit/glue/webaccessibility.h65
2 files changed, 100 insertions, 74 deletions
diff --git a/webkit/glue/glue_accessibility_object.cc b/webkit/glue/glue_accessibility_object.cc
index 8c056eb..4e20ab8 100644
--- a/webkit/glue/glue_accessibility_object.cc
+++ b/webkit/glue/glue_accessibility_object.cc
@@ -294,44 +294,44 @@ bool GlueAccessibilityObject::State(int child_id, long* state) {
if (!GetAccessibilityObjectForChild(child_id, child_obj))
return false;
- if (child_obj->isAnchor())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_LINKED);
+ if (child_obj->isChecked())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_CHECKED);
+
+ if (child_obj->canSetFocusAttribute())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_FOCUSABLE);
+
+ if (child_obj->isFocused())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_FOCUSED);
if (child_obj->isHovered())
*state |= static_cast<long>(1 << WebAccessibility::STATE_HOTTRACKED);
- if (!child_obj->isEnabled())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_UNAVAILABLE);
-
- if (child_obj->isReadOnly())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_READONLY);
+ if (child_obj->isIndeterminate())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_INDETERMINATE);
- if (child_obj->isOffScreen())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_OFFSCREEN);
+ if (child_obj->isAnchor())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_LINKED);
if (child_obj->isMultiSelect())
*state |= static_cast<long>(1 << WebAccessibility::STATE_MULTISELECTABLE);
- if (child_obj->isPasswordField())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_PROTECTED);
-
- if (child_obj->isIndeterminate())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_INDETERMINATE);
-
- if (child_obj->isChecked())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_CHECKED);
+ if (child_obj->isOffScreen())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_OFFSCREEN);
if (child_obj->isPressed())
*state |= static_cast<long>(1 << WebAccessibility::STATE_PRESSED);
- if (child_obj->isFocused())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_FOCUSED);
+ if (child_obj->isPasswordField())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_PROTECTED);
+
+ if (child_obj->isReadOnly())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_READONLY);
if (child_obj->isVisited())
*state |= static_cast<long>(1 << WebAccessibility::STATE_TRAVERSED);
- if (child_obj->canSetFocusAttribute())
- *state |= static_cast<long>(1 << WebAccessibility::STATE_FOCUSABLE);
+ if (!child_obj->isEnabled())
+ *state |= static_cast<long>(1 << WebAccessibility::STATE_UNAVAILABLE);
// TODO(klink): Add selected and selectable states.
@@ -361,43 +361,60 @@ String GlueAccessibilityObject::description() const {
}
// Provides a conversion between the WebCore::AccessibilityRole and a
-// role supported on the Browser side. Static function.
+// role supported on the Browser side. Listed alphabetically by the
+// WebAccessibility role (except for default role). Static function.
static WebAccessibility::Role SupportedRole(WebCore::AccessibilityRole role) {
switch (role) {
- case WebCore::ButtonRole:
- return WebAccessibility::ROLE_PUSHBUTTON;
- case WebCore::RadioButtonRole:
- return WebAccessibility::ROLE_RADIOBUTTON;
+ case WebCore::CellRole:
+ return WebAccessibility::ROLE_CELL;
case WebCore::CheckBoxRole:
return WebAccessibility::ROLE_CHECKBUTTON;
- case WebCore::SliderRole:
- return WebAccessibility::ROLE_SLIDER;
- case WebCore::TabGroupRole:
- return WebAccessibility::ROLE_PAGETABLIST;
- case WebCore::TextFieldRole:
- case WebCore::TextAreaRole:
- case WebCore::ListMarkerRole:
- return WebAccessibility::ROLE_TEXT;
- case WebCore::StaticTextRole:
- return WebAccessibility::ROLE_STATICTEXT;
- case WebCore::OutlineRole:
- return WebAccessibility::ROLE_OUTLINE;
case WebCore::ColumnRole:
return WebAccessibility::ROLE_COLUMN;
- case WebCore::RowRole:
- return WebAccessibility::ROLE_ROW;
+ case WebCore::ColumnHeaderRole:
+ return WebAccessibility::ROLE_COLUMNHEADER;
+ case WebCore::ImageMapRole:
+ case WebCore::ImageRole:
+ return WebAccessibility::ROLE_GRAPHIC;
case WebCore::GroupRole:
return WebAccessibility::ROLE_GROUPING;
+ case WebCore::LinkRole:
+ case WebCore::WebCoreLinkRole:
+ return WebAccessibility::ROLE_LINK;
case WebCore::ListRole:
return WebAccessibility::ROLE_LIST;
+ case WebCore::ListBoxRole:
+ return WebAccessibility::ROLE_LISTBOX;
+ case WebCore::MenuButtonRole:
+ case WebCore::MenuItemRole:
+ return WebAccessibility::ROLE_MENUITEM;
+ case WebCore::MenuRole:
+ return WebAccessibility::ROLE_MENUPOPUP;
+ case WebCore::OutlineRole:
+ return WebAccessibility::ROLE_OUTLINE;
+ case WebCore::TabGroupRole:
+ return WebAccessibility::ROLE_PAGETABLIST;
+ case WebCore::ProgressIndicatorRole:
+ return WebAccessibility::ROLE_PROGRESSBAR;
+ case WebCore::ButtonRole:
+ return WebAccessibility::ROLE_PUSHBUTTON;
+ case WebCore::RadioButtonRole:
+ return WebAccessibility::ROLE_RADIOBUTTON;
+ case WebCore::RowRole:
+ return WebAccessibility::ROLE_ROW;
+ case WebCore::RowHeaderRole:
+ return WebAccessibility::ROLE_ROWHEADER;
+ case WebCore::SliderRole:
+ return WebAccessibility::ROLE_SLIDER;
+ case WebCore::StaticTextRole:
+ return WebAccessibility::ROLE_STATICTEXT;
case WebCore::TableRole:
return WebAccessibility::ROLE_TABLE;
- case WebCore::LinkRole:
- case WebCore::WebCoreLinkRole:
- return WebAccessibility::ROLE_LINK;
- case WebCore::ImageMapRole:
- case WebCore::ImageRole:
- return WebAccessibility::ROLE_GRAPHIC;
+ case WebCore::ListMarkerRole:
+ case WebCore::TextFieldRole:
+ case WebCore::TextAreaRole:
+ return WebAccessibility::ROLE_TEXT;
+ case WebCore::UnknownRole:
default:
// This is the default role.
return WebAccessibility::ROLE_CLIENT;
diff --git a/webkit/glue/webaccessibility.h b/webkit/glue/webaccessibility.h
index 538e612..967bf0c 100644
--- a/webkit/glue/webaccessibility.h
+++ b/webkit/glue/webaccessibility.h
@@ -59,47 +59,56 @@ class WebAccessibility {
DIRECTION_LASTCHILD
};
- // This defines an enumeration of the supported accessibility roles in our
- // Glue layer (used in GlueAccessibilityObject::Role). Any interface using
- // roles must provide a conversion to its own roles (see e.g.
- // BrowserAccessibility::get_accRole and BrowserAccessibility::MSAARole).
+ // This defines an enumeration (in alphabetical order) of the supported
+ // accessibility roles in our Glue layer (used in
+ // GlueAccessibilityObject::Role). Any interface using roles must provide a
+ // conversion to its own roles (see e.g. BrowserAccessibility::get_accRole and
+ // BrowserAccessibility::MSAARole).
enum Role {
- ROLE_PUSHBUTTON,
- ROLE_RADIOBUTTON,
+ ROLE_CELL,
ROLE_CHECKBUTTON,
- ROLE_SLIDER,
- ROLE_PAGETABLIST,
- ROLE_TEXT,
- ROLE_STATICTEXT,
- ROLE_OUTLINE,
+ ROLE_CLIENT,
ROLE_COLUMN,
- ROLE_ROW,
+ ROLE_COLUMNHEADER,
+ ROLE_GRAPHIC,
ROLE_GROUPING,
+ ROLE_LINK,
ROLE_LIST,
+ ROLE_LISTBOX,
+ ROLE_MENUITEM,
+ ROLE_MENUPOPUP,
+ ROLE_OUTLINE,
+ ROLE_PAGETABLIST,
+ ROLE_PROGRESSBAR,
+ ROLE_PUSHBUTTON,
+ ROLE_RADIOBUTTON,
+ ROLE_ROW,
+ ROLE_ROWHEADER,
+ ROLE_SLIDER,
+ ROLE_STATICTEXT,
ROLE_TABLE,
- ROLE_LINK,
- ROLE_GRAPHIC,
- ROLE_CLIENT
+ ROLE_TEXT
};
- // This defines an enumeration of the supported accessibility states in our
- // Glue layer (used in GlueAccessibilityObject::State). Any interface using
- // states must provide a conversion to its own states (see e.g.
- // BrowserAccessibility::get_accState and BrowserAccessibility::MSAAState).
+ // This defines an enumeration (in alphabetical order) of the supported
+ // accessibility states in our Glue layer (used in
+ // GlueAccessibilityObject::State). Any interface using states must provide a
+ // conversion to its own states (see e.g. BrowserAccessibility::get_accState
+ // and BrowserAccessibility::MSAAState).
enum State {
- STATE_LINKED,
+ STATE_CHECKED,
+ STATE_FOCUSABLE,
+ STATE_FOCUSED,
STATE_HOTTRACKED,
- STATE_UNAVAILABLE,
- STATE_READONLY,
- STATE_OFFSCREEN,
- STATE_MULTISELECTABLE,
- STATE_PROTECTED,
STATE_INDETERMINATE,
- STATE_CHECKED,
+ STATE_LINKED,
+ STATE_MULTISELECTABLE,
+ STATE_OFFSCREEN,
STATE_PRESSED,
- STATE_FOCUSED,
+ STATE_PROTECTED,
+ STATE_READONLY,
STATE_TRAVERSED,
- STATE_FOCUSABLE
+ STATE_UNAVAILABLE
};
// Parameters structure to hold a union of the possible accessibility function