haikuwebkit/LayoutTests/mathml/tabindex-order.html

127 lines
5.4 KiB
HTML
Raw Permalink Normal View History

LayoutTests/imported/w3c: Implement MathMLIDL / HTMLOrForeignElement https://bugs.webkit.org/show_bug.cgi?id=200470 Patch by Rob Buis <rbuis@igalia.com> on 2019-09-06 Reviewed by Ryosuke Niwa. Add tests for functionality exposed by HTMLOrForeignElement. Import WPT tests as of 6e83b23bb962c97687b6573c378963208219ad1b (origin/master). * resources/import-expectations.json: * web-platform-tests/mathml/relations/html5-tree/class-1.html: * web-platform-tests/mathml/relations/html5-tree/class-2.html: * web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative-expected.txt: Added. * web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html: Added. * web-platform-tests/mathml/relations/html5-tree/color-attributes-1.html: * web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative-expected.html: Added. * web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html: Added. * web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative-expected.txt: Added. * web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html: Added. * web-platform-tests/mathml/relations/html5-tree/display-1-expected.txt: * web-platform-tests/mathml/relations/html5-tree/display-1.html: * web-platform-tests/mathml/relations/html5-tree/dynamic-1.html: * web-platform-tests/mathml/relations/html5-tree/href-click-1.html: * web-platform-tests/mathml/relations/html5-tree/href-click-2.html: * web-platform-tests/mathml/relations/html5-tree/href-click-3.html: * web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative-expected.txt: Added. * web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html: Added. * web-platform-tests/mathml/relations/html5-tree/integration-point-1.html: * web-platform-tests/mathml/relations/html5-tree/integration-point-2.html: * web-platform-tests/mathml/relations/html5-tree/integration-point-3.html: * web-platform-tests/mathml/relations/html5-tree/integration-point-4-expected.txt: Added. * web-platform-tests/mathml/relations/html5-tree/integration-point-4.html: Added. * web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative-expected.txt: Added. * web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html: Added. * web-platform-tests/mathml/relations/html5-tree/required-extensions-1-expected.txt: Removed. * web-platform-tests/mathml/relations/html5-tree/required-extensions-1.html: Removed. * web-platform-tests/mathml/relations/html5-tree/required-extensions-2.html: * web-platform-tests/mathml/relations/html5-tree/unique-identifier-1.html: * web-platform-tests/mathml/relations/html5-tree/unique-identifier-2.html: * web-platform-tests/mathml/relations/html5-tree/unique-identifier-3.html: * web-platform-tests/mathml/relations/html5-tree/w3c-import.log: * web-platform-tests/mathml/support/attribute-values.js: Added. (AttributeValueTransforms.lowercase): (AttributeValueTransforms.uppercase): (AttributeValueTransforms.alternate_case): (TransformAttributeValues): * web-platform-tests/mathml/support/box-comparison.js: Added. (spaceBetween): (measureSpaceAround): (compareSpaceWithAndWithoutStyle): (compareSizeWithAndWithoutStyle): * web-platform-tests/mathml/support/layout-comparison.js: Added. (getWritingMode): (compareSize): (participateToParentLayout): (childrenParticipatingToLayout): (compareLayout): * web-platform-tests/mathml/support/mathml-fragments.js: Added. (FragmentHelper.createElement): (FragmentHelper.isValidChildOfMrow): (FragmentHelper.isEmpty): (FragmentHelper.element): (FragmentHelper.appendChild): (FragmentHelper.forceNonEmptyElement): * web-platform-tests/mathml/support/w3c-import.log: Added. Source/WebCore: Implement MathML DOM https://bugs.webkit.org/show_bug.cgi?id=200470 Patch by Rob Buis <rbuis@igalia.com> on 2019-09-06 Reviewed by Ryosuke Niwa. Expose MathML DOM as specified here [1]. [1] https://mathml-refresh.github.io/mathml-core/#dom-mathmlelement Tests: imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html mathml/focus-event-handling.html mathml/tabindex-order.html * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSElementCustom.cpp: (WebCore::createNewElementWrapper): * bindings/js/JSNodeCustom.cpp: (WebCore::createWrapperInline): * mathml/MathMLElement.cpp: (WebCore::MathMLElement::parseAttribute): * mathml/MathMLElement.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl. * mathml/MathMLMathElement.idl: Copied from Source/WebCore/html/HTMLOrForeignElement.idl. * mathml/mathtags.in: LayoutTests: Implement MathML DOM https://bugs.webkit.org/show_bug.cgi?id=200470 Patch by Rob Buis <rbuis@igalia.com> on 2019-09-06 Reviewed by Ryosuke Niwa. Extend existing tests to also test focus for MathML. Add a standalone test for MathML based on svg/custom/tabindex-order.html. Add a test for mouse clicks and focus handling based on svg/custom/focus-event-handling.xhtml. * fast/dom/tabindex-defaults-expected.txt: * fast/dom/tabindex-defaults.html: * mathml/focus-event-handling-expected.txt: Added. * mathml/focus-event-handling.html: Added. * mathml/tabindex-order-expected.txt: Added. * mathml/tabindex-order.html: Added. * platform/ios-wk2/TestExpectations: Canonical link: https://commits.webkit.org/215172@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249572 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-06 12:27:54 +00:00
<!DOCTYPE html>
<html>
<head>
<script>
function log(msg)
{
document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
}
function dispatchTabPress(element, shiftKey)
{
var event = document.createEvent('KeyboardEvents');
var tabKeyIdentifier = 'U+0009';
event.initKeyboardEvent('keydown', true, true, document.defaultView, tabKeyIdentifier, 0, false, false, shiftKey, false, false);
element.dispatchEvent(event);
}
var lastFocusedElement = null;
function focusListener(event)
{
log('id: ' + event.target.id + ' tabindex: ' + event.target.tabIndex + ' ' + event.target.nodeName + ' is focused.');
lastFocusedElement = event.target;
}
function addEventListenersToElements(elements)
{
for (const element of elements)
element.addEventListener('focus', focusListener, false);
}
function test()
{
if (window.testRunner)
testRunner.dumpAsText();
document.activeElement.blur();
var elements = document.getElementsByClassName('tab');
// Put focus in the page
elements[0].focus();
elements[0].blur();
addEventListenersToElements(elements);
log('Tabbing forward....\n');
dispatchTabPress(document, false);
for (const element of elements) {
dispatchTabPress(document, false);
if (document.activeElement.id == 'a')
break;
}
lastFocusedElement.blur();
log('\nTabbing backward....\n');
dispatchTabPress(document, true);
for (const element of elements) {
dispatchTabPress(document, true);
if (document.activeElement.id == 'y')
break;
}
log('\nTest finished\n');
}
</script>
</head>
<body onload="test()">
<p>This page tests that the MathML tabbing order is respected properly.</p>
<p>To test, put focus in &quot;a&quot;. Pressing Tab should focus &quot;a&quot; through &quot;y&quot; in order, and pressing Shift-Tab should reverse the order.</p>
<math>
<mspace class="tab" tabindex="6" id="g" width="1" height="1"/>
<mspace class="tab" id="mspace without tabindex is not focusable" width="1" height="1"/>
<mfrac class="tab" tabindex="1" id="a"/>
<mfrac class="tab" id="mfrac without tabindex is not focusable"/>
<mspace class="tab" tabindex="-5" id="not in tab order (negative tabindex)" width="1" height="1"/>
<mrow class="tab" tabindex="1" id="b"/>
<mrow class="tab" id="mrow without tabindex is not focusable"/>
<math class="tab" tabindex="0" id="i"/>
<mtext class="tab" tabindex="6" id="h"/>
<mtext class="tab" id="mtext without tabindex is not focusable"/>
<mpadded class="tab" tabindex="1" id="c"/>
<mpadded class="tab" id="mpadded without tabindex is not focusable"/>
<msqrt class="tab" tabindex="1" id="d"/>
<msqrt class="tab" id="msqrt without tabindex is not focusable"/>
<mroot class="tab" tabindex="1" id="e"/>
<mroot class="tab" id="mroot without tabindex is not focusable"/>
<mover class="tab" tabindex="0" id="j"/>
<mover class="tab" id="mover without tabindex is not focusable"/>
<mspace class="tab" tabindex="-1" id="not in tab order (negative tabindex)"/>
<munder class="tab" tabindex="0" id="k"/>
<munder class="tab" id="munder without tabindex is not focusable"/>
<munderover class="tab" tabindex="0" id="l"/>
<munderover class="tab" id="munderover without tabindex is not focusable"/>
<msub class="tab" tabindex="0" id="m"/>
<msub class="tab" id="msub without tabindex is not focusable"/>
<msup class="tab" tabindex="0" id="n"/>
<msup class="tab" id="msup without tabindex is not focusable"/>
<msubsup class="tab" tabindex="0" id="o"/>
<msubsup class="tab" id="msubsup without tabindex is not focusable"/>
<mmultiscripts class="tab" tabindex="0" id="p"/>
<mmultiscripts class="tab" id="mmultiscripts without tabindex is not focusable"/>
<menclose class="tab" tabindex="0" id="q"/>
<menclose class="tab" id="menclose without tabindex is not focusable"/>
<mphantom class="tab" tabindex="0" id="r"/>
<mphantom class="tab" id="mphantom without tabindex is not focusable"/>
<mstyle class="tab" tabindex="0" id="s"/>
<mstyle class="tab" id="mstyle without tabindex is not focusable"/>
<merror class="tab" tabindex="0" id="t"/>
<merror class="tab" id="merror without tabindex is not focusable"/>
<mtable class="tab" tabindex="0" id="u"/>
<mtable class="tab" id="mtable without tabindex is not focusable"/>
<ms class="tab" tabindex="0" id="v"/>
<ms class="tab" id="ms without tabindex is not focusable"/>
<mi class="tab" tabindex="0" id="w"/>
<mi class="tab" id="mi without tabindex is not focusable"/>
<mo class="tab" tabindex="0" id="x"/>
<mo class="tab" id="mo without tabindex is not focusable"/>
<mn class="tab" tabindex="0" id="y"/>
<mn class="tab" id="mn without tabindex is not focusable"/>
</math>
<pre id="log"></pre>
</body>
</html>