Changeset 246958 in webkit


Ignore:
Timestamp:
Jun 30, 2019 6:21:17 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Enhance support of aria-haspopup per ARIA 1.1 specification.
https://bugs.webkit.org/show_bug.cgi?id=199216
<rdar://problem/46221342>

Patch by Andres Gonzalez <Andres Gonzalez> on 2019-06-30
Reviewed by Chris Fleizach.

Source/WebCore:

Test button-with-aria-haspopup-role.html was expanded to cover testing
of new functionality.

  • accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::popupValue const): replaces hasPopupValue.
(WebCore::AccessibilityObject::hasPopupValue const): Deleted.

  • accessibility/AccessibilityObject.h:
  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::hasPopup const): method rename.

  • accessibility/atk/WebKitAccessible.cpp:

(webkitAccessibleGetAttributes): method rename.

  • accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:

(-[WebAccessibilityObjectWrapper accessibilityPopupValue]):

  • accessibility/mac/WebAccessibilityObjectWrapperMac.mm:

(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):

Tools:

  • DumpRenderTree/AccessibilityUIElement.cpp:

(getPopupValueCallback):
(AccessibilityUIElement::getJSClass):

  • DumpRenderTree/AccessibilityUIElement.h:
  • DumpRenderTree/mac/AccessibilityUIElementMac.mm:

(AccessibilityUIElement::popupValue const):

  • WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
  • WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
  • WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:

(WTR::AccessibilityUIElement::popupValue const):

  • WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:

(WTR::AccessibilityUIElement::popupValue const):

LayoutTests:

  • accessibility/button-with-aria-haspopup-role-expected.txt:
  • accessibility/button-with-aria-haspopup-role.html:
  • accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt:
  • accessibility/ios-simulator/button-with-aria-haspopup-role.html:
Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246950 r246958  
     12019-06-30  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Enhance support of aria-haspopup per ARIA 1.1 specification.
     4        https://bugs.webkit.org/show_bug.cgi?id=199216
     5        <rdar://problem/46221342>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * accessibility/button-with-aria-haspopup-role-expected.txt:
     10        * accessibility/button-with-aria-haspopup-role.html:
     11        * accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt:
     12        * accessibility/ios-simulator/button-with-aria-haspopup-role.html:
     13
    1142019-06-29  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/LayoutTests/accessibility/button-with-aria-haspopup-role-expected.txt

    r215873 r246958  
    44
    55
    6 test1 AXRole: AXButton for aria-haspopup=(null)
    7 test2 AXRole: AXPopUpButton for aria-haspopup='true'
    8 test3 AXRole: AXButton for aria-haspopup='false'
    9 test4 AXRole: AXPopUpButton for aria-haspopup='dialog'
    10 test5 AXRole: AXPopUpButton for aria-haspopup='grid'
    11 test6 AXRole: AXPopUpButton for aria-haspopup='listbox'
    12 test7 AXRole: AXPopUpButton for aria-haspopup='menu'
    13 test8 AXRole: AXPopUpButton for aria-haspopup='tree'
    14 test9 AXRole: AXButton for aria-haspopup='foo'
    15 test10 AXRole: AXButton for aria-haspopup=''
     6test1 AXRole: AXButton for aria-haspopup = (null)
     7AX popupValue = 'false'
     8test2 AXRole: AXPopUpButton for aria-haspopup = 'true'
     9AX popupValue = 'menu'
     10test3 AXRole: AXButton for aria-haspopup = 'false'
     11AX popupValue = 'false'
     12test4 AXRole: AXPopUpButton for aria-haspopup = 'dialog'
     13AX popupValue = 'dialog'
     14test5 AXRole: AXPopUpButton for aria-haspopup = 'grid'
     15AX popupValue = 'grid'
     16test6 AXRole: AXPopUpButton for aria-haspopup = 'listbox'
     17AX popupValue = 'listbox'
     18test7 AXRole: AXPopUpButton for aria-haspopup = 'menu'
     19AX popupValue = 'menu'
     20test8 AXRole: AXPopUpButton for aria-haspopup = 'tree'
     21AX popupValue = 'tree'
     22test9 AXRole: AXButton for aria-haspopup = 'foo'
     23AX popupValue = 'false'
     24test10 AXRole: AXButton for aria-haspopup = ''
     25AX popupValue = 'false'
    1626PASS successfullyParsed is true
    1727
  • trunk/LayoutTests/accessibility/button-with-aria-haspopup-role.html

    r215873 r246958  
    2323    if (window.accessibilityController) {
    2424        for (var i = 1; i <= 10; i++) {
    25             var element = document.getElementById("test" + i)
     25            var element = document.getElementById("test" + i)
    2626            var popup = element.hasAttribute("aria-haspopup") ? "'" + element.getAttribute("aria-haspopup") + "'" : "(null)";
    2727            var axElement = accessibilityController.accessibleElementById("test" + i);
    28             debug("test" + i + " " + axElement.role + " for aria-haspopup=" + popup)
     28            debug("test" + i + " " + axElement.role + " for aria-haspopup = " + popup)
     29            // Check that accessibilityHasPopupValue returns the right value in each case.
     30            debug("AX popupValue = " + "'" + axElement.popupValue + "'");
    2931        }
    3032
  • trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt

    r246715 r246958  
    55
    66PASS element.hasAttribute('aria-haspopup') is true
     7AX popupValue = 'menu'
    78test1 has trait haspopup = true with aria-haspopup attribute = dialog
     9AX popupValue = 'dialog'
    810test2 has trait haspopup = true with aria-haspopup attribute = grid
     11AX popupValue = 'grid'
    912test3 has trait haspopup = true with aria-haspopup attribute = listbox
     13AX popupValue = 'listbox'
    1014test4 has trait haspopup = true with aria-haspopup attribute = menu
     15AX popupValue = 'menu'
    1116test5 has trait haspopup = true with aria-haspopup attribute = tree
     17AX popupValue = 'tree'
    1218test6 has trait haspopup = false with aria-haspopup attribute = null
     19AX popupValue = 'false'
    1320test7 has trait haspopup = false with aria-haspopup attribute = false
     21AX popupValue = 'false'
    1422test8 has trait haspopup = false with aria-haspopup attribute = foo
     23AX popupValue = 'false'
    1524test9 has trait haspopup = false with aria-haspopup attribute =
     25AX popupValue = 'false'
    1626PASS successfullyParsed is true
    1727
  • trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role.html

    r246715 r246958  
    2222    description("This tests the platform attributes exposed for buttons with aria-haspopup");
    2323    if (window.accessibilityController) {
    24         // Get the document and accessibility elements for test0 to be used as reference.
     24        // Get the document and accessibility elements for test0 to be used as reference to check traits against.
    2525        var element = document.getElementById("test0");
    2626        shouldBe("element.hasAttribute('aria-haspopup')", "true");
    2727        var axElement = accessibilityController.accessibleElementById("test0");
    2828        var haspopupTraits = axElement.traits;
     29        // Check that accessibilityHasPopupValue returns the right value in each case.
     30        debug("AX popupValue = " + "'" + axElement.popupValue + "'");
    2931
    3032        for (var i = 1; i <= 9; i++) {
     
    3436            var sameTraits = axElement.traits == haspopupTraits;
    3537            debug("test" + i + " has trait haspopup = " + sameTraits + " with aria-haspopup attribute = " + popup);
     38            // Check that accessibilityHasPopupValue returns the right value in each case.
     39            debug("AX popupValue = " + "'" + axElement.popupValue + "'");
    3640        }
    3741
  • trunk/Source/WebCore/ChangeLog

    r246954 r246958  
     12019-06-30  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Enhance support of aria-haspopup per ARIA 1.1 specification.
     4        https://bugs.webkit.org/show_bug.cgi?id=199216
     5        <rdar://problem/46221342>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Test button-with-aria-haspopup-role.html was expanded to cover testing
     10        of new functionality.
     11
     12        * accessibility/AccessibilityObject.cpp:
     13        (WebCore::AccessibilityObject::popupValue const): replaces hasPopupValue.
     14        (WebCore::AccessibilityObject::hasPopupValue const): Deleted.
     15        * accessibility/AccessibilityObject.h:
     16        * accessibility/AccessibilityRenderObject.cpp:
     17        (WebCore::AccessibilityRenderObject::hasPopup const): method rename.
     18        * accessibility/atk/WebKitAccessible.cpp:
     19        (webkitAccessibleGetAttributes): method rename.
     20        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     21        (-[WebAccessibilityObjectWrapper accessibilityPopupValue]):
     22        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     23        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
     24
    1252019-06-30  Zalan Bujtas  <zalan@apple.com>
    226
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r246736 r246958  
    27592759}
    27602760
    2761 String AccessibilityObject::hasPopupValue() const
    2762 {
    2763     const AtomString& hasPopup = getAttribute(aria_haspopupAttr);
    2764     if (equalLettersIgnoringASCIICase(hasPopup, "true")
    2765         || equalLettersIgnoringASCIICase(hasPopup, "dialog")
    2766         || equalLettersIgnoringASCIICase(hasPopup, "grid")
    2767         || equalLettersIgnoringASCIICase(hasPopup, "listbox")
    2768         || equalLettersIgnoringASCIICase(hasPopup, "menu")
    2769         || equalLettersIgnoringASCIICase(hasPopup, "tree"))
     2761String AccessibilityObject::popupValue() const
     2762{
     2763    static const NeverDestroyed<HashSet<String>> allowedPopupValues(std::initializer_list<String> {
     2764        "menu", "listbox", "tree", "grid", "dialog"
     2765    });
     2766
     2767    auto hasPopup = getAttribute(aria_haspopupAttr).convertToASCIILowercase();
     2768    if (hasPopup.isNull())
     2769        return "false";
     2770
     2771    if (allowedPopupValues->contains(hasPopup))
    27702772        return hasPopup;
     2773
     2774    // aria-haspopup specification states that true must be treated as menu.
     2775    if (hasPopup == "true")
     2776        return "menu";
    27712777
    27722778    // In ARIA 1.1, the implicit value for combobox became "listbox."
  • trunk/Source/WebCore/accessibility/AccessibilityObject.h

    r246490 r246958  
    553553
    554554    virtual bool hasPopup() const { return false; }
    555     String hasPopupValue() const;
     555    String popupValue() const;
    556556    bool supportsHasPopup() const;
    557557    bool pressedIsPresent() const;
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r246715 r246958  
    10351035    // Return true if this has the aria-haspopup attribute, or if it has an ancestor of type link with the aria-haspopup attribute.
    10361036    return AccessibilityObject::matchedParent(*this, true, [this] (const AccessibilityObject& object) {
    1037         return (this == &object) ? !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false")
    1038             : object.isLink() && !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false");
     1037        return (this == &object) ? !equalLettersIgnoringASCIICase(object.popupValue(), "false")
     1038            : object.isLink() && !equalLettersIgnoringASCIICase(object.popupValue(), "false");
    10391039    });
    10401040}
  • trunk/Source/WebCore/accessibility/atk/WebKitAccessible.cpp

    r246677 r246958  
    468468
    469469    if (coreObject->supportsHasPopup())
    470         attributeSet = addToAtkAttributeSet(attributeSet, "haspopup", coreObject->hasPopupValue().utf8().data());
     470        attributeSet = addToAtkAttributeSet(attributeSet, "haspopup", coreObject->popupValue().utf8().data());
    471471
    472472    if (coreObject->supportsCurrent())
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r246941 r246958  
    502502   
    503503    return m_object->hasPopup();
     504}
     505
     506- (NSString *)accessibilityPopupValue
     507{
     508    if (![self _prepareAccessibilityCall])
     509        return nil;
     510
     511    return m_object->popupValue();
    504512}
    505513
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r246941 r246958  
    236236#ifndef NSAccessibilityHasPopupAttribute
    237237#define NSAccessibilityHasPopupAttribute @"AXHasPopup"
     238#endif
     239
     240#ifndef NSAccessibilityPopupValueAttribute
     241#define NSAccessibilityPopupValueAttribute @"AXPopupValue"
    238242#endif
    239243
     
    33803384    if ([attributeName isEqualToString:@"AXAutocompleteValue"])
    33813385        return m_object->autoCompleteValue();
    3382    
    3383     if ([attributeName isEqualToString:@"AXHasPopUpValue"])
    3384         return m_object->hasPopupValue();
    3385    
     3386
     3387    if ([attributeName isEqualToString:NSAccessibilityPopupValueAttribute])
     3388        return m_object->popupValue();
     3389
    33863390    if ([attributeName isEqualToString:@"AXKeyShortcutsValue"])
    33873391        return m_object->keyShortcutsValue();
  • trunk/Tools/ChangeLog

    r246944 r246958  
     12019-06-30  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Enhance support of aria-haspopup per ARIA 1.1 specification.
     4        https://bugs.webkit.org/show_bug.cgi?id=199216
     5        <rdar://problem/46221342>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * DumpRenderTree/AccessibilityUIElement.cpp:
     10        (getPopupValueCallback):
     11        (AccessibilityUIElement::getJSClass):
     12        * DumpRenderTree/AccessibilityUIElement.h:
     13        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
     14        (AccessibilityUIElement::popupValue const):
     15        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
     16        * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
     17        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
     18        (WTR::AccessibilityUIElement::popupValue const):
     19        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
     20        (WTR::AccessibilityUIElement::popupValue const):
     21
    1222019-06-28  Robin Morisset  <rmorisset@apple.com>
    223
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp

    r244561 r246958  
    14021402{
    14031403    return JSValueMakeBoolean(context, toAXElement(thisObject)->hasPopup());
     1404}
     1405
     1406static JSValueRef getPopupValueCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef, JSValueRef*)
     1407{
     1408    return JSValueMakeString(context, toAXElement(thisObject)->popupValue().get());
    14041409}
    14051410
     
    18641869        { "isCollapsed", getIsCollapsedCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18651870        { "hasPopup", getHasPopupCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1871        { "popupValue", getPopupValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18661872        { "valueDescription", getValueDescriptionCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    18671873        { "hierarchicalLevel", hierarchicalLevelCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/AccessibilityUIElement.h

    r244561 r246958  
    165165    bool isIndeterminate() const;
    166166    bool hasPopup() const;
     167    JSRetainPtr<JSStringRef> popupValue() const;
    167168    int hierarchicalLevel() const;
    168169    double clickPointX();
  • trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm

    r244059 r246958  
    104104- (BOOL)_accessibilityIsStrongPasswordField;
    105105- (NSString *)accessibilityTextualContext;
     106- (BOOL)accessibilityHasPopup;
     107- (NSString *)accessibilityPopupValue;
    106108
    107109// TextMarker related
     
    11371139bool AccessibilityUIElement::hasPopup() const
    11381140{
    1139     // FIXME: implement
    1140     return false;
     1141    return [m_element accessibilityHasPopup];
     1142}
     1143
     1144JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     1145{
     1146    return [[m_element accessibilityPopupValue] createJSStringRef];
    11411147}
    11421148
  • trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm

    r244561 r246958  
    16271627}
    16281628
     1629JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     1630{
     1631    BEGIN_AX_OBJC_EXCEPTIONS
     1632    id value = [m_element accessibilityAttributeValue:@"AXPopupValue"];
     1633    if ([value isKindOfClass:[NSString class]])
     1634        return [value createJSStringRef];
     1635    END_AX_OBJC_EXCEPTIONS
     1636
     1637    return [@"false" createJSStringRef];
     1638}
     1639
    16291640void AccessibilityUIElement::takeFocus()
    16301641{
  • trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp

    r236032 r246958  
    908908}
    909909
     910JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     911{
     912    return createEmptyJSString();
     913}
     914
    910915void AccessibilityUIElement::takeFocus()
    911916{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h

    r245565 r246958  
    171171    bool isMultiLine() const;
    172172    bool hasPopup() const;
     173    JSRetainPtr<JSStringRef> popupValue() const;
    173174    int hierarchicalLevel() const;
    174175    double clickPointX();
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl

    r244561 r246958  
    9292    readonly attribute boolean isCollapsed;
    9393    readonly attribute boolean hasPopup;
     94    readonly attribute DOMString popupValue;
    9495    readonly attribute boolean isIgnored;
    9596    readonly attribute boolean isSingleLine;
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

    r246715 r246958  
    8888- (NSString *)accessibilityRoleDescription;
    8989- (BOOL)accessibilityHasPopup;
     90- (NSString *)accessibilityPopupValue;
    9091- (NSString *)accessibilityColorStringValue;
    9192
     
    10571058{
    10581059    return [m_element accessibilityHasPopup];
     1060}
     1061
     1062JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     1063{
     1064    return [[m_element accessibilityPopupValue] createJSStringRef];
    10591065}
    10601066
  • trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm

    r244561 r246958  
    17091709}
    17101710
     1711JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     1712{
     1713    BEGIN_AX_OBJC_EXCEPTIONS
     1714    id value = [m_element accessibilityAttributeValue:@"AXPopupValue"];
     1715    if ([value isKindOfClass:[NSString class]])
     1716        return [value createJSStringRef];
     1717    END_AX_OBJC_EXCEPTIONS
     1718
     1719    return [@"false" createJSStringRef];
     1720}
     1721
    17111722void AccessibilityUIElement::takeFocus()
    17121723{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/win/AccessibilityUIElementWin.cpp

    r244066 r246958  
    759759}
    760760
     761JSRetainPtr<JSStringRef> AccessibilityUIElement::popupValue() const
     762{
     763    notImplemented();
     764    return nullptr;
     765}
     766
    761767void AccessibilityUIElement::takeFocus()
    762768{
Note: See TracChangeset for help on using the changeset viewer.