diff options
-rw-r--r-- | chrome/browser/browser_accessibility.cc | 115 | ||||
-rw-r--r-- | webkit/glue/glue_accessibility_object.cc | 109 | ||||
-rw-r--r-- | webkit/glue/webaccessibility.h | 65 |
3 files changed, 164 insertions, 125 deletions
diff --git a/chrome/browser/browser_accessibility.cc b/chrome/browser/browser_accessibility.cc index 8af5a6a..ae5b903 100644 --- a/chrome/browser/browser_accessibility.cc +++ b/chrome/browser/browser_accessibility.cc @@ -559,37 +559,50 @@ const WebAccessibility::OutParams& BrowserAccessibility::response() { long BrowserAccessibility::MSAARole(long browser_accessibility_role) { switch (browser_accessibility_role) { - case WebAccessibility::ROLE_PUSHBUTTON : - return ROLE_SYSTEM_PUSHBUTTON; - case WebAccessibility::ROLE_RADIOBUTTON : - return ROLE_SYSTEM_RADIOBUTTON; - case WebAccessibility::ROLE_CHECKBUTTON : + case WebAccessibility::ROLE_CELL: + return ROLE_SYSTEM_CELL; + case WebAccessibility::ROLE_CHECKBUTTON: return ROLE_SYSTEM_CHECKBUTTON; - case WebAccessibility::ROLE_SLIDER : - return ROLE_SYSTEM_SLIDER; - case WebAccessibility::ROLE_PAGETABLIST : - return ROLE_SYSTEM_PAGETABLIST; - case WebAccessibility::ROLE_TEXT : - return ROLE_SYSTEM_TEXT; - case WebAccessibility::ROLE_STATICTEXT : - return ROLE_SYSTEM_STATICTEXT; - case WebAccessibility::ROLE_OUTLINE : - return ROLE_SYSTEM_OUTLINE; - case WebAccessibility::ROLE_COLUMN : + case WebAccessibility::ROLE_COLUMN: return ROLE_SYSTEM_COLUMN; - case WebAccessibility::ROLE_ROW : - return ROLE_SYSTEM_ROW; - case WebAccessibility::ROLE_GROUPING : + case WebAccessibility::ROLE_COLUMNHEADER: + return ROLE_SYSTEM_COLUMNHEADER; + case WebAccessibility::ROLE_GRAPHIC: + return ROLE_SYSTEM_GRAPHIC; + case WebAccessibility::ROLE_GROUPING: return ROLE_SYSTEM_GROUPING; - case WebAccessibility::ROLE_LIST : + case WebAccessibility::ROLE_LINK: + return ROLE_SYSTEM_LINK; + case WebAccessibility::ROLE_LIST: + case WebAccessibility::ROLE_LISTBOX: return ROLE_SYSTEM_LIST; - case WebAccessibility::ROLE_TABLE : + case WebAccessibility::ROLE_MENUITEM: + return ROLE_SYSTEM_MENUITEM; + case WebAccessibility::ROLE_MENUPOPUP: + return ROLE_SYSTEM_MENUPOPUP; + case WebAccessibility::ROLE_OUTLINE: + return ROLE_SYSTEM_OUTLINE; + case WebAccessibility::ROLE_PAGETABLIST: + return ROLE_SYSTEM_PAGETABLIST; + case WebAccessibility::ROLE_PROGRESSBAR: + return ROLE_SYSTEM_PROGRESSBAR; + case WebAccessibility::ROLE_PUSHBUTTON: + return ROLE_SYSTEM_PUSHBUTTON; + case WebAccessibility::ROLE_RADIOBUTTON: + return ROLE_SYSTEM_RADIOBUTTON; + case WebAccessibility::ROLE_ROW: + return ROLE_SYSTEM_ROW; + case WebAccessibility::ROLE_ROWHEADER: + return ROLE_SYSTEM_ROWHEADER; + case WebAccessibility::ROLE_SLIDER: + return ROLE_SYSTEM_SLIDER; + case WebAccessibility::ROLE_STATICTEXT: + return ROLE_SYSTEM_STATICTEXT; + case WebAccessibility::ROLE_TABLE: return ROLE_SYSTEM_TABLE; - case WebAccessibility::ROLE_LINK : - return ROLE_SYSTEM_LINK; - case WebAccessibility::ROLE_GRAPHIC : - return ROLE_SYSTEM_GRAPHIC; - case WebAccessibility::ROLE_CLIENT : + case WebAccessibility::ROLE_TEXT: + return ROLE_SYSTEM_TEXT; + case WebAccessibility::ROLE_CLIENT: default: // This is the default role for MSAA. return ROLE_SYSTEM_CLIENT; @@ -599,48 +612,48 @@ long BrowserAccessibility::MSAARole(long browser_accessibility_role) { long BrowserAccessibility::MSAAState(long browser_accessibility_state) { long state = 0; - if ((browser_accessibility_state >> WebAccessibility::STATE_LINKED) & 1) - state |= STATE_SYSTEM_LINKED; - - if ((browser_accessibility_state >> WebAccessibility::STATE_HOTTRACKED) & 1) - state |= STATE_SYSTEM_HOTTRACKED; + if ((browser_accessibility_state >> WebAccessibility::STATE_CHECKED) & 1) + state |= STATE_SYSTEM_CHECKED; - if ((browser_accessibility_state >> WebAccessibility::STATE_UNAVAILABLE) & 1) - state |= STATE_SYSTEM_UNAVAILABLE; + if ((browser_accessibility_state >> WebAccessibility::STATE_FOCUSABLE) & 1) + state |= STATE_SYSTEM_FOCUSABLE; - if ((browser_accessibility_state >> WebAccessibility::STATE_READONLY) & 1) - state |= STATE_SYSTEM_READONLY; + if ((browser_accessibility_state >> WebAccessibility::STATE_FOCUSED) & 1) + state |= STATE_SYSTEM_FOCUSED; - if ((browser_accessibility_state >> WebAccessibility::STATE_OFFSCREEN) & 1) - state |= STATE_SYSTEM_OFFSCREEN; + if ((browser_accessibility_state >> WebAccessibility::STATE_HOTTRACKED) & 1) + state |= STATE_SYSTEM_HOTTRACKED; if ((browser_accessibility_state >> - WebAccessibility::STATE_MULTISELECTABLE) & 1) { - state |= STATE_SYSTEM_MULTISELECTABLE; + WebAccessibility::STATE_INDETERMINATE) & 1) { + state |= STATE_SYSTEM_INDETERMINATE; } - if ((browser_accessibility_state >> WebAccessibility::STATE_PROTECTED) & 1) - state |= STATE_SYSTEM_PROTECTED; + if ((browser_accessibility_state >> WebAccessibility::STATE_LINKED) & 1) + state |= STATE_SYSTEM_LINKED; if ((browser_accessibility_state >> - WebAccessibility::STATE_INDETERMINATE) & 1) { - state |= STATE_SYSTEM_INDETERMINATE; + WebAccessibility::STATE_MULTISELECTABLE) & 1) { + state |= STATE_SYSTEM_MULTISELECTABLE; } - if ((browser_accessibility_state >> WebAccessibility::STATE_CHECKED) & 1) - state |= STATE_SYSTEM_CHECKED; + if ((browser_accessibility_state >> WebAccessibility::STATE_OFFSCREEN) & 1) + state |= STATE_SYSTEM_OFFSCREEN; if ((browser_accessibility_state >> WebAccessibility::STATE_PRESSED) & 1) - state |= STATE_SYSTEM_PRESSED; + state |= STATE_SYSTEM_PRESSED; - if ((browser_accessibility_state >> WebAccessibility::STATE_FOCUSED) & 1) - state |= STATE_SYSTEM_FOCUSED; + if ((browser_accessibility_state >> WebAccessibility::STATE_PROTECTED) & 1) + state |= STATE_SYSTEM_PROTECTED; + + if ((browser_accessibility_state >> WebAccessibility::STATE_READONLY) & 1) + state |= STATE_SYSTEM_READONLY; if ((browser_accessibility_state >> WebAccessibility::STATE_TRAVERSED) & 1) - state |= STATE_SYSTEM_TRAVERSED; + state |= STATE_SYSTEM_TRAVERSED; - if ((browser_accessibility_state >> WebAccessibility::STATE_FOCUSABLE) & 1) - state |= STATE_SYSTEM_FOCUSABLE; + if ((browser_accessibility_state >> WebAccessibility::STATE_UNAVAILABLE) & 1) + state |= STATE_SYSTEM_UNAVAILABLE; return state; } 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 |