haikuwebkit/LayoutTests/resources/accessibility-helper.js

113 lines
3.8 KiB
JavaScript
Raw Permalink Normal View History

Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): Tools: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setIsolatedTreeMode): (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode. * WebKitTestRunner/InjectedBundle/AccessibilityController.h: * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Exposes setIsolatedTreeMode to JavaScript code so that it can be turned on and off in a layout tests. * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: Exposes isIsolatedObject to JavaScript code so that layout tests can check whether the underlying accessibility object is an AXIsolatedObject or an AXObject. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): Rename. * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::isIsolatedObject const): LayoutTests: * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added. * accessibility/mac/isolated-tree-mode-on-off.html: Added. * resources/accessibility-helper.js: (dumpAccessibilityTree): In addition to dumping the accessibility tree into an element with id="tree", it returns a string representation of the accessibility tree. Canonical link: https://commits.webkit.org/227932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-04 16:56:34 +00:00
// Dumps the accessibility tree hierarchy for the given accessibilityObject into
// an element with id="tree", e.g., <pre id="tree"></pre>. In addition, it
// returns a two element array with the first element [0] being false if the
// traversal of the tree was stopped at the stopElement, and second element [1],
// the string representing the accessibility tree.
AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree https://bugs.webkit.org/show_bug.cgi?id=139582 <rdar://problem/26938849> Reviewed by Chris Fleizach. This is based on a patch by Frederic Wang <fwang@igalia.com>. Source/WebCore: WebCore assigns the generic MathElementRole AccessibilityRole to elements which are expected to be included in the accessibility tree. This assignment is based on the AccessibilityRenderObject's node being a MathMLElement. The anonymous RenderMathMLOperators fail that test. From the perspective of accessibility support, these operators function like MathMLElements. Furthermore, both WebCore and the platforms rely upon MathElementRole to identify accessible MathML objects. The simplest fix is to have AccessibilityRenderObject::isMathElement() treat anonymous MathML operators as if they were MathMLElements. Now that these operators are being exposed, we need to handle them in AccessibilityRenderObject::textUnderElement() which assumes that anonymous objects either have nodes or have children with nodes. And crashes when that fails to be the case. Making RenderMathMLOperator::textContent() public and then using it to get the text under anonymous operators solves this problem. We also assign StaticTextRole to these operators on the Mac because the default platform mapping of MathElementRole is GroupRole, which made sense when we had a child RenderText object holding the operator. Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no longer needs to special-case anonymous operators because they now have MathElementRole. Tests: accessibility/math-fenced.html accessibility/math-foreign-content.html * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isAnonymousMathOperator): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): (WebCore::AccessibilityRenderObject::stringValue): (WebCore::AccessibilityRenderObject::isMathElement): (WebCore::AccessibilityRenderObject::isAnonymousMathOperator): (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree): * accessibility/AccessibilityRenderObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper role]): * rendering/mathml/RenderMathMLMath.h: * rendering/mathml/RenderMathMLOperator.h: (WebCore::RenderMathMLOperator::textContent): LayoutTests: One of the things making it difficult to tell that the operators were not exposed on the Mac is the fact that the operator text is present. But the operator text is simply a StaticTextRole object corresponding to the RenderText descendant of the operator. Furthermore, on the Mac, accessible math operators have subroles which are missing from the StaticTextRole object which is exposed. In order to make issues like this more obvious, add an option to include the subrole to dumpAccessibilityTree() and use it in the new math-fenced.html. This change also fixes the mfenced in mac/mathml-elements.html that was broken after r202420. We enable it again and update the expectations of that test because the operators are now in the accessibility tree. We also add a new test to verify the render tree of foreign content in MathML formulas. * accessibility/mac/mathml-elements-expected.txt: Updated. * accessibility/mac/mathml-elements.html: Re-enable the mfenced test. * accessibility/math-fenced.html: Added. * accessibility/math-foreign-content.html: Added. * platform/gtk/accessibility/math-fenced-expected.txt: Added. * platform/gtk/accessibility/math-foreign-content-expected.txt: Added. * platform/mac/accessibility/math-fenced-expected.txt: Added. * platform/mac/accessibility/math-foreign-content-expected.txt: Added. * resources/accessibility-helper.js: Add option to include subrole in tree. (dumpAccessibilityTree): Canonical link: https://commits.webkit.org/177250@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-27 17:57:49 +00:00
function dumpAccessibilityTree(accessibilityObject, stopElement, indent, allAttributesIfNeeded, getValueFromTitle, includeSubrole) {
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
var str = "";
var i = 0;
for (i = 0; i < indent; i++)
str += " ";
str += accessibilityObject.role;
AX: Anonymous RenderMathMLOperators are not exposed to the accessibility tree https://bugs.webkit.org/show_bug.cgi?id=139582 <rdar://problem/26938849> Reviewed by Chris Fleizach. This is based on a patch by Frederic Wang <fwang@igalia.com>. Source/WebCore: WebCore assigns the generic MathElementRole AccessibilityRole to elements which are expected to be included in the accessibility tree. This assignment is based on the AccessibilityRenderObject's node being a MathMLElement. The anonymous RenderMathMLOperators fail that test. From the perspective of accessibility support, these operators function like MathMLElements. Furthermore, both WebCore and the platforms rely upon MathElementRole to identify accessible MathML objects. The simplest fix is to have AccessibilityRenderObject::isMathElement() treat anonymous MathML operators as if they were MathMLElements. Now that these operators are being exposed, we need to handle them in AccessibilityRenderObject::textUnderElement() which assumes that anonymous objects either have nodes or have children with nodes. And crashes when that fails to be the case. Making RenderMathMLOperator::textContent() public and then using it to get the text under anonymous operators solves this problem. We also assign StaticTextRole to these operators on the Mac because the default platform mapping of MathElementRole is GroupRole, which made sense when we had a child RenderText object holding the operator. Lastly, AccessibilityRenderObject::isIgnoredElementWithinMathTree() no longer needs to special-case anonymous operators because they now have MathElementRole. Tests: accessibility/math-fenced.html accessibility/math-foreign-content.html * accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::isAnonymousMathOperator): * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::textUnderElement): (WebCore::AccessibilityRenderObject::stringValue): (WebCore::AccessibilityRenderObject::isMathElement): (WebCore::AccessibilityRenderObject::isAnonymousMathOperator): (WebCore::AccessibilityRenderObject::isIgnoredElementWithinMathTree): * accessibility/AccessibilityRenderObject.h: * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (-[WebAccessibilityObjectWrapper role]): * rendering/mathml/RenderMathMLMath.h: * rendering/mathml/RenderMathMLOperator.h: (WebCore::RenderMathMLOperator::textContent): LayoutTests: One of the things making it difficult to tell that the operators were not exposed on the Mac is the fact that the operator text is present. But the operator text is simply a StaticTextRole object corresponding to the RenderText descendant of the operator. Furthermore, on the Mac, accessible math operators have subroles which are missing from the StaticTextRole object which is exposed. In order to make issues like this more obvious, add an option to include the subrole to dumpAccessibilityTree() and use it in the new math-fenced.html. This change also fixes the mfenced in mac/mathml-elements.html that was broken after r202420. We enable it again and update the expectations of that test because the operators are now in the accessibility tree. We also add a new test to verify the render tree of foreign content in MathML formulas. * accessibility/mac/mathml-elements-expected.txt: Updated. * accessibility/mac/mathml-elements.html: Re-enable the mfenced test. * accessibility/math-fenced.html: Added. * accessibility/math-foreign-content.html: Added. * platform/gtk/accessibility/math-fenced-expected.txt: Added. * platform/gtk/accessibility/math-foreign-content-expected.txt: Added. * platform/mac/accessibility/math-fenced-expected.txt: Added. * platform/mac/accessibility/math-foreign-content-expected.txt: Added. * resources/accessibility-helper.js: Add option to include subrole in tree. (dumpAccessibilityTree): Canonical link: https://commits.webkit.org/177250@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202497 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-06-27 17:57:49 +00:00
if (includeSubrole === true && accessibilityObject.subrole)
str += " " + accessibilityObject.subrole;
AX: [ATK] ARIA menu items should not have anonymous block children https://bugs.webkit.org/show_bug.cgi?id=144653 Reviewed by Chris Fleizach. Source/WebCore: Exclude anonymous block children of menu items from the accessible tree for ATK. Exclude list markers from the accessibility tree if the parent is not being exposed as an accessible list item. No new tests. Instead, modified the existing tests to reflect the correct behavior. * accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored): * accessibility/atk/AccessibilityObjectAtk.cpp: (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject): LayoutTests: The existing test was not cross-platform friendly and was rewritten as part of the fix for this bug. New expectations were generated for Mac, Efl, and Gtk. The shared expectations and the Windows expectations were removed so as not to break the Win port. The search-predicate test also was updated because it included an ARIA treeitem which had a listmarker child it should not have, and no longer has as a result of the bug fix. * accessibility/aria-menubar-menuitems-expected.txt: Removed. Platform hierarchies vary vastly. * accessibility/aria-menubar-menuitems.html: Rewritten to work better as a shared test. * platform/efl/accessibility/aria-menubar-menuitems-expected.txt: Added. * platform/gtk/accessibility/aria-menubar-menuitems-expected.txt: Added. * platform/mac/accessibility/aria-menubar-menuitems-expected.txt: Modified as result of rewrite. * platform/mac/accessibility/search-predicate.html: Modified to reflect correct treeitem children. * platform/mac/accessibility/search-predicate-expected.txt: Modified to reflect correct treeitem children. * platform/win/accessibility/aria-menubar-menuitems-expected.txt: Removed. New file should be generated. * resources/accessibility-helper.js: Added an argument so dumpAccessibilityTree can print title rather than value. (dumpAccessibilityTree): Canonical link: https://commits.webkit.org/162964@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184213 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-12 19:44:37 +00:00
str += " " + (getValueFromTitle === true ? accessibilityObject.title : accessibilityObject.stringValue);
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
str += allAttributesIfNeeded && accessibilityObject.role == '' ? accessibilityObject.allAttributes() : '';
str += "\n";
Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): Tools: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setIsolatedTreeMode): (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode. * WebKitTestRunner/InjectedBundle/AccessibilityController.h: * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Exposes setIsolatedTreeMode to JavaScript code so that it can be turned on and off in a layout tests. * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: Exposes isIsolatedObject to JavaScript code so that layout tests can check whether the underlying accessibility object is an AXIsolatedObject or an AXObject. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): Rename. * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::isIsolatedObject const): LayoutTests: * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added. * accessibility/mac/isolated-tree-mode-on-off.html: Added. * resources/accessibility-helper.js: (dumpAccessibilityTree): In addition to dumping the accessibility tree into an element with id="tree", it returns a string representation of the accessibility tree. Canonical link: https://commits.webkit.org/227932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-04 16:56:34 +00:00
var outputTree = document.getElementById("tree");
if (outputTree)
outputTree.innerText += str;
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
if (stopElement && stopElement.isEqual(accessibilityObject))
Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): Tools: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setIsolatedTreeMode): (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode. * WebKitTestRunner/InjectedBundle/AccessibilityController.h: * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Exposes setIsolatedTreeMode to JavaScript code so that it can be turned on and off in a layout tests. * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: Exposes isIsolatedObject to JavaScript code so that layout tests can check whether the underlying accessibility object is an AXIsolatedObject or an AXObject. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): Rename. * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::isIsolatedObject const): LayoutTests: * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added. * accessibility/mac/isolated-tree-mode-on-off.html: Added. * resources/accessibility-helper.js: (dumpAccessibilityTree): In addition to dumping the accessibility tree into an element with id="tree", it returns a string representation of the accessibility tree. Canonical link: https://commits.webkit.org/227932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-04 16:56:34 +00:00
return [false, str];
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
var count = accessibilityObject.childrenCount;
for (i = 0; i < count; ++i) {
Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): Tools: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setIsolatedTreeMode): (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode. * WebKitTestRunner/InjectedBundle/AccessibilityController.h: * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Exposes setIsolatedTreeMode to JavaScript code so that it can be turned on and off in a layout tests. * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: Exposes isIsolatedObject to JavaScript code so that layout tests can check whether the underlying accessibility object is an AXIsolatedObject or an AXObject. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): Rename. * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::isIsolatedObject const): LayoutTests: * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added. * accessibility/mac/isolated-tree-mode-on-off.html: Added. * resources/accessibility-helper.js: (dumpAccessibilityTree): In addition to dumping the accessibility tree into an element with id="tree", it returns a string representation of the accessibility tree. Canonical link: https://commits.webkit.org/227932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-04 16:56:34 +00:00
childRet = dumpAccessibilityTree(accessibilityObject.childAtIndex(i), stopElement, indent + 1, allAttributesIfNeeded, getValueFromTitle, includeSubrole);
if (!childRet[0])
return [false, str];
str += childRet[1];
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
}
Add the ability of comparing the accessibility tree with isolated tree mode on and off. https://bugs.webkit.org/show_bug.cgi?id=215000 Reviewed by Chris Fleizach. Source/WebCore: Test: accessibility/mac/isolated-tree-mode-on-off.html Added [WebAccessibilityObjectWrapper isIsolatedObject] for testing purposes, so that layout tests can determine whether an object is isolated or not. It should not be used by real clients since there should be no difference in behavior of a WebAccessibilityObjectWrapper from a client point of view, regardless the underlying object being isolated or not. * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (-[WebAccessibilityObjectWrapperBase isIsolatedObject]): Tools: * WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setIsolatedTreeMode): (WTR::AccessibilityController::setAccessibilityIsolatedTreeMode): Renamed setIsolatedTreeMode. * WebKitTestRunner/InjectedBundle/AccessibilityController.h: * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h: * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Exposes setIsolatedTreeMode to JavaScript code so that it can be turned on and off in a layout tests. * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl: Exposes isIsolatedObject to JavaScript code so that layout tests can check whether the underlying accessibility object is an AXIsolatedObject or an AXObject. * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::beginTesting): Rename. * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm: (WTR::AccessibilityUIElement::isIsolatedObject const): LayoutTests: * accessibility/mac/isolated-tree-mode-on-off-expected.txt: Added. * accessibility/mac/isolated-tree-mode-on-off.html: Added. * resources/accessibility-helper.js: (dumpAccessibilityTree): In addition to dumping the accessibility tree into an element with id="tree", it returns a string representation of the accessibility tree. Canonical link: https://commits.webkit.org/227932@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@265248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-04 16:56:34 +00:00
return [true, str];
buildAccessibilityTree() needs to be removed from individual layout tests https://bugs.webkit.org/show_bug.cgi?id=95286 Reviewed by Chris Fleizach. Extracted two functions to 'dump' and 'touch' the accessibility hierarchies out of different layout tests and into a single file, living in LayoutTests/resources/accessibility-helper.js * resources/accessibility-helper.js: Added. (dumpAccessibilityTree): New, based on buildAccessibilityTree() for the cases where it was used to actually 'dump' it into the output. (touchAccessibilityTree): Same, but for the cases where we don't want to dump the accessibility tree, just to make sure is generated. Updated affected layout tests to use the newly added helper functions. * accessibility/adjacent-continuations-cause-assertion-failure.html: Updated. * accessibility/children-changed-sends-notification.html: Ditto. * accessibility/deleting-iframe-destroys-axcache.html: Ditto. * accessibility/div-within-anchors-causes-crash.html: Ditto. * accessibility/first-letter-text-transform-causes-crash.html: Ditto. * accessibility/image-map-update-parent-crash.html: Ditto. * accessibility/table-with-empty-thead-causes-crash.html: Ditto. * platform/efl/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/entry-and-password.html: Ditto. * platform/gtk/accessibility/media-emits-object-replacement.html: Ditto. * platform/gtk/accessibility/replaced-objects-in-anonymous-blocks.html: Ditto. Updated Mac specific expectations not to print the "End of test" element. * platform/mac-wk2/accessibility/deleting-iframe-destroys-axcache-expected.txt: Updated. * platform/mac/accessibility/adjacent-continuations-cause-assertion-failure-expected.txt: Ditto. * platform/mac/accessibility/deleting-iframe-destroys-axcache-expected.txt: Ditto. * platform/mac/accessibility/div-within-anchors-causes-crash-expected.txt: Ditto. Canonical link: https://commits.webkit.org/152610@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-07-04 15:31:57 +00:00
}
function touchAccessibilityTree(accessibilityObject) {
var count = accessibilityObject.childrenCount;
for (var i = 0; i < count; ++i) {
if (!touchAccessibilityTree(accessibilityObject.childAtIndex(i)))
return false;
}
return true;
}
AX: Layout tests related to text alternative computation need to be done differently https://bugs.webkit.org/show_bug.cgi?id=157187 Create several utility methods to facilitate retrieval of platform-independent attribute values from platform-specific attributes: - platformValueForW3CName() and platformValueForW3CDescription() to retrieve a specific piece of text alternative information, stripping off the platform attribute name by default. These methods should make it possible to share tests and expectations files because the text alternative calculation defined by the W3C accessibility specifications should be the same for all platforms. (The differences are the result of the unique platform mappings.) - platformTextAlternatives() to dump out all the text alternative attributes and values, preserving the platform-specific attribute name. This, along with the use of the platformValue* methods with attribute name enabled, should make it possible to have shared tests with platform-specific expectations without the need to check the platform in the test itself. - platformRoleForComboBox() and platformRoleForStaticText() to eliminate the need for platform-specific expectations files simply because such an element happens to be included in the test file and verifying that element's role is desired. Begin using these methods in the tests related to text alternative computation which had platform-specific checks, update the expectations files when needed, and remove now-obsolete platform-specific expectations files. Reviewed by Chris Fleizach. * accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Updated. * accessibility/alt-tag-on-image-with-nonimage-role.html: Updated. * accessibility/aria-help-expected.txt: Added. * accessibility/aria-help.html: Updated. * accessibility/aria-label-expected.txt: Updated. * accessibility/aria-label.html: Updated. * accessibility/aria-labeled-with-hidden-node-expected.txt: Updated. * accessibility/aria-labeled-with-hidden-node.html: Updated. * accessibility/aria-labelledby-on-input-expected.txt: Updated. * accessibility/aria-labelledby-on-input.html: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Updated. * accessibility/aria-labelledby-overrides-aria-labeledby.html: Updated. * accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * accessibility/aria-labelledby-overrides-label.html: Updated. * accessibility/aria-labelledby-stay-within-expected.txt: Updated. * accessibility/aria-labelledby-stay-within.html: Updated. * accessibility/aria-labelledby-with-descendants-expected.txt: Updated. * accessibility/aria-labelledby-with-descendants.html: Updated. * accessibility/aria-namefrom-author-expected.txt: Updated. * accessibility/aria-namefrom-author.html: Updated. * accessibility/aria-text-role-expected.txt: Updated. * accessibility/aria-text-role.html: Updated. * accessibility/canvas-description-and-role-expected.txt: Updated. * accessibility/canvas-description-and-role.html: Updated. * accessibility/canvas-fallback-content.html: Updated. * accessibility/empty-image-with-title-expected.txt: Updated. * accessibility/empty-image-with-title.html: Updated. * accessibility/fieldset-element-expected.txt: Updated. * accessibility/fieldset-element.html: Updated. * accessibility/focusable-div-expected.txt: Updated. * accessibility/focusable-div.html: Updated. * accessibility/help-text.html: Updated. * accessibility/img-alt-tag-only-whitespace-expected.txt: Updated. * accessibility/img-alt-tag-only-whitespace.html: Updated. * accessibility/img-aria-button-alt-tag-expected.txt: Updated. * accessibility/img-aria-button-alt-tag.html: Updated. * accessibility/img-fallsback-to-title.html: Updated. * accessibility/input-image-alt-expected.txt: Updated. * accessibility/input-image-alt.html: Updated. * accessibility/loading-iframe-sends-notification.html: Updated. * accessibility/self-referencing-aria-labelledby-expected.txt: Updated. * accessibility/self-referencing-aria-labelledby.html: Updated. * accessibility/svg-bounds.html: Updated. * accessibility/svg-group-element-with-title-expected.txt: Updated. * accessibility/svg-group-element-with-title.html: Updated. * accessibility/svg-image-expected.txt: Updated. * accessibility/svg-image.html: Updated. * accessibility/svg-labelledby-expected.txt: Updated. * accessibility/svg-labelledby.html: Updated. * accessibility/svg-remote-element.html: Updated. * accessibility/w3c-svg-description-calculation.html: Updated. * accessibility/w3c-svg-name-calculation.html: Updated. * platform/gtk/accessibility/alt-tag-on-image-with-nonimage-role-expected.txt: Removed. * platform/gtk/accessibility/aria-labeled-with-hidden-node-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-on-input-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-aria-labeledby-expected.txt: Removed. * platform/gtk/accessibility/aria-labelledby-overrides-label-expected.txt: Updated. * platform/gtk/accessibility/aria-labelledby-with-descendants-expected.txt: Removed. * platform/gtk/accessibility/aria-namefrom-author-expected.txt: Removed. * platform/gtk/accessibility/aria-text-role-expected.txt: Removed. * platform/gtk/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/gtk/accessibility/empty-image-with-title-expected.txt: Updated. * platform/gtk/accessibility/fieldset-element-expected.txt: Removed. * platform/gtk/accessibility/focusable-div-expected.txt: Removed. * platform/gtk/accessibility/img-alt-tag-only-whitespace-expected.txt: Removed. * platform/gtk/accessibility/img-aria-button-alt-tag-expected.txt: Removed. * platform/gtk/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/gtk/accessibility/input-image-alt-expected.txt: Removed. * platform/gtk/accessibility/self-referencing-aria-labelledby-expected.txt: Removed. * platform/gtk/accessibility/svg-group-element-with-title-expected.txt: Removed. * platform/gtk/accessibility/svg-image-expected.txt: Removed. * platform/gtk/accessibility/svg-labelledby-expected.txt: Removed. * platform/mac/accessibility/aria-help-expected.txt: Removed. * platform/mac/accessibility/aria-labelledby-overrides-label-expected.txt: Removed. * platform/mac/accessibility/canvas-description-and-role-expected.txt: Updated. * platform/mac/accessibility/fieldset-element-expected.txt: Removed. * platform/mac/accessibility/img-fallsback-to-title-expected.txt: Updated. * platform/win/accessibility/canvas-description-and-role-expected.txt: Updated. * resources/accessibility-helper.js: (platformValueForW3CName): Added. (platformValueForW3CDescription): Added. (platformTextAlternatives): Added. (platformRoleForComboBox): Added. (platformRoleForStaticText): Added. Canonical link: https://commits.webkit.org/176061@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201216 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-05-20 18:34:14 +00:00
function platformValueForW3CName(accessibilityObject, includeSource=false) {
var result;
if (accessibilityController.platformName == "atk")
result = accessibilityObject.title
else
result = accessibilityObject.description
if (!includeSource) {
var splitResult = result.split(": ");
return splitResult[1];
}
return result;
}
function platformValueForW3CDescription(accessibilityObject, includeSource=false) {
var result;
if (accessibilityController.platformName == "atk")
result = accessibilityObject.description
else
result = accessibilityObject.helpText;
if (!includeSource) {
var splitResult = result.split(": ");
return splitResult[1];
}
return result;
}
function platformTextAlternatives(accessibilityObject, includeTitleUIElement=false) {
if (!accessibilityObject)
return "Element not exposed";
result = "\t" + accessibilityObject.title + "\n\t" + accessibilityObject.description;
if (accessibilityController.platformName == "mac")
result += "\n\t" + accessibilityObject.helpText;
if (includeTitleUIElement)
result += "\n\tAXTitleUIElement: " + (accessibilityObject.titleUIElement() ? "non-null" : "null");
return result;
}
function platformRoleForComboBox() {
return accessibilityController.platformName == "atk" ? "AXRole: AXComboBox" : "AXRole: AXPopUpButton";
}
function platformRoleForStaticText() {
return accessibilityController.platformName == "atk" ? "AXRole: AXStatic" : "AXRole: AXStaticText";
}
function spinnerForTextInput(accessibilityObject) {
var index = accessibilityController.platformName == "atk" ? 0 : 1;
return accessibilityObject.childAtIndex(index);
}
2020-07-10 01:27:19 +00:00
function waitFor(condition)
{
return new Promise((resolve, reject) => {
let interval = setInterval(() => {
if (condition()) {
clearInterval(interval);
resolve();
}
}, 0);
});
}