haikuwebkit/LayoutTests/mathml/focus-event-handling.html

103 lines
3.1 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
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/ui-helper.js"></script>
</head>
<body>
<math style="background-color: green">
<mspace id="space1" width="100px" depth="50px" height="50px"/>
<mrow id="row">
<mspace id="space2" width="100px" depth="50px" height="50px"/>
</mrow>
<mfrac id="fraction">
<mspace width="100px" depth="50px"/>
<mspace width="100px" depth="50px"/>
</mfrac>
<mtext id="text" style="font-size:20px">TEST</mtext>
</math>
<p id="description"></p>
<div id="console"></div>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
var focusSeen = "";
var blurSeen = "";
var spaceElement = document.getElementById("space1");
var rowElement = document.getElementById("row");
var fractionElement = document.getElementById("fraction");
var textElement = document.getElementById("text");
function clearFocusSeen()
{
focusSeen = "";
blurSeen = "";
}
function focusHandler(evt)
{
focusSeen = evt.target.getAttribute('id');
}
function blurHandler(evt)
{
blurSeen = evt.target.getAttribute('id');
}
addEventListener("load", async () => {
description("Test whether focus and blur events are dispatched and seen in the focus/blur event handlers: ");
spaceElement.tabIndex = 0;
spaceElement.addEventListener("focus", focusHandler, false);
spaceElement.addEventListener("blur", blurHandler, false);
rowElement.tabIndex = 0;
rowElement.addEventListener("focus", focusHandler, false);
rowElement.addEventListener("blur", blurHandler, false);
fractionElement.tabIndex = 0;
fractionElement.addEventListener("focus", focusHandler, false);
fractionElement.addEventListener("blur", blurHandler, false);
textElement.tabIndex = 0;
textElement.addEventListener("focus", focusHandler, false);
textElement.addEventListener("blur", blurHandler, false);
// cause focus and blur
await UIHelper.activateAt(50, 50);
await UIHelper.activateAt(150, 250);
shouldBeEqualToString('focusSeen', 'space1');
shouldBeEqualToString('blurSeen', 'space1');
clearFocusSeen();
// cause focus and blur
await UIHelper.activateAt(150, 50);
await UIHelper.activateAt(150, 250);
shouldBeEqualToString('focusSeen', 'row');
shouldBeEqualToString('blurSeen', 'row');
clearFocusSeen();
// cause focus and blur
await UIHelper.activateAt(250, 50);
await UIHelper.activateAt(150, 250);
shouldBeEqualToString('focusSeen', 'fraction');
shouldBeEqualToString('blurSeen', 'fraction');
clearFocusSeen();
// cause focus and blur
await UIHelper.activateAt(350, 50);
await UIHelper.activateAt(150, 250);
shouldBeEqualToString('focusSeen', 'text');
shouldBeEqualToString('blurSeen', 'text');
successfullyParsed = true;
testRunner.notifyDone();
});
</script>
</body>
</html>