Changeset 180600 in webkit


Ignore:
Timestamp:
Feb 24, 2015 5:43:42 PM (9 years ago)
Author:
jdiggs@igalia.com
Message:

AX: Implement support for ARIA 1.1 'switch' role
https://bugs.webkit.org/show_bug.cgi?id=141986

Reviewed by Chris Fleizach.

Source/WebCore:

Map the role to ATK_ROLE_TOGGLE_BUTTON for Gtk and Efl; on the Mac, to
AXCheckBox with a subrole of AXSwitch. Ensure it looks and acts like a
widget to accessibility APIs (supports and emits notifications when
toggled, doesn't have children, exposes a name and description when
provided).

Tests: accessibility/aria-switch-checked.html

accessibility/aria-switch-sends-notification.html
accessibility/aria-switch-text.html

  • accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::canHaveChildren):
(WebCore::AccessibilityNodeObject::isChecked):
(WebCore::AccessibilityNodeObject::visibleText):
(WebCore::AccessibilityNodeObject::title):

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::isARIAInput):
(WebCore::AccessibilityObject::actionVerb):
(WebCore::initializeRoleMap):
(WebCore::AccessibilityObject::supportsChecked):
(WebCore::AccessibilityObject::checkboxOrRadioValue):

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::isSwitch):

  • accessibility/atk/AXObjectCacheAtk.cpp:

(WebCore::AXObjectCache::postPlatformNotification):

  • accessibility/atk/WebKitAccessibleWrapperAtk.cpp:

(atkRole):

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
(-[WebAccessibilityObjectWrapper accessibilityTraits]):
(-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(createAccessibilityRoleMap):
(-[WebAccessibilityObjectWrapper subrole]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

LayoutTests:

  • accessibility/aria-switch-checked-expected.txt: Added.
  • accessibility/aria-switch-checked.html: Added.
  • accessibility/aria-switch-sends-notification-expected.txt: Added.
  • accessibility/aria-switch-sends-notification.html: Added.
  • accessibility/aria-switch-text.html: Added.
  • accessibility/roles-exposed.html: Added a test case for the new role.
  • platform/efl/accessibility/aria-fallback-roles-expected.txt: Added.
  • platform/efl/accessibility/aria-switch-text-expected.txt: Added.
  • platform/efl/accessibility/roles-exposed-expected.txt: Updated for the new role.
  • platform/gtk/accessibility/aria-fallback-roles-expected.txt: Added.
  • platform/gtk/accessibility/aria-switch-text-expected.txt: Added.
  • platform/gtk/accessibility/roles-exposed-expected.txt: Updated for the new role.
  • platform/mac-mavericks/accessibility/roles-exposed-expected.txt: Updated for the new role.
  • platform/mac/TestExpectations: Skip the 'checked' notifcation as the Mac doesn't have it.
  • platform/mac/accessibility/aria-switch-text-expected.txt: Added.
  • platform/mac/accessibility/roles-exposed-expected.txt: Updated for the new role.
Location:
trunk
Files:
10 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r180599 r180600  
     12015-02-24  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: Implement support for ARIA 1.1 'switch' role
     4        https://bugs.webkit.org/show_bug.cgi?id=141986
     5
     6        Reviewed by Chris Fleizach.
     7
     8        * accessibility/aria-switch-checked-expected.txt: Added.
     9        * accessibility/aria-switch-checked.html: Added.
     10        * accessibility/aria-switch-sends-notification-expected.txt: Added.
     11        * accessibility/aria-switch-sends-notification.html: Added.
     12        * accessibility/aria-switch-text.html: Added.
     13        * accessibility/roles-exposed.html: Added a test case for the new role.
     14        * platform/efl/accessibility/aria-fallback-roles-expected.txt: Added.
     15        * platform/efl/accessibility/aria-switch-text-expected.txt: Added.
     16        * platform/efl/accessibility/roles-exposed-expected.txt: Updated for the new role.
     17        * platform/gtk/accessibility/aria-fallback-roles-expected.txt: Added.
     18        * platform/gtk/accessibility/aria-switch-text-expected.txt: Added.
     19        * platform/gtk/accessibility/roles-exposed-expected.txt: Updated for the new role.
     20        * platform/mac-mavericks/accessibility/roles-exposed-expected.txt: Updated for the new role.
     21        * platform/mac/TestExpectations: Skip the 'checked' notifcation as the Mac doesn't have it.
     22        * platform/mac/accessibility/aria-switch-text-expected.txt: Added.
     23        * platform/mac/accessibility/roles-exposed-expected.txt: Updated for the new role.
     24
    1252015-02-24  Myles C. Maxfield  <mmaxfield@apple.com>
    226
  • trunk/LayoutTests/accessibility/roles-exposed.html

    r179253 r180600  
    305305<div role="spinbutton"               data-platform="atk,mac" class="ex">X</div>
    306306<div role="status" data-platform="atk,mac" class="ex">X</div>
     307<div role="switch" data-platform="atk,mac" class="ex">X</div>
    307308<div role="tablist"                  data-platform="atk,mac" class="ex">
    308309    <div role="tab"                  data-platform="atk,mac" class="ex">X</div>
  • trunk/LayoutTests/platform/efl/accessibility/roles-exposed-expected.txt

    r179425 r180600  
    644644      AXRole: AXStatusBar
    645645     
     646div[role=switch]
     647      AXRole: AXToggleButton
     648     
    646649div[role=tablist]
    647650      AXRole: AXTabGroup
  • trunk/LayoutTests/platform/gtk/accessibility/roles-exposed-expected.txt

    r180566 r180600  
    644644      AXRole: AXStatusBar
    645645     
     646div[role=switch]
     647      AXRole: AXToggleButton
     648     
    646649div[role=tablist]
    647650      AXRole: AXTabGroup
  • trunk/LayoutTests/platform/mac-mavericks/accessibility/roles-exposed-expected.txt

    r179253 r180600  
    10701070      AXRoleDescription: application status
    10711071     
     1072div[role=switch]
     1073      AXRole: AXCheckBox
     1074      AXSubrole: AXSwitch
     1075      AXRoleDescription: switch
     1076     
    10721077div[role=tablist]
    10731078      AXRole: AXTabGroup
  • trunk/LayoutTests/platform/mac/TestExpectations

    r180549 r180600  
    3232# Accessibility tests for notifications that don't exist or aren't needed on Mac OS X.
    3333accessibility/aria-checkbox-sends-notification.html
     34accessibility/aria-switch-sends-notification.html
    3435accessibility/combo-box-collapsed-selection-changed.html
    3536accessibility/children-changed-sends-notification.html
  • trunk/LayoutTests/platform/mac/accessibility/roles-exposed-expected.txt

    r179253 r180600  
    10701070      AXRoleDescription: application status
    10711071     
     1072div[role=switch]
     1073      AXRole: AXCheckBox
     1074      AXSubrole: AXSwitch
     1075      AXRoleDescription: switch
     1076     
    10721077div[role=tablist]
    10731078      AXRole: AXTabGroup
  • trunk/Source/WebCore/ChangeLog

    r180599 r180600  
     12015-02-24  Joanmarie Diggs  <jdiggs@igalia.com>
     2
     3        AX: Implement support for ARIA 1.1 'switch' role
     4        https://bugs.webkit.org/show_bug.cgi?id=141986
     5
     6        Reviewed by Chris Fleizach.
     7
     8        Map the role to ATK_ROLE_TOGGLE_BUTTON for Gtk and Efl; on the Mac, to
     9        AXCheckBox with a subrole of AXSwitch. Ensure it looks and acts like a
     10        widget to accessibility APIs (supports and emits notifications when
     11        toggled, doesn't have children, exposes a name and description when
     12        provided).
     13
     14        Tests: accessibility/aria-switch-checked.html
     15               accessibility/aria-switch-sends-notification.html
     16               accessibility/aria-switch-text.html
     17
     18        * accessibility/AccessibilityNodeObject.cpp:
     19        (WebCore::AccessibilityNodeObject::canHaveChildren):
     20        (WebCore::AccessibilityNodeObject::isChecked):
     21        (WebCore::AccessibilityNodeObject::visibleText):
     22        (WebCore::AccessibilityNodeObject::title):
     23        * accessibility/AccessibilityObject.cpp:
     24        (WebCore::AccessibilityObject::isARIAInput):
     25        (WebCore::AccessibilityObject::actionVerb):
     26        (WebCore::initializeRoleMap):
     27        (WebCore::AccessibilityObject::supportsChecked):
     28        (WebCore::AccessibilityObject::checkboxOrRadioValue):
     29        * accessibility/AccessibilityObject.h:
     30        (WebCore::AccessibilityObject::isSwitch):
     31        * accessibility/atk/AXObjectCacheAtk.cpp:
     32        (WebCore::AXObjectCache::postPlatformNotification):
     33        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
     34        (atkRole):
     35        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     36        (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
     37        (-[WebAccessibilityObjectWrapper accessibilityTraits]):
     38        (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
     39        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     40        (createAccessibilityRoleMap):
     41        (-[WebAccessibilityObjectWrapper subrole]):
     42        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     43
    1442015-02-24  Myles C. Maxfield  <mmaxfield@apple.com>
    245
  • trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp

    r179157 r180600  
    404404    case ScrollBarRole:
    405405    case ProgressIndicatorRole:
     406    case SwitchRole:
    406407        return false;
    407408    default:
     
    700701    case MenuItemCheckboxRole:
    701702    case MenuItemRadioRole:
     703    case SwitchRole:
    702704        validRole = true;
    703705        break;
     
    13571359    case MenuItemRadioRole:
    13581360    case RadioButtonRole:
     1361    case SwitchRole:
    13591362    case TabRole:
    13601363    case ProgressIndicatorRole:
     
    17351738    case MenuItemRadioRole:
    17361739    case RadioButtonRole:
     1740    case SwitchRole:
    17371741    case TabRole:
    17381742        return textUnderElement();
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r179143 r180600  
    780780bool AccessibilityObject::isARIAInput(AccessibilityRole ariaRole)
    781781{
    782     return ariaRole == RadioButtonRole || ariaRole == CheckBoxRole || ariaRole == TextFieldRole;
     782    return ariaRole == RadioButtonRole || ariaRole == CheckBoxRole || ariaRole == TextFieldRole || ariaRole == SwitchRole;
    783783}   
    784784   
     
    17341734        return radioButtonAction;
    17351735    case CheckBoxRole:
     1736    case SwitchRole:
    17361737        return isChecked() ? checkedCheckBoxAction : uncheckedCheckBoxAction;
    17371738    case LinkRole:
     
    19161917        { "spinbutton", SpinButtonRole },
    19171918        { "status", ApplicationStatusRole },
     1919        { "switch", SwitchRole },
    19181920        { "tab", TabRole },
    19191921        { "tablist", TabListRole },
     
    22132215    case MenuItemRadioRole:
    22142216    case RadioButtonRole:
     2217    case SwitchRole:
    22152218        return true;
    22162219    default:
     
    22222225{
    22232226    // If this is a real checkbox or radio button, AccessibilityRenderObject will handle.
    2224     // If it's an ARIA checkbox or radio, the aria-checked attribute should be used.
     2227    // If it's an ARIA checkbox, radio, or switch the aria-checked attribute should be used.
    22252228
    22262229    const AtomicString& result = getAttribute(aria_checkedAttr);
     
    22282231        return ButtonStateOn;
    22292232    if (equalIgnoringCase(result, "mixed")) {
    2230         // ARIA says that radio and menuitemradio elements must NOT expose button state mixed.
     2233        // ARIA says that radio, menuitemradio, and switch elements must NOT expose button state mixed.
    22312234        AccessibilityRole ariaRole = ariaRoleAttribute();
    2232         if (ariaRole == RadioButtonRole || ariaRole == MenuItemRadioRole)
     2235        if (ariaRole == RadioButtonRole || ariaRole == MenuItemRadioRole || ariaRole == SwitchRole)
    22332236            return ButtonStateOff;
    22342237        return ButtonStateMixed;
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r179253 r180600  
    189189    SplitterRole,
    190190    StaticTextRole,
     191    SwitchRole,
    191192    SystemWideRole,
    192193    SVGRootRole,
     
    500501    virtual bool isMockObject() const { return false; }
    501502    virtual bool isMediaControlLabel() const { return false; }
     503    bool isSwitch() const { return roleValue() == SwitchRole; }
    502504    bool isTextControl() const;
    503505    bool isARIATextControl() const;
  • trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp

    r176076 r180600  
    195195    switch (notification) {
    196196    case AXCheckedStateChanged:
    197         if (!coreObject->isCheckboxOrRadio())
     197        if (!coreObject->isCheckboxOrRadio() && !coreObject->isSwitch())
    198198            return;
    199199        atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked());
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp

    r180566 r180600  
    511511    case ButtonRole:
    512512        return ATK_ROLE_PUSH_BUTTON;
     513    case SwitchRole:
    513514    case ToggleButtonRole:
    514515        return ATK_ROLE_TOGGLE_BUTTON;
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r180273 r180600  
    300300    case SliderRole:
    301301    case StaticTextRole:
     302    case SwitchRole:
    302303    case TabRole:
    303304    case TextFieldRole:
     
    567568        case ToggleButtonRole:
    568569        case CheckBoxRole:
     570        case SwitchRole:
    569571            traits |= ([self _axButtonTrait] | [self _axToggleTrait]);
    570572            break;
     
    646648        case DocumentMathRole:
    647649        case HorizontalRuleRole:
     650        case SwitchRole:
    648651            return true;
    649652        case StaticTextRole:
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r180273 r180600  
    19431943        { VideoRole, NSAccessibilityGroupRole },
    19441944        { HorizontalRuleRole, NSAccessibilitySplitterRole },
    1945         { BlockquoteRole, NSAccessibilityGroupRole }
     1945        { BlockquoteRole, NSAccessibilityGroupRole },
     1946        { SwitchRole, NSAccessibilityCheckBoxRole },
    19461947    };
    19471948    AccessibilityRoleMap& roleMap = *new AccessibilityRoleMap;
     
    21182119    if (m_object->isMediaTimeline())
    21192120        return NSAccessibilityTimelineSubrole;
     2121
     2122    if (m_object->isSwitch())
     2123        return NSAccessibilitySwitchSubrole;
    21202124   
    21212125    return nil;
     
    24352439            return [NSNumber numberWithInt:m_object->headingLevel()];
    24362440       
    2437         if (m_object->isCheckboxOrRadio() || m_object->isMenuItem()) {
     2441        if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch()) {
    24382442            switch (m_object->checkboxOrRadioValue()) {
    24392443                case ButtonStateOff:
Note: See TracChangeset for help on using the changeset viewer.