Changeset 182012 in webkit


Ignore:
Timestamp:
Mar 26, 2015 9:35:58 AM (9 years ago)
Author:
Chris Fleizach
Message:

AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
https://bugs.webkit.org/show_bug.cgi?id=115298

Reviewed by Mario Sanchez Prada.

Source/WebCore:

A role=button + aria-pressed object should be exposed as AXCheckbox on Mac now. It should also convert the
aria-pressed state into a 0, 1, 2 number value for the Mac.

Test: platform/mac/accessibility/aria-pressed-button-attributes.html

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::checkboxOrRadioValue):

  • accessibility/AccessibilityObject.h:

(WebCore::AccessibilityObject::isToggleButton):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

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

LayoutTests:

  • accessibility/aria-toggle-button-with-title.html:

Bad path for post test resources file, so that is fixed.

  • platform/mac/accessibility/aria-pressed-button-attributes-expected.txt: Added.
  • platform/mac/accessibility/aria-pressed-button-attributes.html: Added.
  • platform/mac/accessibility/aria-toggle-button-with-title-expected.txt:

Updated to reflect the new role of this object.

Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r182006 r182012  
     12015-03-26  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
     4        https://bugs.webkit.org/show_bug.cgi?id=115298
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        * accessibility/aria-toggle-button-with-title.html:
     9             Bad path for post test resources file, so that is fixed.
     10        * platform/mac/accessibility/aria-pressed-button-attributes-expected.txt: Added.
     11        * platform/mac/accessibility/aria-pressed-button-attributes.html: Added.
     12        * platform/mac/accessibility/aria-toggle-button-with-title-expected.txt:
     13              Updated to reflect the new role of this object.
     14
    1152015-03-26  Csaba Osztrogonác  <ossy@webkit.org>
    216
  • trunk/LayoutTests/accessibility/aria-toggle-button-with-title.html

    r155274 r182012  
    3939
    4040</script>
    41 <script src="../../../resources/js-test-post.js"></script>
     41<script src="../resources/js-test-post.js"></script>
    4242</body>
    4343</html>
  • trunk/LayoutTests/platform/mac/accessibility/aria-toggle-button-with-title-expected.txt

    r128748 r182012  
    66
    77
    8 Role: AXRole: AXButton
     8PASS successfullyParsed is true
     9
     10TEST COMPLETE
     11Role: AXRole: AXCheckBox
    912PASS tbutton1.title is 'AXTitle: Toggle button'
    1013Role: AXRole: AXButton
  • trunk/Source/WebCore/ChangeLog

    r181989 r182012  
     12015-03-26  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: [role="button"][aria-pressed] should be exposed as AXCheckbox:AXToggleButton, with role description of "toggle button"
     4        https://bugs.webkit.org/show_bug.cgi?id=115298
     5
     6        Reviewed by Mario Sanchez Prada.
     7
     8        A role=button + aria-pressed object should be exposed as AXCheckbox on Mac now. It should also convert the
     9        aria-pressed state into a 0, 1, 2 number value for the Mac.
     10
     11        Test: platform/mac/accessibility/aria-pressed-button-attributes.html
     12
     13        * accessibility/AccessibilityObject.cpp:
     14        (WebCore::AccessibilityObject::checkboxOrRadioValue):
     15        * accessibility/AccessibilityObject.h:
     16        (WebCore::AccessibilityObject::isToggleButton):
     17        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     18        (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
     19        (createAccessibilityRoleMap):
     20        (-[WebAccessibilityObjectWrapper subrole]):
     21        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     22
    1232015-03-25  Dean Jackson  <dino@apple.com>
    224
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r181484 r182012  
    22272227    // If this is a real checkbox or radio button, AccessibilityRenderObject will handle.
    22282228    // If it's an ARIA checkbox, radio, or switch the aria-checked attribute should be used.
    2229 
     2229    // If it's a toggle button, the aria-pressed attribute is consulted.
     2230
     2231    if (isToggleButton()) {
     2232        const AtomicString& ariaPressed = getAttribute(aria_pressedAttr);
     2233        if (equalIgnoringCase(ariaPressed, "true"))
     2234            return ButtonStateOn;
     2235        if (equalIgnoringCase(ariaPressed, "mixed"))
     2236            return ButtonStateMixed;
     2237        return ButtonStateOff;
     2238    }
     2239   
    22302240    const AtomicString& result = getAttribute(aria_checkedAttr);
    22312241    if (equalIgnoringCase(result, "true"))
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r181484 r182012  
    503503    virtual bool isMediaControlLabel() const { return false; }
    504504    bool isSwitch() const { return roleValue() == SwitchRole; }
     505    bool isToggleButton() const { return roleValue() == ToggleButtonRole; }
    505506    bool isTextControl() const;
    506507    bool isARIATextControl() const;
     
    600601    virtual void ariaControlsElements(AccessibilityChildrenVector&) const { }
    601602    virtual bool ariaHasPopup() const { return false; }
    602     virtual bool ariaPressedIsPresent() const;
     603    bool ariaPressedIsPresent() const;
    603604    bool ariaIsMultiline() const;
    604605    String invalidStatus() const;
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r181484 r182012  
    11911191    if (m_object->supportsARIAOwns())
    11921192        [additional addObject:NSAccessibilityOwnsAttribute];
     1193   
     1194    if (m_object->isToggleButton())
     1195        [additional addObject:NSAccessibilityValueAttribute];
    11931196   
    11941197    if (m_object->supportsARIAExpanded())
     
    19451948        { SpinButtonRole, NSAccessibilityIncrementorRole },
    19461949        { FooterRole, NSAccessibilityGroupRole },
    1947         { ToggleButtonRole, NSAccessibilityButtonRole },
     1950        { ToggleButtonRole, NSAccessibilityCheckBoxRole },
    19481951        { CanvasRole, NSAccessibilityImageRole },
    19491952        { SVGRootRole, NSAccessibilityGroupRole },
     
    19992002    if (m_object->isAttachment()) {
    20002003        NSView* attachView = [self attachmentView];
    2001         if ([[attachView accessibilityAttributeNames] containsObject:NSAccessibilitySubroleAttribute]) {
     2004        if ([[attachView accessibilityAttributeNames] containsObject:NSAccessibilitySubroleAttribute])
    20022005            return [attachView accessibilityAttributeValue:NSAccessibilitySubroleAttribute];
    2003         }
    2004     }
    2005    
    2006     if (m_object->roleValue() == HorizontalRuleRole)
     2006    }
     2007   
     2008    AccessibilityRole role = m_object->roleValue();
     2009    if (role == HorizontalRuleRole)
    20072010        return NSAccessibilityContentSeparatorSubrole;
     2011    if (role == ToggleButtonRole)
     2012        return NSAccessibilityToggleSubrole;
    20082013   
    20092014    if (is<AccessibilitySpinButtonPart>(*m_object)) {
     
    20302035   
    20312036    // ARIA content subroles.
    2032     switch (m_object->roleValue()) {
     2037    switch (role) {
    20332038        case LandmarkApplicationRole:
    20342039            return @"AXLandmarkApplication";
     
    20862091    }
    20872092   
    2088     if (m_object->roleValue() == MathElementRole) {
     2093    if (role == MathElementRole) {
    20892094        if (m_object->isMathFraction())
    20902095            return @"AXMathFraction";
     
    21232128    }
    21242129   
    2125     if (m_object->roleValue() == VideoRole)
     2130    if (role == VideoRole)
    21262131        return @"AXVideo";
    2127     if (m_object->roleValue() == AudioRole)
     2132    if (role == AudioRole)
    21282133        return @"AXAudio";
    21292134   
     
    24502455            return [NSNumber numberWithInt:m_object->headingLevel()];
    24512456       
    2452         if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch()) {
     2457        if (m_object->isCheckboxOrRadio() || m_object->isMenuItem() || m_object->isSwitch() || m_object->isToggleButton()) {
    24532458            switch (m_object->checkboxOrRadioValue()) {
    24542459                case ButtonStateOff:
Note: See TracChangeset for help on using the changeset viewer.