https://bugs.webkit.org/show_bug.cgi?id=185478
Reviewed by Chris Fleizach.
Source/WebCore:
Add a check to AccessibilityNodeObject::textUnderElement() and return early
if the node is hidden, not referenced by aria-labelledby or aria-describedby,
not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
Test: accessibility/text-alternative-calculation-hidden-nodes.html
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::textUnderElement const):
LayoutTests:
* accessibility/text-alternative-calculation-hidden-nodes-expected.txt: Added.
* accessibility/text-alternative-calculation-hidden-nodes.html: Added.
* platform/gtk/accessibility/text-alternative-calculation-hidden-nodes-expected.txt: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231620
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-05-09 Joanmarie Diggs <jdiggs@igalia.com>
+
+ AX: Hidden nodes which are not directly referenced should not participate name/description from content
+ https://bugs.webkit.org/show_bug.cgi?id=185478
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/text-alternative-calculation-hidden-nodes-expected.txt: Added.
+ * accessibility/text-alternative-calculation-hidden-nodes.html: Added.
+ * platform/gtk/accessibility/text-alternative-calculation-hidden-nodes-expected.txt: Added.
+
2018-05-09 Youenn Fablet <youenn@apple.com>
LayoutTests/http/tests/appcache/abort-cache-onchecking-manifest-404.html is flaky
--- /dev/null
+This tests text alternative calculation with hidden nodes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test 1
+ W3C Name: foo
+ W3C Description:
+Test 2
+ W3C Name:
+ W3C Description: bar
+Test 3
+ W3C Name:
+ W3C Description:
+Test 4
+ W3C Name: cell 1 cell 4
+ W3C Description:
+Test 5
+ W3C Name:
+ W3C Description: cell 1 cell 4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="../resources/accessibility-helper.js"></script>
+</head>
+<body>
+<div id="content">
+ <div id="hidden1" style="visibility:hidden;">foo</div>
+ <div id="hidden2" style="display:none;">bar</div>
+
+ <input id="test1" aria-labelledby="hidden1">
+ <input id="test2" aria-describedby="hidden2">
+
+ <label for="test3" id="hidden3" style="display:none;">baz</label>
+ <input id="test3">
+
+ <table id="table">
+ <tr>
+ <td>cell 1</td>
+ <td style="visibility:hidden;">cell 2</td>
+ <td><div style="display:none;"><div>cell 3</div></td>
+ <td><div>cell 4</div></td>
+ </tr>
+ </table>
+ <input id="test4" aria-labelledby="table">
+ <input id="test5" aria-describedby="table">
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests text alternative calculation with hidden nodes.");
+
+ if (window.accessibilityController) {
+ for (var i = 1; i <= 5; i++) {
+ var axElement = accessibilityController.accessibleElementById("test" + i);
+ debug("Test " + i);
+ debug("\tW3C Name: " + platformValueForW3CName(axElement));
+ debug("\tW3C Description: " + platformValueForW3CDescription(axElement));
+ }
+ document.getElementById("content").style.visibility = "hidden";
+ document.getElementById("table").style.visibility = "hidden";
+ }
+</script>
+
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
--- /dev/null
+This tests text alternative calculation with hidden nodes.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test 1
+ W3C Name: foo
+ W3C Description:
+Test 2
+ W3C Name:
+ W3C Description: bar
+Test 3
+ W3C Name: baz
+ W3C Description:
+Test 4
+ W3C Name: cell 1 cell 4
+ W3C Description:
+Test 5
+ W3C Name:
+ W3C Description: cell 1 cell 4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+2018-05-09 Joanmarie Diggs <jdiggs@igalia.com>
+
+ AX: Hidden nodes which are not directly referenced should not participate name/description from content
+ https://bugs.webkit.org/show_bug.cgi?id=185478
+
+ Reviewed by Chris Fleizach.
+
+ Add a check to AccessibilityNodeObject::textUnderElement() and return early
+ if the node is hidden, not referenced by aria-labelledby or aria-describedby,
+ not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
+
+ Test: accessibility/text-alternative-calculation-hidden-nodes.html
+
+ * accessibility/AccessibilityNodeObject.cpp:
+ (WebCore::AccessibilityNodeObject::textUnderElement const):
+
2018-05-09 Eric Carlson <eric.carlson@apple.com>
Update MediaSession to use release logging
if (is<Text>(node))
return downcast<Text>(*node).wholeText();
+ // The Accname specification states that if the current node is hidden, and not directly
+ // referenced by aria-labelledby or aria-describedby, and is not a host language text
+ // alternative, the empty string should be returned.
+ if (isHidden() && !is<HTMLLabelElement>(node) && !ancestorsOfType<HTMLCanvasElement>(*node).first()) {
+ AccessibilityObject::AccessibilityChildrenVector labelFor;
+ AccessibilityObject::AccessibilityChildrenVector descriptionFor;
+ ariaLabelledByReferencingElements(labelFor);
+ ariaDescribedByReferencingElements(descriptionFor);
+ if (!labelFor.size() && !descriptionFor.size())
+ return String();
+ }
+
StringBuilder builder;
for (AccessibilityObject* child = firstChild(); child; child = child->nextSibling()) {
if (mode.ignoredChildNode && child->node() == mode.ignoredChildNode)