Changeset 246715 in webkit


Ignore:
Timestamp:
Jun 22, 2019 11:59:18 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Accessibility objects contained in links should honor the aria-haspopup attribute in the ancestor link.
https://bugs.webkit.org/show_bug.cgi?id=199107
<rdar://problem/43663611>

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

Source/WebCore:

Tests: accessibility/ios-simulator/button-with-aria-haspopup-role.html

accessibility/ios-simulator/element-haspopup.html

If an accessibility object is contained within an <a>, we should check
the aria-haspopup attribute on the ancestor <a> element. This was done
before in the iOS WebKit accessibility bunddle override.

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::hasPopup const):

Tools:

iOS implementation for AccessibilityUIElement::hasPopup.

  • WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:

(WTR::AccessibilityUIElement::hasPopup const):

LayoutTests:

  • accessibility/element-haspopup-expected.txt:
  • accessibility/element-haspopup.html: Added cases for a <p> element contained within <a>.
  • accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt: Added.
  • accessibility/ios-simulator/button-with-aria-haspopup-role.html: Added. Existed for MacOS and now also for iOS.
  • accessibility/ios-simulator/element-haspopup-expected.txt: Copied from LayoutTests/accessibility/element-haspopup-expected.txt.
  • accessibility/ios-simulator/element-haspopup.html: Added.
Location:
trunk
Files:
3 added
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246707 r246715  
     12019-06-22  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Accessibility objects contained in links should honor the aria-haspopup attribute in the ancestor link.
     4        https://bugs.webkit.org/show_bug.cgi?id=199107
     5        <rdar://problem/43663611>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * accessibility/element-haspopup-expected.txt:
     10        * accessibility/element-haspopup.html: Added cases for a <p> element contained within <a>.
     11        * accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt: Added.
     12        * accessibility/ios-simulator/button-with-aria-haspopup-role.html: Added. Existed for MacOS and now also for iOS.
     13        * accessibility/ios-simulator/element-haspopup-expected.txt: Copied from LayoutTests/accessibility/element-haspopup-expected.txt.
     14        * accessibility/ios-simulator/element-haspopup.html: Added.
     15
    1162019-06-21  Sihui Liu  <sihui_liu@apple.com>
    217
  • trunk/LayoutTests/accessibility/element-haspopup-expected.txt

    r152716 r246715  
    11Link 1 Link 2
     2Paragraph 1.
     3
     4Paragraph 2.
     5
     6Paragraph 3.
     7
    28This tests that an element will report that it has a popup correctly.
    39
     
    713PASS accessibilityController.focusedElement.hasPopup is true
    814PASS accessibilityController.focusedElement.hasPopup is false
     15PASS p1.hasPopup is true
     16PASS p2.hasPopup is false
     17PASS p3.hasPopup is false
    918PASS successfullyParsed is true
    1019
  • trunk/LayoutTests/accessibility/element-haspopup.html

    r155274 r246715  
    99<a href="#" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
    1010
     11<a href="#" aria-haspopup="true" tabindex="0" id="link3">
     12    <p id="paragraph1">Paragraph 1.</p>
     13</a>
     14
     15<a href="#" aria-haspopup="false" tabindex="0" id="link4">
     16    <p id="paragraph2">Paragraph 2.</p>
     17</a>
     18
     19<a href="#" tabindex="0" id="link5">
     20    <p id="paragraph3">Paragraph 3.</p>
     21</a>
     22
    1123<p id="description"></p>
    1224<div id="console"></div>
    1325
    1426<script>
    15 
    1627    description("This tests that an element will report that it has a popup correctly.");
    1728
    1829    if (window.accessibilityController) {
    19 
    2030        document.getElementById("link1").focus();
    2131        shouldBe("accessibilityController.focusedElement.hasPopup", "true");
     
    2333        document.getElementById("link2").focus();
    2434        shouldBe("accessibilityController.focusedElement.hasPopup", "false");
     35
     36        var p1 = accessibilityController.accessibleElementById("paragraph1");
     37        shouldBe("p1.hasPopup", "true");
     38
     39        var p2 = accessibilityController.accessibleElementById("paragraph2");
     40        shouldBe("p2.hasPopup", "false");
     41
     42        var p3 = accessibilityController.accessibleElementById("paragraph3");
     43        shouldBe("p3.hasPopup", "false");
    2544    }
    2645
  • trunk/LayoutTests/accessibility/ios-simulator/element-haspopup-expected.txt

    r246714 r246715  
    11Link 1 Link 2
     2Paragraph 1.
     3
     4Paragraph 2.
     5
     6Paragraph 3.
     7
    28This tests that an element will report that it has a popup correctly.
    39
     
    713PASS accessibilityController.focusedElement.hasPopup is true
    814PASS accessibilityController.focusedElement.hasPopup is false
     15PASS p1.hasPopup is true
     16PASS p2.hasPopup is false
     17PASS p3.hasPopup is false
    918PASS successfullyParsed is true
    1019
  • trunk/Source/WebCore/ChangeLog

    r246714 r246715  
     12019-06-22  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Accessibility objects contained in links should honor the aria-haspopup attribute in the ancestor link.
     4        https://bugs.webkit.org/show_bug.cgi?id=199107
     5        <rdar://problem/43663611>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        Tests: accessibility/ios-simulator/button-with-aria-haspopup-role.html
     10               accessibility/ios-simulator/element-haspopup.html
     11
     12        If an accessibility object is contained within an <a>, we should check
     13        the aria-haspopup attribute on the ancestor <a> element. This was done
     14        before in the iOS WebKit accessibility bunddle override.
     15        * accessibility/AccessibilityRenderObject.cpp:
     16        (WebCore::AccessibilityRenderObject::hasPopup const):
     17
    1182019-06-22  Robin Morisset  <rmorisset@apple.com> and Yusuke Suzuki  <ysuzuki@apple.com>
    219
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r246490 r246715  
    10301030    return ariaAccessibilityDescription().length();
    10311031}
    1032    
     1032
    10331033bool AccessibilityRenderObject::hasPopup() const
    10341034{
    1035     return !equalLettersIgnoringASCIICase(hasPopupValue(), "false");
     1035    // Return true if this has the aria-haspopup attribute, or if it has an ancestor of type link with the aria-haspopup attribute.
     1036    return AccessibilityObject::matchedParent(*this, true, [this] (const AccessibilityObject& object) {
     1037        return (this == &object) ? !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false")
     1038            : object.isLink() && !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false");
     1039    });
    10361040}
    10371041
  • trunk/Tools/ChangeLog

    r246711 r246715  
     12019-06-22  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Accessibility objects contained in links should honor the aria-haspopup attribute in the ancestor link.
     4        https://bugs.webkit.org/show_bug.cgi?id=199107
     5        <rdar://problem/43663611>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        iOS implementation for AccessibilityUIElement::hasPopup.
     10        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
     11        (WTR::AccessibilityUIElement::hasPopup const):
     12
    1132019-06-22  Konstantin Tokarev  <annulen@yandex.ru>
    214
  • trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm

    r245912 r246715  
    8787- (NSString *)accessibilityTextualContext;
    8888- (NSString *)accessibilityRoleDescription;
     89- (BOOL)accessibilityHasPopup;
    8990- (NSString *)accessibilityColorStringValue;
    9091
     
    10551056bool AccessibilityUIElement::hasPopup() const
    10561057{
    1057     return false;
     1058    return [m_element accessibilityHasPopup];
    10581059}
    10591060
Note: See TracChangeset for help on using the changeset viewer.