Diff
Modified: trunk/LayoutTests/ChangeLog (246714 => 246715)
--- trunk/LayoutTests/ChangeLog 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/LayoutTests/ChangeLog 2019-06-22 18:59:18 UTC (rev 246715)
@@ -1,3 +1,18 @@
+2019-06-22 Andres Gonzalez <[email protected]>
+
+ 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>
+
+ Reviewed by Chris Fleizach.
+
+ * 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.
+
2019-06-21 Sihui Liu <[email protected]>
openDatabase should return an empty object when WebSQL is disabled
Modified: trunk/LayoutTests/accessibility/element-haspopup-expected.txt (246714 => 246715)
--- trunk/LayoutTests/accessibility/element-haspopup-expected.txt 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/LayoutTests/accessibility/element-haspopup-expected.txt 2019-06-22 18:59:18 UTC (rev 246715)
@@ -1,4 +1,10 @@
Link 1 Link 2
+Paragraph 1.
+
+Paragraph 2.
+
+Paragraph 3.
+
This tests that an element will report that it has a popup correctly.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
@@ -6,6 +12,9 @@
PASS accessibilityController.focusedElement.hasPopup is true
PASS accessibilityController.focusedElement.hasPopup is false
+PASS p1.hasPopup is true
+PASS p2.hasPopup is false
+PASS p3.hasPopup is false
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/element-haspopup.html (246714 => 246715)
--- trunk/LayoutTests/accessibility/element-haspopup.html 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/LayoutTests/accessibility/element-haspopup.html 2019-06-22 18:59:18 UTC (rev 246715)
@@ -8,20 +8,39 @@
<a href="" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
<a href="" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
+<a href="" aria-haspopup="true" tabindex="0" id="link3">
+ <p id="paragraph1">Paragraph 1.</p>
+</a>
+
+<a href="" aria-haspopup="false" tabindex="0" id="link4">
+ <p id="paragraph2">Paragraph 2.</p>
+</a>
+
+<a href="" tabindex="0" id="link5">
+ <p id="paragraph3">Paragraph 3.</p>
+</a>
+
<p id="description"></p>
<div id="console"></div>
<script>
-
description("This tests that an element will report that it has a popup correctly.");
if (window.accessibilityController) {
-
document.getElementById("link1").focus();
shouldBe("accessibilityController.focusedElement.hasPopup", "true");
document.getElementById("link2").focus();
shouldBe("accessibilityController.focusedElement.hasPopup", "false");
+
+ var p1 = accessibilityController.accessibleElementById("paragraph1");
+ shouldBe("p1.hasPopup", "true");
+
+ var p2 = accessibilityController.accessibleElementById("paragraph2");
+ shouldBe("p2.hasPopup", "false");
+
+ var p3 = accessibilityController.accessibleElementById("paragraph3");
+ shouldBe("p3.hasPopup", "false");
}
</script>
Added: trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt (0 => 246715)
--- trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role-expected.txt 2019-06-22 18:59:18 UTC (rev 246715)
@@ -0,0 +1,19 @@
+This tests the platform attributes exposed for buttons with aria-haspopup
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS element.hasAttribute('aria-haspopup') is true
+test1 has trait haspopup = true with aria-haspopup attribute = dialog
+test2 has trait haspopup = true with aria-haspopup attribute = grid
+test3 has trait haspopup = true with aria-haspopup attribute = listbox
+test4 has trait haspopup = true with aria-haspopup attribute = menu
+test5 has trait haspopup = true with aria-haspopup attribute = tree
+test6 has trait haspopup = false with aria-haspopup attribute = null
+test7 has trait haspopup = false with aria-haspopup attribute = false
+test8 has trait haspopup = false with aria-haspopup attribute = foo
+test9 has trait haspopup = false with aria-haspopup attribute =
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role.html (0 => 246715)
--- trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role.html (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/button-with-aria-haspopup-role.html 2019-06-22 18:59:18 UTC (rev 246715)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+<div id="content">
+ <div id="test0" role="button" aria-haspopup="true">X</div>
+ <div id="test1" role="button" aria-haspopup="dialog">X</div>
+ <div id="test2" role="button" aria-haspopup="grid">X</div>
+ <div id="test3" role="button" aria-haspopup="listbox">X</div>
+ <div id="test4" role="button" aria-haspopup="menu">X</div>
+ <div id="test5" role="button" aria-haspopup="tree">X</div>
+ <div id="test6" role="button">X</div>
+ <div id="test7" role="button" aria-haspopup="false">X</div>
+ <div id="test8" role="button" aria-haspopup="foo">X</div>
+ <div id="test9" role="button" aria-haspopup="">X</div>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+ description("This tests the platform attributes exposed for buttons with aria-haspopup");
+ if (window.accessibilityController) {
+ // Get the document and accessibility elements for test0 to be used as reference.
+ var element = document.getElementById("test0");
+ shouldBe("element.hasAttribute('aria-haspopup')", "true");
+ var axElement = accessibilityController.accessibleElementById("test0");
+ var haspopupTraits = axElement.traits;
+
+ for (var i = 1; i <= 9; i++) {
+ var element = document.getElementById("test" + i);
+ var popup = element.getAttribute("aria-haspopup");
+ var axElement = accessibilityController.accessibleElementById("test" + i);
+ var sameTraits = axElement.traits == haspopupTraits;
+ debug("test" + i + " has trait haspopup = " + sameTraits + " with aria-haspopup attribute = " + popup);
+ }
+
+ document.getElementById("content").style.visibility = "hidden";
+ }
+</script>
+<script src=""
+</body>
+</html>
Copied: trunk/LayoutTests/accessibility/ios-simulator/element-haspopup-expected.txt (from rev 246714, trunk/LayoutTests/accessibility/element-haspopup-expected.txt) (0 => 246715)
--- trunk/LayoutTests/accessibility/ios-simulator/element-haspopup-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/element-haspopup-expected.txt 2019-06-22 18:59:18 UTC (rev 246715)
@@ -0,0 +1,21 @@
+Link 1 Link 2
+Paragraph 1.
+
+Paragraph 2.
+
+Paragraph 3.
+
+This tests that an element will report that it has a popup correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS accessibilityController.focusedElement.hasPopup is true
+PASS accessibilityController.focusedElement.hasPopup is false
+PASS p1.hasPopup is true
+PASS p2.hasPopup is false
+PASS p3.hasPopup is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/ios-simulator/element-haspopup.html (0 => 246715)
--- trunk/LayoutTests/accessibility/ios-simulator/element-haspopup.html (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/element-haspopup.html 2019-06-22 18:59:18 UTC (rev 246715)
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<a href="" aria-haspopup="true" tabindex="0" id="link1">Link 1</a>
+<a href="" aria-haspopup="false" tabindex="0" id="link2">Link 2</a>
+
+<a href="" aria-haspopup="true" tabindex="0" id="link3">
+ <p id="paragraph1">Paragraph 1.</p>
+</a>
+
+<a href="" aria-haspopup="false" tabindex="0" id="link4">
+ <p id="paragraph2">Paragraph 2.</p>
+</a>
+
+<a href="" tabindex="0" id="link5">
+ <p id="paragraph3">Paragraph 3.</p>
+</a>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that an element will report that it has a popup correctly.");
+
+ if (window.accessibilityController) {
+ document.getElementById("link1").focus();
+ shouldBe("accessibilityController.focusedElement.hasPopup", "true");
+
+ document.getElementById("link2").focus();
+ shouldBe("accessibilityController.focusedElement.hasPopup", "false");
+
+ var p1 = accessibilityController.accessibleElementById("paragraph1");
+ shouldBe("p1.hasPopup", "true");
+
+ var p2 = accessibilityController.accessibleElementById("paragraph2");
+ shouldBe("p2.hasPopup", "false");
+
+ var p3 = accessibilityController.accessibleElementById("paragraph3");
+ shouldBe("p3.hasPopup", "false");
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (246714 => 246715)
--- trunk/Source/WebCore/ChangeLog 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/Source/WebCore/ChangeLog 2019-06-22 18:59:18 UTC (rev 246715)
@@ -1,3 +1,20 @@
+2019-06-22 Andres Gonzalez <[email protected]>
+
+ 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>
+
+ Reviewed by Chris Fleizach.
+
+ 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):
+
2019-06-22 Robin Morisset <[email protected]> and Yusuke Suzuki <[email protected]>
All prototypes should call didBecomePrototype()
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (246714 => 246715)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2019-06-22 18:59:18 UTC (rev 246715)
@@ -1029,10 +1029,14 @@
// override the "label" element association.
return ariaAccessibilityDescription().length();
}
-
+
bool AccessibilityRenderObject::hasPopup() const
{
- return !equalLettersIgnoringASCIICase(hasPopupValue(), "false");
+ // Return true if this has the aria-haspopup attribute, or if it has an ancestor of type link with the aria-haspopup attribute.
+ return AccessibilityObject::matchedParent(*this, true, [this] (const AccessibilityObject& object) {
+ return (this == &object) ? !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false")
+ : object.isLink() && !equalLettersIgnoringASCIICase(object.hasPopupValue(), "false");
+ });
}
bool AccessibilityRenderObject::supportsARIADropping() const
Modified: trunk/Tools/ChangeLog (246714 => 246715)
--- trunk/Tools/ChangeLog 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/Tools/ChangeLog 2019-06-22 18:59:18 UTC (rev 246715)
@@ -1,3 +1,15 @@
+2019-06-22 Andres Gonzalez <[email protected]>
+
+ 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>
+
+ Reviewed by Chris Fleizach.
+
+ iOS implementation for AccessibilityUIElement::hasPopup.
+ * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+ (WTR::AccessibilityUIElement::hasPopup const):
+
2019-06-22 Konstantin Tokarev <[email protected]>
Unreviewed, add myself to CMake watchlist
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (246714 => 246715)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2019-06-22 18:46:21 UTC (rev 246714)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm 2019-06-22 18:59:18 UTC (rev 246715)
@@ -86,6 +86,7 @@
- (CGRect)accessibilityVisibleContentRect;
- (NSString *)accessibilityTextualContext;
- (NSString *)accessibilityRoleDescription;
+- (BOOL)accessibilityHasPopup;
- (NSString *)accessibilityColorStringValue;
// TextMarker related
@@ -1054,7 +1055,7 @@
bool AccessibilityUIElement::hasPopup() const
{
- return false;
+ return [m_element accessibilityHasPopup];
}
void AccessibilityUIElement::takeFocus()