LayoutTests/imported/w3c:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Sep 2019 12:27:54 +0000 (12:27 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 6 Sep 2019 12:27:54 +0000 (12:27 +0000)
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:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249572 268f45cc-cd09-0410-ab3c-d52691b4dbfc

59 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/tabindex-defaults-expected.txt
LayoutTests/fast/dom/tabindex-defaults.html
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/resources/import-expectations.json
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/class-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/class-2.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/color-attributes-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative-expected.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/display-1-expected.txt
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/display-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/dynamic-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-2.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-3.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-2.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-3.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative-expected.txt [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1-expected.txt [deleted file]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1.html [deleted file]
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-2.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/unique-identifier-1.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/unique-identifier-2.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/unique-identifier-3.html
LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/mathml/support/attribute-values.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/support/box-comparison.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/support/layout-comparison.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/support/mathml-fragments.js [new file with mode: 0644]
LayoutTests/imported/w3c/web-platform-tests/mathml/support/w3c-import.log [new file with mode: 0644]
LayoutTests/mathml/focus-event-handling-expected.txt [new file with mode: 0644]
LayoutTests/mathml/focus-event-handling.html [new file with mode: 0644]
LayoutTests/mathml/tabindex-order-expected.txt [new file with mode: 0644]
LayoutTests/mathml/tabindex-order.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/TestExpectations
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources-input.xcfilelist
Source/WebCore/DerivedSources-output.xcfilelist
Source/WebCore/DerivedSources.make
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSElementCustom.cpp
Source/WebCore/bindings/js/JSNodeCustom.cpp
Source/WebCore/mathml/MathMLElement.cpp
Source/WebCore/mathml/MathMLElement.idl [new file with mode: 0644]
Source/WebCore/mathml/MathMLMathElement.idl [new file with mode: 0644]
Source/WebCore/mathml/mathtags.in

index b18b769..cda25f6 100644 (file)
@@ -1,3 +1,22 @@
+2019-09-06  Rob Buis  <rbuis@igalia.com>
+
+        Implement MathML DOM
+        https://bugs.webkit.org/show_bug.cgi?id=200470
+
+        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:
+
 2019-09-05  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Crashes when intercept response is a 404
index 4a0e87e..b8d993a 100644 (file)
@@ -22,6 +22,7 @@ PASS videoWithControls.tabIndex is -1
 PASS summary.tabIndex is -1
 PASS bodyInDesignMode.tabIndex is -1
 PASS g.tabIndex is -1
+PASS mrow.tabIndex is -1
 PASS anchor.setAttribute("tabindex", "invalid"); anchor.tabIndex is 0
 PASS iframe.setAttribute("tabindex", "invalid"); iframe.tabIndex is 0
 PASS frame.setAttribute("tabindex", "invalid"); frame.tabIndex is 0
@@ -41,6 +42,7 @@ PASS videoWithControls.setAttribute("tabindex", "invalid"); videoWithControls.ta
 PASS summary.setAttribute("tabindex", "invalid"); summary.tabIndex is -1
 PASS bodyInDesignMode.setAttribute("tabindex", "invalid"); bodyInDesignMode.tabIndex is -1
 PASS g.setAttribute("tabindex", "invalid"); g.tabIndex is -1
+PASS mrow.setAttribute("tabindex", "invalid"); mrow.tabIndex is -1
 PASS anchor.setAttribute("tabindex", "9999999999"); anchor.tabIndex is 0
 PASS iframe.setAttribute("tabindex", "9999999999"); iframe.tabIndex is 0
 PASS frame.setAttribute("tabindex", "9999999999"); frame.tabIndex is 0
@@ -60,6 +62,7 @@ PASS videoWithControls.setAttribute("tabindex", "9999999999"); videoWithControls
 PASS summary.setAttribute("tabindex", "9999999999"); summary.tabIndex is -1
 PASS bodyInDesignMode.setAttribute("tabindex", "9999999999"); bodyInDesignMode.tabIndex is -1
 PASS g.setAttribute("tabindex", "9999999999"); g.tabIndex is -1
+PASS mrow.setAttribute("tabindex", "9999999999"); mrow.tabIndex is -1
 PASS successfullyParsed is true
 
 TEST COMPLETE
index fd75b22..8af22e5 100644 (file)
@@ -26,6 +26,7 @@
 <details><summary></summary><summary id="summary"></summary></details>
 <iframe id="iframeForDesignMode"></iframe>
 <svg><g id="g" onfocus="alert('fail')"></g></svg>
+<math><mrow id="mrow" onfocus="alert('fail')"></mrow></math>
 </div>
 
 <script>
@@ -54,6 +55,7 @@ var iframeForDesignMode = document.getElementById('iframeForDesignMode');
 iframeForDesignMode.contentDocument.designMode = 'on';
 var bodyInDesignMode = iframeForDesignMode.contentDocument.body;
 var g = document.getElementById('g');
+var mrow = document.getElementById('mrow');
 
 shouldBe('anchor.tabIndex', '0');
 shouldBe('iframe.tabIndex', '0');
@@ -74,6 +76,7 @@ shouldBe('videoWithControls.tabIndex', '-1');
 shouldBe('summary.tabIndex', '-1');
 shouldBe('bodyInDesignMode.tabIndex', '-1');
 shouldBe('g.tabIndex', '-1');
+shouldBe('mrow.tabIndex', '-1');
 
 shouldBe('anchor.setAttribute("tabindex", "invalid"); anchor.tabIndex', '0');
 shouldBe('iframe.setAttribute("tabindex", "invalid"); iframe.tabIndex', '0');
@@ -94,6 +97,7 @@ shouldBe('videoWithControls.setAttribute("tabindex", "invalid"); videoWithContro
 shouldBe('summary.setAttribute("tabindex", "invalid"); summary.tabIndex', '-1');
 shouldBe('bodyInDesignMode.setAttribute("tabindex", "invalid"); bodyInDesignMode.tabIndex', '-1');
 shouldBe('g.setAttribute("tabindex", "invalid"); g.tabIndex', '-1');
+shouldBe('mrow.setAttribute("tabindex", "invalid"); mrow.tabIndex', '-1');
 
 shouldBe('anchor.setAttribute("tabindex", "9999999999"); anchor.tabIndex', '0');
 shouldBe('iframe.setAttribute("tabindex", "9999999999"); iframe.tabIndex', '0');
@@ -114,6 +118,7 @@ shouldBe('videoWithControls.setAttribute("tabindex", "9999999999"); videoWithCon
 shouldBe('summary.setAttribute("tabindex", "9999999999"); summary.tabIndex', '-1');
 shouldBe('bodyInDesignMode.setAttribute("tabindex", "9999999999"); bodyInDesignMode.tabIndex', '-1');
 shouldBe('g.setAttribute("tabindex", "9999999999"); g.tabIndex', '-1');
+shouldBe('mrow.setAttribute("tabindex", "9999999999"); mrow.tabIndex', '-1');
 
 document.getElementById('container').innerHTML = '';
 </script>
index 15dcf68..768ce56 100644 (file)
@@ -1,3 +1,70 @@
+2019-09-06  Rob Buis  <rbuis@igalia.com>
+
+        Implement MathMLIDL / HTMLOrForeignElement
+        https://bugs.webkit.org/show_bug.cgi?id=200470
+
+        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.
+
 2019-09-05  Chris Dumez  <cdumez@apple.com>
 
         Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in imported/w3c/IndexedDB-private-browsing
index 664b96a..088df76 100644 (file)
     "web-platform-tests/longtask-timing": "skip", 
     "web-platform-tests/magnetometer": "skip", 
     "web-platform-tests/mathml": "import", 
+    "web-platform-tests/mathml/relations/html5-tree": "import", 
     "web-platform-tests/media-capabilities": "skip", 
     "web-platform-tests/media-source": "import", 
     "web-platform-tests/mediacapture-image": "skip", 
     "web-platform-tests/worklets": "skip", 
     "web-platform-tests/x-frame-options": "skip", 
     "web-platform-tests/xhr": "import"
-}
\ No newline at end of file
+}
index ee4b4b5..a1efbd2 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8"/>
 <title>Class</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
 <link rel="match" href="class-1-ref.html"/>
 <meta name="assert" content="Verify that the class attribute affects CSS selectors.">
 <style>
index 4e1ae6b..8d6515a 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8">
 <title>Class</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript">
 <meta name="assert" content="Verify whether the getElementsByClassName() works for MathML elements.">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative-expected.txt
new file mode 100644 (file)
index 0000000..022c886
--- /dev/null
@@ -0,0 +1,9 @@
+
+PASS math.addEventListener for copy 
+FAIL oncopy: the content attribute must be compiled into a function as the corresponding property assert_true: Calling the handler must run the code expected true got undefined
+PASS math.addEventListener for cut 
+FAIL oncut: the content attribute must be compiled into a function as the corresponding property assert_true: Calling the handler must run the code expected true got undefined
+PASS math.addEventListener for paste 
+FAIL onpaste: the content attribute must be compiled into a function as the corresponding property assert_true: Calling the handler must run the code expected true got undefined
+E
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html
new file mode 100644 (file)
index 0000000..0031004
--- /dev/null
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<title>DocumentAndElementEventHandlers / clipboard events for MathML</title>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#documentandelementeventhandlers"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-copy"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-cut"/>
+<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-paste"/>
+<meta
+  name="assert"
+  content="MathMLElements incorporate a functional DocumentAndElementEventHandlers interface"
+/>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<math
+  oncopy="document.copyHappened = true"
+  oncut="document.cutHappened = true"
+  onpaste="document.pasteHappened = true"
+>
+  <mi>E</mi>
+</math>
+<script>
+  const EVENTS = ["copy", "cut", "paste"];
+  const el = document.querySelector("math");
+
+  function addEventListenerTest(name) {
+    async_test(test => {
+      el.addEventListener(
+        name,
+        test.step_func_done(e => {
+          assert_true(
+            true,
+            "MathML Elements should be able to receive ${name} events"
+          );
+        })
+      );
+      const event = new ClipboardEvent(name, {
+        bubbles: true,
+        cancellable: true
+      });
+      el.dispatchEvent(event);
+    }, `math.addEventListener for ${name}`);
+  }
+
+  function evaluatedHandlerTest(name) {
+    const handlerName = "on" + name;
+
+    test(() => {
+      const compiledHandler = el[handlerName];
+
+      assert_equals(
+        typeof compiledHandler,
+        "function",
+        `The ${handlerName} property must be a function`
+      );
+      compiledHandler();
+      assert_true(
+        window[name + "Happened"],
+        "Calling the handler must run the code"
+      );
+    }, `${handlerName}: the content attribute must be compiled into a function as the corresponding property`);
+  }
+
+  EVENTS.forEach(name => {
+    addEventListenerTest(name);
+    evaluatedHandlerTest(name);
+  });
+</script>
index 6f9f937..585aeba 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8"/>
 <title>Color Attributes</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#legacy-mathml-style-attributes">
 <meta name="assert" content="Verify that the mathcolor and mathbackground attributes are supported on the math element.">
 <link rel="match" href="color-attributes-1-ref.html"/>
 <style>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative-expected.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative-expected.html
new file mode 100644 (file)
index 0000000..13f0139
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML 'ElementCSSInlineStyle` Dynamic Tests</title>
+</head>
+<body>
+  <span>This tests that `ElementCSSInlineStyle` interface changes update rendering.</span>
+  <div>
+    <math style="background-color: green"><mspace width="50px" height="100px"/><mspace width="50px" height="100px"/></math>
+  </div>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html
new file mode 100644 (file)
index 0000000..ca3e679
--- /dev/null
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+  <head>
+    <meta charset="utf-8" />
+    <title>MathML 'ElementCSSInlineStyle` Dynamic Tests</title>
+    <link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
+    <link rel="match" href="css-inline-style-dynamic.tentative-ref.html"/>
+    <style>
+      #hidden  {
+        visibility: hidden;
+        background-color: green;
+      }
+      #red  {
+        background-color: red;
+      }
+    </style>
+    <meta
+      name="assert"
+      content="MathMLElements ElementCSSInlineStyle interface changes update rendering"
+    />
+    <script type="text/javascript">
+      function test()
+      {
+        document.body.offsetTop; // Update layout
+        document.getElementById("hidden").style.visibility = "visible";
+        document.getElementById("red").style.backgroundColor = "green";
+        document.documentElement.className = "";
+      }
+    </script>
+  </head>
+  <body onload="test()">
+    <span>This tests that `ElementCSSInlineStyle` interface changes update rendering.</span>
+    <div>
+      <math><mspace width="50px" height="100px" id="hidden"/><mspace width="50px" height="100px" id="red"/></math>
+    </div>
+  </body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative-expected.txt
new file mode 100644 (file)
index 0000000..b4e1250
--- /dev/null
@@ -0,0 +1,35 @@
+This tests the presence and functionality of features of the `ElementCSSInlineStyle` interface for MathMLElements 
+
+PASS The <math> element style property should be present and be functional. 
+PASS The annotation's style property should be present and be functional. 
+PASS The annotation-xml's style property should be present and be functional. 
+PASS The maction's style property should be present and be functional. 
+PASS The menclose's style property should be present and be functional. 
+PASS The merror's style property should be present and be functional. 
+PASS The mfrac's style property should be present and be functional. 
+PASS The mi's style property should be present and be functional. 
+PASS The mmultiscripts's style property should be present and be functional. 
+PASS The mn's style property should be present and be functional. 
+PASS The mo's style property should be present and be functional. 
+PASS The mover's style property should be present and be functional. 
+PASS The mpadded's style property should be present and be functional. 
+PASS The mphantom's style property should be present and be functional. 
+PASS The mprescripts's style property should be present and be functional. 
+PASS The mroot's style property should be present and be functional. 
+PASS The mrow's style property should be present and be functional. 
+PASS The ms's style property should be present and be functional. 
+PASS The mspace's style property should be present and be functional. 
+PASS The msqrt's style property should be present and be functional. 
+PASS The mstyle's style property should be present and be functional. 
+PASS The msub's style property should be present and be functional. 
+PASS The msubsup's style property should be present and be functional. 
+PASS The msup's style property should be present and be functional. 
+PASS The mtable's style property should be present and be functional. 
+PASS The mtd's style property should be present and be functional. 
+PASS The mtext's style property should be present and be functional. 
+PASS The mtr's style property should be present and be functional. 
+PASS The munder's style property should be present and be functional. 
+PASS The munderover's style property should be present and be functional. 
+PASS The none's style property should be present and be functional. 
+PASS The semantics's style property should be present and be functional. 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html
new file mode 100644 (file)
index 0000000..b82f98e
--- /dev/null
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <title>MathML 'ElementCSSInlineStyle` Mixin Tests</title>
+    <link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
+    <style>
+      math * {
+        background-color: red;
+      }
+    </style>
+    <meta
+      name="assert"
+      content="MathMLElements incorporate a functional ElementCSSInlineStyle interface"
+    />
+    <script src="/mathml/support/mathml-fragments.js"></script>
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body>
+    <span
+      >This tests the presence and functionality of features of the
+      `ElementCSSInlineStyle` interface for MathMLElements</span
+    >
+    <math></math>
+    <script>
+      let mathEl = document.querySelector("math");
+
+      test(function() {
+        mathEl.style.backgroundColor = "lime";
+        assert_equals(
+          getComputedStyle(mathEl).backgroundColor,
+          "rgb(0, 255, 0)",
+          "The applied background should be green."
+        );
+      }, `The <math> element style property should be present and be functional.`);
+
+      Object.keys(MathMLFragments).forEach(elName => {
+        mathEl.innerHTML = MathMLFragments[elName];
+
+        test(function() {
+          let el = FragmentHelper.element(mathEl);
+          el.style.backgroundColor = "blue";
+
+          assert_equals(
+            getComputedStyle(el).backgroundColor,
+            "rgb(0, 0, 255)",
+            "The applied background should be blue."
+          );
+        }, `The ${elName}'s style property should be present and be functional.`);
+      });
+    </script>
+  </body>
+</html>
index 06f5347..64419a6 100644 (file)
@@ -1,6 +1,11 @@
 
-PASS Test display math 
-PASS Test inline math 
+PASS Test display math lowercase 
+PASS Test inline math lowercase 
+FAIL Test display math uppercase assert_approx_equals: math must be centered. expected 308 +/- 1 but got 87
+PASS Test inline math uppercase 
+FAIL Test display math alternate_case assert_approx_equals: math must be centered. expected 308 +/- 1 but got 87
+PASS Test inline math alternate_case 
  
+  
  
  
index 77038ee..9ecd45f 100644 (file)
@@ -3,54 +3,61 @@
 <head>
 <meta charset="utf-8"/>
 <title>MathML display attribute</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#the-top-level-math-element">
 <meta name="assert" content="Verify that the display attribute on the math element is supported and impacts centering and line breaking with surrounding content.">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
+<script src="/mathml/support/feature-detection.js"></script>
+<script src="/mathml/support/attribute-values.js"></script>
 <script>
   function getBox(aId) {
     return document.getElementById(aId).getBoundingClientRect();
   }
   window.addEventListener("DOMContentLoaded", function() {
-    var content = getBox("content");
+      for (transform in AttributeValueTransforms) {
+          TransformAttributeValues(transform, ["display", "displaystyle"]);
+          var content = getBox("content");
 
-    var before_block = getBox("before_block");
-    var mspace_block = getBox("mspace_block");
-    var after_block = getBox("after_block");
-    test(function() {
-      assert_approx_equals(before_block.left, content.left, 1,
-                           "content before must be left aligned");
-      assert_approx_equals((mspace_block.left + mspace_block.right) / 2,
-                           (content.left + content.right) / 2,
-                           1,
-                           "math must be centered.");
-      assert_approx_equals(after_block.left, content.left, 1,
-                           "content before must be left aligned");
-      assert_less_than_equal(before_block.bottom, mspace_block.top,
-                            "new line before math");
-      assert_less_than_equal(mspace_block.bottom, after_block.top,
-                            "new line after math");
-    }, "Test display math");
+          var before_block = getBox("before_block");
+          var mspace_block = getBox("mspace_block");
+          var after_block = getBox("after_block");
+          test(function() {
+              assert_true(MathMLFeatureDetection.has_mspace());
+              assert_approx_equals(before_block.left, content.left, 1,
+                                   "content before must be left aligned");
+              assert_approx_equals((mspace_block.left + mspace_block.right) / 2,
+                                   (content.left + content.right) / 2,
+                                   1,
+                                   "math must be centered.");
+              assert_approx_equals(after_block.left, content.left, 1,
+                                   "content before must be left aligned");
+              assert_less_than_equal(before_block.bottom, mspace_block.top,
+                                     "new line before math");
+              assert_less_than_equal(mspace_block.bottom, after_block.top,
+                                     "new line after math");
+          }, `Test display math ${transform}`);
 
-    var before_inline = getBox("before_inline");
-    var mspace_inline = getBox("mspace_inline");
-    var after_inline = getBox("after_inline");
-    test(function() {
-      assert_approx_equals((before_inline.top + before_inline.bottom) / 2,
-                           (mspace_inline.top + mspace_inline.bottom) / 2,
-                           1,
-                           "content before must be horizontally aligned with math");
-      assert_approx_equals((after_inline.top + after_inline.bottom) / 2,
-                           (mspace_inline.top + mspace_inline.bottom) / 2,
-                           1,
-                           "content after must be horizontally aligned with math");
-      assert_less_than_equal(before_inline.right, mspace_inline.left,
-                            "content before must be on the left of math");
-      assert_less_than_equal(mspace_inline.right, after_inline.left,
-                            "content after must be on the right of math");
-    }, "Test inline math");
-
-    done();
+          var before_inline = getBox("before_inline");
+          var mspace_inline = getBox("mspace_inline");
+          var after_inline = getBox("after_inline");
+          test(function() {
+              assert_true(MathMLFeatureDetection.has_mspace());
+              assert_approx_equals((before_inline.top + before_inline.bottom) / 2,
+                                   (mspace_inline.top + mspace_inline.bottom) / 2,
+                                   1,
+                                   "content before must be horizontally aligned with math");
+              assert_approx_equals((after_inline.top + after_inline.bottom) / 2,
+                                   (mspace_inline.top + mspace_inline.bottom) / 2,
+                                   1,
+                                   "content after must be horizontally aligned with math");
+              assert_less_than_equal(before_inline.right, mspace_inline.left,
+                                     "content before must be on the left of math");
+              assert_less_than_equal(mspace_inline.right, after_inline.left,
+                                     "content after must be on the right of math");
+          }, `Test inline math ${transform}`);
+      }
+      done();
   });
 </script>
 <style>
@@ -65,7 +72,7 @@
     background: black;
   }
   mspace {
-    background: black;
+    background: blue;
   }
 </style>
 </head>
index 48fdd25..b4d603a 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>Dynamic MathML DOM</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
 <link rel="match" href="dynamic-1-ref.html"/>
 <meta name="assert" content="Verify that the MathML DOM tree can be modified via javascript and that the rendering is correctly updated.">
 <style>
index dd6b799..bf902b5 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8"/>
 <title>href click</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript">
 <link rel="match" href="href-click-1-ref.html"/>
 <meta name="assert" content="Verify that a click on a link moves to the target.">
 <script type="text/javascript">
index 4c5253d..c23d87c 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8"/>
 <title>href click</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript">
 <link rel="match" href="href-click-2-ref.html"/>
 <meta name="assert" content="Verify that a click on an element bubbles to an ancestor link.">
 <script type="text/javascript">
index f2863fe..a8475ea 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8">
 <title>href click</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="/resources/testdriver.js"></script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative-expected.txt
new file mode 100644 (file)
index 0000000..e4e2909
--- /dev/null
@@ -0,0 +1,9 @@
+This tests the presence and functionality of features of `HTMLOrForeignElement` (currently `HTMLOrSVGElement`) 
+E
+
+PASS MathML elements should have a .dataset 
+PASS The dataset property should be present and be functional. 
+PASS MathML elements should have a tabIndex property 
+PASS MathML elements should work with focus predictably 
+PASS MathML elements should work with blur predictably 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html
new file mode 100644 (file)
index 0000000..bf4b998
--- /dev/null
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <meta charset="utf-8" />
+    <title>MathML 'HTMLOrForeignElement` Mixin Tests</title>
+    <link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
+    <style>
+      mi {
+        background-color: red;
+      }
+      :focus {
+        background-color: rgb(0, 255, 0);
+      }
+    </style>
+    <meta
+      name="assert"
+      content="MathMLElements incorporate a functional HTMLOrForeignElement interface"
+    />
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+  <body tabindex="-1">
+    <span tabindex="-1"
+      >This tests the presence and functionality of features of
+      `HTMLOrForeignElement` (currently `HTMLOrSVGElement`)</span
+    >
+    <math tabindex="-1">
+      <mi>E</mi>
+    </math>
+  </body>
+  <script>
+    // spot check the functionality of several interfaces
+    let el = document.querySelector("mi");
+    let mathEl = document.querySelector("math");
+
+    // this really belongs in
+    // https://github.com/web-platform-tests/wpt/blob/master/html/dom/elements/global-attributes/dataset.html
+    // it is here tentatively
+    test(function() {
+      var mathml = document.createElementNS(
+        "http://www.w3.org/1998/Math/MathML",
+        "math"
+      );
+      assert_true(mathml.dataset instanceof DOMStringMap);
+    }, "MathML elements should have a .dataset");
+
+    // exercise some basic tests on .dataset
+    test(function() {
+      assert_equals(
+        Object.keys(el.dataset).toString(),
+        "",
+        "The .dataset property should be present"
+      );
+
+      el.setAttribute("data-one", "x");
+      el.setAttribute("data-two", "y");
+
+      assert_equals(
+        el.dataset.one,
+        "x",
+        '.one should be "x" after setting the data-one attribute'
+      );
+      assert_equals(
+        el.dataset.two,
+        "y",
+        '.one should be "y" after setting the data-two attribute'
+      );
+
+      el.dataset.one = "o";
+      assert_equals(
+        el.getAttribute("data-one"),
+        "o",
+        'the data-one attribute should reflect a change to dataset.one and contain "o"'
+      );
+    }, "The dataset property should be present and be functional.");
+
+    test(function() {
+      assert_equals(mathEl.tabIndex, -1);
+    }, "MathML elements should have a tabIndex property");
+
+    promise_test(function() {
+      function focus() {
+        mathEl.focus();
+        return Promise.resolve();
+      }
+
+      return focus().then(() => {
+        assert_equals(
+          getComputedStyle(mathEl).backgroundColor,
+          "rgb(0, 255, 0)",
+          "MathML elements with tabindex=-1 should be programmatically focusable and apply :focus"
+        );
+      });
+    }, "MathML elements should work with focus predictably");
+
+    promise_test(function() {
+      function blur() {
+        mathEl.blur();
+        return Promise.resolve();
+      }
+
+      return blur().then(() => {
+        assert_equals(
+          getComputedStyle(mathEl).backgroundColor,
+          "rgba(0, 0, 0, 0)",
+          "MathML elements with tabindex=-1 be programmatically blur() able"
+        );
+      });
+    }, "MathML elements should work with blur predictably");
+  </script>
+</html>
index 3221a67..4d10af8 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>MathML inside foreignObject</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#html-and-svg">
 <link rel="match" href="integration-point-1-ref.html"/>
 <meta name="assert" content="Verify that MathML can be used inside a foreignObject element.">
 </head>
index d42eeb0..20d499d 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>MathML as a phrasing content</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#html-and-svg">
 <link rel="match" href="integration-point-2-ref.html"/>
 <meta name="assert" content="Verify that MathML can be used at positions where phrasing content is accepted.">
 <style type="text/css">
index 1feb831..1f62d8e 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>phrasing content inside mtext</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#html-and-svg">
 <link rel="match" href="integration-point-3-ref.html"/>
 <meta name="assert" content="Verify that <mtext> can contain phrasing content">
 <style type="text/css">
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4-expected.txt
new file mode 100644 (file)
index 0000000..6d828b2
--- /dev/null
@@ -0,0 +1,4 @@
+
+PASS mspace layout in SVG foreignObject 
+PASS mfrac layout in SVG foreignObject 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html
new file mode 100644 (file)
index 0000000..7121db6
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>MathML inside foreignObject</title>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#html-and-svg">
+<meta name="assert" content="Verify that MathML can be used inside a foreignObject element.">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/mathml/support/feature-detection.js"></script>
+<script>
+  setup({ explicit_done: true });
+  window.addEventListener("DOMContentLoaded", function() {
+      var scale = 2;
+      var epsilon = 1;
+      var mfrac = document.getElementById("mfrac");
+      var num = mfrac.firstElementChild.getBoundingClientRect();
+      var denom = mfrac.lastElementChild.getBoundingClientRect();
+      test(function() {
+          assert_true(MathMLFeatureDetection.has_mspace());
+          // The values of width and height are inverted (because of the
+          // rotation) and multiplied by the scale factor.
+          assert_approx_equals(num.height, 30 * scale, epsilon, "numerator width");
+          assert_approx_equals(num.width, 40 * scale, epsilon, "numerator height");
+          assert_approx_equals(denom.height, 50 * scale, epsilon, "numerator width");
+          assert_approx_equals(denom.width, 60 * scale, epsilon, "numerator height");
+      }, "mspace layout in SVG foreignObject");
+      test(function() {
+          // The horizontal/vertical metrics are inverted (because of the
+          // rotation) and multiplied by the scale factor.
+          assert_true(MathMLFeatureDetection.has_mfrac());
+          assert_greater_than_equal(num.right - denom.left,
+                                    (40 + 60) * scale,
+                                    "numerator is on the right of denominator");
+          assert_approx_equals((num.top + num.bottom) / 2,
+                               (denom.top + denom.bottom) / 2,
+                               epsilon, "numerator and denominator are vertically aligned");
+      }, "mfrac layout in SVG foreignObject");
+      done();
+  });
+</script>
+</head>
+<body>
+  <div id="log"></div>
+  <svg width="400px" height="400px">
+    <g transform="rotate(90, 200, 200) scale(2)">
+      <foreignObject width="400px" height="400px"
+                     requiredExtensions="http://www.w3.org/1998/Math/MathML">
+        <math>
+          <mfrac id="mfrac">
+            <mspace width="30px" height="40px" style="background: cyan"></mspace>
+            <mspace width="50px" height="60px" style="background: yellow"></mspace>
+          </mfrac>
+        </math>
+      </foreignObject>
+    </g>
+  </svg>
+</body>
+</html>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative-expected.txt
new file mode 100644 (file)
index 0000000..c4158ad
--- /dev/null
@@ -0,0 +1,246 @@
+
+PASS onabort: must be on the appropriate locations for GlobalEventHandlers 
+PASS onabort: the default value must be null 
+PASS onabort: the content attribute must be compiled into a function as the corresponding property 
+PASS onabort: dispatching an Event at a <math> element must trigger element.onabort 
+FAIL onauxclick: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "onauxclick" expected true got false
+FAIL onauxclick: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL onauxclick: the content attribute must be compiled into a function as the corresponding property assert_equals: The onauxclick property must be a function expected "function" but got "undefined"
+PASS onauxclick: dispatching an Event at a <math> element must trigger element.onauxclick 
+PASS onblur: must be on the appropriate locations for GlobalEventHandlers 
+PASS onblur: the default value must be null 
+PASS onblur: the content attribute must be compiled into a function as the corresponding property 
+PASS onblur: dispatching an Event at a <math> element must trigger element.onblur 
+FAIL oncancel: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "oncancel" expected true got false
+FAIL oncancel: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL oncancel: the content attribute must be compiled into a function as the corresponding property assert_equals: The oncancel property must be a function expected "function" but got "undefined"
+PASS oncancel: dispatching an Event at a <math> element must trigger element.oncancel 
+PASS oncanplay: must be on the appropriate locations for GlobalEventHandlers 
+PASS oncanplay: the default value must be null 
+PASS oncanplay: the content attribute must be compiled into a function as the corresponding property 
+PASS oncanplay: dispatching an Event at a <math> element must trigger element.oncanplay 
+PASS oncanplaythrough: must be on the appropriate locations for GlobalEventHandlers 
+PASS oncanplaythrough: the default value must be null 
+PASS oncanplaythrough: the content attribute must be compiled into a function as the corresponding property 
+PASS oncanplaythrough: dispatching an Event at a <math> element must trigger element.oncanplaythrough 
+PASS onchange: must be on the appropriate locations for GlobalEventHandlers 
+PASS onchange: the default value must be null 
+PASS onchange: the content attribute must be compiled into a function as the corresponding property 
+PASS onchange: dispatching an Event at a <math> element must trigger element.onchange 
+PASS onclick: must be on the appropriate locations for GlobalEventHandlers 
+PASS onclick: the default value must be null 
+PASS onclick: the content attribute must be compiled into a function as the corresponding property 
+PASS onclick: dispatching an Event at a <math> element must trigger element.onclick 
+FAIL onclose: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "onclose" expected true got false
+FAIL onclose: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL onclose: the content attribute must be compiled into a function as the corresponding property assert_equals: The onclose property must be a function expected "function" but got "undefined"
+PASS onclose: dispatching an Event at a <math> element must trigger element.onclose 
+PASS oncontextmenu: must be on the appropriate locations for GlobalEventHandlers 
+PASS oncontextmenu: the default value must be null 
+PASS oncontextmenu: the content attribute must be compiled into a function as the corresponding property 
+PASS oncontextmenu: dispatching an Event at a <math> element must trigger element.oncontextmenu 
+PASS oncuechange: must be on the appropriate locations for GlobalEventHandlers 
+PASS oncuechange: the default value must be null 
+FAIL oncuechange: the content attribute must be compiled into a function as the corresponding property assert_equals: The oncuechange property must be a function expected "function" but got "object"
+PASS oncuechange: dispatching an Event at a <math> element must trigger element.oncuechange 
+PASS ondblclick: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondblclick: the default value must be null 
+PASS ondblclick: the content attribute must be compiled into a function as the corresponding property 
+PASS ondblclick: dispatching an Event at a <math> element must trigger element.ondblclick 
+PASS ondrag: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondrag: the default value must be null 
+PASS ondrag: the content attribute must be compiled into a function as the corresponding property 
+PASS ondrag: dispatching an Event at a <math> element must trigger element.ondrag 
+PASS ondragend: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondragend: the default value must be null 
+PASS ondragend: the content attribute must be compiled into a function as the corresponding property 
+PASS ondragend: dispatching an Event at a <math> element must trigger element.ondragend 
+PASS ondragenter: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondragenter: the default value must be null 
+PASS ondragenter: the content attribute must be compiled into a function as the corresponding property 
+PASS ondragenter: dispatching an Event at a <math> element must trigger element.ondragenter 
+FAIL ondragexit: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "ondragexit" expected true got false
+FAIL ondragexit: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL ondragexit: the content attribute must be compiled into a function as the corresponding property assert_equals: The ondragexit property must be a function expected "function" but got "undefined"
+PASS ondragexit: dispatching an Event at a <math> element must trigger element.ondragexit 
+PASS ondragleave: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondragleave: the default value must be null 
+PASS ondragleave: the content attribute must be compiled into a function as the corresponding property 
+PASS ondragleave: dispatching an Event at a <math> element must trigger element.ondragleave 
+PASS ondragover: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondragover: the default value must be null 
+PASS ondragover: the content attribute must be compiled into a function as the corresponding property 
+PASS ondragover: dispatching an Event at a <math> element must trigger element.ondragover 
+PASS ondragstart: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondragstart: the default value must be null 
+PASS ondragstart: the content attribute must be compiled into a function as the corresponding property 
+PASS ondragstart: dispatching an Event at a <math> element must trigger element.ondragstart 
+PASS ondrop: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondrop: the default value must be null 
+PASS ondrop: the content attribute must be compiled into a function as the corresponding property 
+PASS ondrop: dispatching an Event at a <math> element must trigger element.ondrop 
+PASS ondurationchange: must be on the appropriate locations for GlobalEventHandlers 
+PASS ondurationchange: the default value must be null 
+PASS ondurationchange: the content attribute must be compiled into a function as the corresponding property 
+PASS ondurationchange: dispatching an Event at a <math> element must trigger element.ondurationchange 
+PASS onemptied: must be on the appropriate locations for GlobalEventHandlers 
+PASS onemptied: the default value must be null 
+PASS onemptied: the content attribute must be compiled into a function as the corresponding property 
+PASS onemptied: dispatching an Event at a <math> element must trigger element.onemptied 
+PASS onended: must be on the appropriate locations for GlobalEventHandlers 
+PASS onended: the default value must be null 
+PASS onended: the content attribute must be compiled into a function as the corresponding property 
+PASS onended: dispatching an Event at a <math> element must trigger element.onended 
+PASS onfocus: must be on the appropriate locations for GlobalEventHandlers 
+PASS onfocus: the default value must be null 
+PASS onfocus: the content attribute must be compiled into a function as the corresponding property 
+PASS onfocus: dispatching an Event at a <math> element must trigger element.onfocus 
+PASS oninput: must be on the appropriate locations for GlobalEventHandlers 
+PASS oninput: the default value must be null 
+PASS oninput: the content attribute must be compiled into a function as the corresponding property 
+PASS oninput: dispatching an Event at a <math> element must trigger element.oninput 
+PASS oninvalid: must be on the appropriate locations for GlobalEventHandlers 
+PASS oninvalid: the default value must be null 
+PASS oninvalid: the content attribute must be compiled into a function as the corresponding property 
+PASS oninvalid: dispatching an Event at a <math> element must trigger element.oninvalid 
+PASS onkeydown: must be on the appropriate locations for GlobalEventHandlers 
+PASS onkeydown: the default value must be null 
+PASS onkeydown: the content attribute must be compiled into a function as the corresponding property 
+PASS onkeydown: dispatching an Event at a <math> element must trigger element.onkeydown 
+PASS onkeypress: must be on the appropriate locations for GlobalEventHandlers 
+PASS onkeypress: the default value must be null 
+PASS onkeypress: the content attribute must be compiled into a function as the corresponding property 
+PASS onkeypress: dispatching an Event at a <math> element must trigger element.onkeypress 
+PASS onkeyup: must be on the appropriate locations for GlobalEventHandlers 
+PASS onkeyup: the default value must be null 
+PASS onkeyup: the content attribute must be compiled into a function as the corresponding property 
+PASS onkeyup: dispatching an Event at a <math> element must trigger element.onkeyup 
+PASS onload: must be on the appropriate locations for GlobalEventHandlers 
+PASS onload: the default value must be null 
+PASS onload: the content attribute must be compiled into a function as the corresponding property 
+PASS onload: dispatching an Event at a <math> element must trigger element.onload 
+PASS onloadeddata: must be on the appropriate locations for GlobalEventHandlers 
+PASS onloadeddata: the default value must be null 
+PASS onloadeddata: the content attribute must be compiled into a function as the corresponding property 
+PASS onloadeddata: dispatching an Event at a <math> element must trigger element.onloadeddata 
+PASS onloadedmetadata: must be on the appropriate locations for GlobalEventHandlers 
+PASS onloadedmetadata: the default value must be null 
+PASS onloadedmetadata: the content attribute must be compiled into a function as the corresponding property 
+PASS onloadedmetadata: dispatching an Event at a <math> element must trigger element.onloadedmetadata 
+FAIL onloadend: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "onloadend" expected true got false
+FAIL onloadend: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL onloadend: the content attribute must be compiled into a function as the corresponding property assert_equals: The onloadend property must be a function expected "function" but got "undefined"
+PASS onloadend: dispatching an Event at a <math> element must trigger element.onloadend 
+PASS onloadstart: must be on the appropriate locations for GlobalEventHandlers 
+PASS onloadstart: the default value must be null 
+PASS onloadstart: the content attribute must be compiled into a function as the corresponding property 
+PASS onloadstart: dispatching an Event at a <math> element must trigger element.onloadstart 
+PASS onmousedown: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmousedown: the default value must be null 
+PASS onmousedown: the content attribute must be compiled into a function as the corresponding property 
+PASS onmousedown: dispatching an Event at a <math> element must trigger element.onmousedown 
+PASS onmouseenter: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmouseenter: the default value must be null 
+PASS onmouseenter: the content attribute must be compiled into a function as the corresponding property 
+PASS onmouseenter: dispatching an Event at a <math> element must trigger element.onmouseenter 
+PASS onmouseleave: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmouseleave: the default value must be null 
+PASS onmouseleave: the content attribute must be compiled into a function as the corresponding property 
+PASS onmouseleave: dispatching an Event at a <math> element must trigger element.onmouseleave 
+PASS onmousemove: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmousemove: the default value must be null 
+PASS onmousemove: the content attribute must be compiled into a function as the corresponding property 
+PASS onmousemove: dispatching an Event at a <math> element must trigger element.onmousemove 
+PASS onmouseout: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmouseout: the default value must be null 
+PASS onmouseout: the content attribute must be compiled into a function as the corresponding property 
+PASS onmouseout: dispatching an Event at a <math> element must trigger element.onmouseout 
+PASS onmouseover: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmouseover: the default value must be null 
+PASS onmouseover: the content attribute must be compiled into a function as the corresponding property 
+PASS onmouseover: dispatching an Event at a <math> element must trigger element.onmouseover 
+PASS onmouseup: must be on the appropriate locations for GlobalEventHandlers 
+PASS onmouseup: the default value must be null 
+PASS onmouseup: the content attribute must be compiled into a function as the corresponding property 
+PASS onmouseup: dispatching an Event at a <math> element must trigger element.onmouseup 
+PASS onwheel: must be on the appropriate locations for GlobalEventHandlers 
+PASS onwheel: the default value must be null 
+PASS onwheel: the content attribute must be compiled into a function as the corresponding property 
+PASS onwheel: dispatching an Event at a <math> element must trigger element.onwheel 
+PASS onpause: must be on the appropriate locations for GlobalEventHandlers 
+PASS onpause: the default value must be null 
+PASS onpause: the content attribute must be compiled into a function as the corresponding property 
+PASS onpause: dispatching an Event at a <math> element must trigger element.onpause 
+PASS onplay: must be on the appropriate locations for GlobalEventHandlers 
+PASS onplay: the default value must be null 
+PASS onplay: the content attribute must be compiled into a function as the corresponding property 
+PASS onplay: dispatching an Event at a <math> element must trigger element.onplay 
+PASS onplaying: must be on the appropriate locations for GlobalEventHandlers 
+PASS onplaying: the default value must be null 
+PASS onplaying: the content attribute must be compiled into a function as the corresponding property 
+PASS onplaying: dispatching an Event at a <math> element must trigger element.onplaying 
+PASS onprogress: must be on the appropriate locations for GlobalEventHandlers 
+PASS onprogress: the default value must be null 
+PASS onprogress: the content attribute must be compiled into a function as the corresponding property 
+PASS onprogress: dispatching an Event at a <math> element must trigger element.onprogress 
+PASS onratechange: must be on the appropriate locations for GlobalEventHandlers 
+PASS onratechange: the default value must be null 
+PASS onratechange: the content attribute must be compiled into a function as the corresponding property 
+PASS onratechange: dispatching an Event at a <math> element must trigger element.onratechange 
+PASS onreset: must be on the appropriate locations for GlobalEventHandlers 
+PASS onreset: the default value must be null 
+PASS onreset: the content attribute must be compiled into a function as the corresponding property 
+PASS onreset: dispatching an Event at a <math> element must trigger element.onreset 
+PASS onresize: must be on the appropriate locations for GlobalEventHandlers 
+PASS onresize: the default value must be null 
+PASS onresize: the content attribute must be compiled into a function as the corresponding property 
+PASS onresize: dispatching an Event at a <math> element must trigger element.onresize 
+PASS onscroll: must be on the appropriate locations for GlobalEventHandlers 
+PASS onscroll: the default value must be null 
+PASS onscroll: the content attribute must be compiled into a function as the corresponding property 
+PASS onscroll: dispatching an Event at a <math> element must trigger element.onscroll 
+FAIL onsecuritypolicyviolation: must be on the appropriate locations for GlobalEventHandlers assert_true: MathMLElement has an own property named "onsecuritypolicyviolation" expected true got false
+FAIL onsecuritypolicyviolation: the default value must be null assert_equals: The default value of the property is null for a MathMLMathElement instance expected (object) null but got (undefined) undefined
+FAIL onsecuritypolicyviolation: the content attribute must be compiled into a function as the corresponding property assert_equals: The onsecuritypolicyviolation property must be a function expected "function" but got "undefined"
+PASS onsecuritypolicyviolation: dispatching an Event at a <math> element must trigger element.onsecuritypolicyviolation 
+PASS onseeked: must be on the appropriate locations for GlobalEventHandlers 
+PASS onseeked: the default value must be null 
+PASS onseeked: the content attribute must be compiled into a function as the corresponding property 
+PASS onseeked: dispatching an Event at a <math> element must trigger element.onseeked 
+PASS onseeking: must be on the appropriate locations for GlobalEventHandlers 
+PASS onseeking: the default value must be null 
+PASS onseeking: the content attribute must be compiled into a function as the corresponding property 
+PASS onseeking: dispatching an Event at a <math> element must trigger element.onseeking 
+PASS onselect: must be on the appropriate locations for GlobalEventHandlers 
+PASS onselect: the default value must be null 
+PASS onselect: the content attribute must be compiled into a function as the corresponding property 
+PASS onselect: dispatching an Event at a <math> element must trigger element.onselect 
+PASS onstalled: must be on the appropriate locations for GlobalEventHandlers 
+PASS onstalled: the default value must be null 
+PASS onstalled: the content attribute must be compiled into a function as the corresponding property 
+PASS onstalled: dispatching an Event at a <math> element must trigger element.onstalled 
+PASS onsubmit: must be on the appropriate locations for GlobalEventHandlers 
+PASS onsubmit: the default value must be null 
+PASS onsubmit: the content attribute must be compiled into a function as the corresponding property 
+PASS onsubmit: dispatching an Event at a <math> element must trigger element.onsubmit 
+PASS onsuspend: must be on the appropriate locations for GlobalEventHandlers 
+PASS onsuspend: the default value must be null 
+PASS onsuspend: the content attribute must be compiled into a function as the corresponding property 
+PASS onsuspend: dispatching an Event at a <math> element must trigger element.onsuspend 
+PASS ontimeupdate: must be on the appropriate locations for GlobalEventHandlers 
+PASS ontimeupdate: the default value must be null 
+PASS ontimeupdate: the content attribute must be compiled into a function as the corresponding property 
+PASS ontimeupdate: dispatching an Event at a <math> element must trigger element.ontimeupdate 
+PASS ontoggle: must be on the appropriate locations for GlobalEventHandlers 
+PASS ontoggle: the default value must be null 
+PASS ontoggle: the content attribute must be compiled into a function as the corresponding property 
+PASS ontoggle: dispatching an Event at a <math> element must trigger element.ontoggle 
+PASS onvolumechange: must be on the appropriate locations for GlobalEventHandlers 
+PASS onvolumechange: the default value must be null 
+PASS onvolumechange: the content attribute must be compiled into a function as the corresponding property 
+PASS onvolumechange: dispatching an Event at a <math> element must trigger element.onvolumechange 
+PASS onwaiting: must be on the appropriate locations for GlobalEventHandlers 
+PASS onwaiting: the default value must be null 
+PASS onwaiting: the content attribute must be compiled into a function as the corresponding property 
+PASS onwaiting: dispatching an Event at a <math> element must trigger element.onwaiting 
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html
new file mode 100644 (file)
index 0000000..807a29e
--- /dev/null
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<title>MathMLElement GlobalEventHandlers</title>
+<link rel="author" title="Brian Kardell" href="mailto:bkardell@igalia.com" />
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-idl-attributes"/>
+<link rel="help" href="https://html.spec.whatwg.org/multipage/#event-handler-content-attributes"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/WebIDLParser.js"></script>
+
+<script>
+  "use strict";
+  setup({ explicit_done: true });
+
+  // basic pattern lifted from /html/webappapis/scripting/events/event-handler-all-global-events.html
+  fetch("/interfaces/html.idl")
+    .then(res => res.text())
+    .then(htmlIDL => {
+      const parsedHTMLIDL = WebIDL2.parse(htmlIDL);
+      const globalEventHandlers = parsedHTMLIDL.find(
+        idl => idl.name === "GlobalEventHandlers"
+      );
+
+      // onerror is too special
+      const names = globalEventHandlers.members
+        .map(member => member.name)
+        .filter(name => name !== "onerror");
+
+      for (const name of names) {
+        const withoutOn = name.substring(2);
+
+        test(() => {
+          const location = MathMLElement.prototype;
+          assert_true(
+            location.hasOwnProperty(name),
+            `${location.constructor.name} has an own property named "${name}"`
+          );
+
+          assert_false(
+            name in Element.prototype,
+            `Element.prototype must not contain a "${name}" property`
+          );
+        }, `${name}: must be on the appropriate locations for GlobalEventHandlers`);
+
+        test(() => {
+          const location = document.createElementNS(
+            "http://www.w3.org/1998/Math/MathML",
+            "math"
+          );
+
+          assert_equals(
+            location[name],
+            null,
+            `The default value of the property is null for a ${
+              location.constructor.name
+            } instance`
+          );
+        }, `${name}: the default value must be null`);
+
+        test(() => {
+          const el = document.createElementNS(
+            "http://www.w3.org/1998/Math/MathML",
+            "math"
+          );
+          el.setAttribute(name, `window.${name}Happened = true;`);
+          const compiledHandler = el[name];
+
+          assert_equals(
+            typeof compiledHandler,
+            "function",
+            `The ${name} property must be a function`
+          );
+          compiledHandler();
+          assert_true(
+            window[name + "Happened"],
+            "Calling the handler must run the code"
+          );
+        }, `${name}: the content attribute must be compiled into a function as the corresponding property`);
+
+        test(() => {
+          const element = document.createElementNS(
+            "http://www.w3.org/1998/Math/MathML",
+            "math"
+          );
+          element[name] = e => {
+            assert_equals(
+              e.currentTarget,
+              element,
+              "The event must be fired at the <math> element"
+            );
+          };
+
+          element.dispatchEvent(new Event(withoutOn));
+        }, `${name}: dispatching an Event at a <math> element must trigger element.${name}`);
+      }
+
+      done();
+    });
+</script>
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1-expected.txt
deleted file mode 100644 (file)
index 8b70c8b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-PASS Testing foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML') 
-
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1.html b/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1.html
deleted file mode 100644 (file)
index 3dd7f16..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<title>SVG requiredExtensions</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom">
-<meta name="assert" content="Verify whether the MathML namespace is recognized as a required extensions of SVG foreignObject when using the hasExtension javascript function.">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script>
-  test(function() {
-  assert_true(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject").hasExtension("http://www.w3.org/1998/Math/MathML"))
-  }, "Testing foreignObject.hasExtension('http://www.w3.org/1998/Math/MathML')");
-</script>
index 1d7af04..e1d7a85 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>SVG requiredExtensions</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#html-and-svg">
 <link rel="match" href="required-extensions-2-ref.html"/>
 <meta name="assert" content="Verify that a foreignObject with MathML used as a requiredExtensions value is selected for display in a SVG switch element.">
 </head>
index 42a547a..e2315f1 100644 (file)
@@ -3,7 +3,7 @@
 <head>
 <meta charset="utf-8"/>
 <title>Unique identifier</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
 <link rel="match" href="unique-identifier-1-ref.html"/>
 <meta name="assert" content="Verify that the id on a MathML element can be used as a fragment identifier in order to force initial scrolling.">
 </head>
index 421ad7a..2c3190c 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8">
 <title>Unique Identifier</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#dom-and-javascript">
 <meta name="assert" content="Verify whether the getElementById() works for MathML elements.">
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
index c58e502..7cfac89 100644 (file)
@@ -3,7 +3,8 @@
 <head>
 <meta charset="utf-8"/>
 <title>Unique Identifier</title>
-<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#mathmltree"/>
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
+<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#css-styling">
 <link rel="match" href="unique-identifier-3-ref.html"/>
 <meta name="assert" content="Verify that the id attribute affects CSS selectors.">
 <style>
index a1fb807..7615077 100644 (file)
@@ -17,8 +17,12 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/class-1-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/class-1.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/class-2.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/clipboard-event-handlers.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/color-attributes-1-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/color-attributes-1.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative-expected.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-dynamic.tentative.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/css-inline-style-interface.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/display-1.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/dynamic-1-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/dynamic-1.html
@@ -27,13 +31,15 @@ List of files:
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-2-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-2.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/href-click-3.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/html-or-foreign-element-interfaces.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-1-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-1.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-2-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-2.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-3-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-3.html
-/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-1.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/integration-point-4.html
+/LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/math-global-event-handlers.tentative.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-2-expected.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/required-extensions-2.html
 /LayoutTests/imported/w3c/web-platform-tests/mathml/relations/html5-tree/unique-identifier-1-expected.html
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/support/attribute-values.js b/LayoutTests/imported/w3c/web-platform-tests/mathml/support/attribute-values.js
new file mode 100644 (file)
index 0000000..8408124
--- /dev/null
@@ -0,0 +1,31 @@
+AttributeValueTransforms = {
+    lowercase: function(value) { return value.toLowerCase(); },
+    uppercase: function(value) { return value.toUpperCase(); },
+    alternate_case: function(value) {
+        var transformedValue = "";
+        for (var i = 0; i < value.length; i++) {
+            transformedValue += i % 2 ?
+                value.charAt(i).toLowerCase() :
+                value.charAt(i).toUpperCase();
+        }
+        return transformedValue;
+    },
+    // TODO: Should we perform this transform too?
+    // https://github.com/mathml-refresh/mathml/issues/122
+    // add_leading_and_trimming_whitespace: function(value) {
+    //    var space = "\0020\0009\000A\000D";
+    //    return `${space}${space}${value}${space}${space}`;
+    // },
+};
+
+function TransformAttributeValues(transform, attributeNames) {
+    if (typeof attributeNames === "string")
+        attributeNames = [attributeNames];
+    attributeNames.forEach(name => {
+        Array.from(document.querySelectorAll(`[${name}]`)).forEach(element => {
+            var value = element.getAttribute(name);
+            var transformedValue = AttributeValueTransforms[transform](value);
+            element.setAttribute(name, transformedValue);
+        });
+    });
+}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/support/box-comparison.js b/LayoutTests/imported/w3c/web-platform-tests/mathml/support/box-comparison.js
new file mode 100644 (file)
index 0000000..a574b01
--- /dev/null
@@ -0,0 +1,106 @@
+function spaceBetween(childBox, parentBox) {
+    return {
+        left: childBox.left - parentBox.left,
+        right: parentBox.right - childBox.right,
+        top: childBox.top - parentBox.top,
+        bottom: parentBox.bottom - childBox.bottom
+    };
+}
+
+function measureSpaceAround(id) {
+    var mrow = document.getElementById(id);
+    var mrowBox = mrow.getBoundingClientRect();
+    var parentBox = mrow.parentNode.getBoundingClientRect();
+    var childBox = mrow.firstElementChild.getBoundingClientRect();
+    return spaceBetween(childBox, parentBox);
+}
+
+function compareSpaceWithAndWithoutStyle(tag, style, parentStyle, direction) {
+    if (!FragmentHelper.isValidChildOfMrow(tag) ||
+        FragmentHelper.isEmpty(tag))
+        throw `Invalid argument: ${tag}`;
+
+    if (!direction)
+      direction = "ltr";
+    document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
+<div style="display: inline-block"><math><mrow dir="${direction}">${MathMLFragments[tag]}</mrow></math></div>\
+</div>`);
+    var div = document.body.lastElementChild;
+
+    var styleDiv = div.firstElementChild;
+    var styleMath = styleDiv.firstElementChild;
+    var styleParent = styleMath.firstElementChild;
+    if (parentStyle)
+        styleParent.setAttribute("style", parentStyle);
+    var styleElement = FragmentHelper.element(styleMath);
+    styleElement.setAttribute("style", style);
+    var styleChild = FragmentHelper.forceNonEmptyElement(styleElement);
+    var styleMathBox = styleMath.getBoundingClientRect();
+    var styleElementBox = styleElement.getBoundingClientRect();
+    var styleChildBox = styleChild.getBoundingClientRect();
+    var styleSpace = spaceBetween(styleChildBox, styleMathBox);
+
+    var noStyleDiv = div.lastElementChild;
+    var noStyleMath = noStyleDiv.firstElementChild;
+    var noStyleElement = FragmentHelper.element(noStyleMath);
+    var noStyleChild = FragmentHelper.forceNonEmptyElement(noStyleElement);
+    var noStyleMathBox = noStyleMath.getBoundingClientRect();
+    var noStyleElementBox = noStyleElement.getBoundingClientRect();
+    var noStyleChildBox = noStyleChild.getBoundingClientRect();
+    var noStyleSpace = spaceBetween(noStyleChildBox, noStyleMathBox);
+
+    var preferredWidthDelta =
+        styleDiv.getBoundingClientRect().width -
+        noStyleDiv.getBoundingClientRect().width;
+
+    div.style = "display: none;"; // Hide the div after measurement.
+
+    return {
+        preferred_width_delta: preferredWidthDelta,
+        left_delta: styleSpace.left - noStyleSpace.left,
+        right_delta: styleSpace.right - noStyleSpace.right,
+        top_delta: styleSpace.top - noStyleSpace.top,
+        bottom_delta: styleSpace.bottom - noStyleSpace.bottom,
+        element_width_delta: styleElementBox.width - noStyleElementBox.width,
+        element_height_delta: styleElementBox.height - noStyleElementBox.height
+    };
+}
+
+function compareSizeWithAndWithoutStyle(tag, style) {
+    if (!FragmentHelper.isValidChildOfMrow(tag))
+        throw `Invalid argument: ${tag}`;
+
+    document.body.insertAdjacentHTML("beforeend", `<div style="position: absolute;">\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+<div style="display: inline-block"><math>${MathMLFragments[tag]}</math></div>\
+</div>`);
+    var div = document.body.lastElementChild;
+
+    var styleDiv = div.firstElementChild;
+    var styleMath = styleDiv.firstElementChild;
+    var styleElement = FragmentHelper.element(styleMath);
+    styleElement.setAttribute("style", style);
+    var styleMathBox = styleMath.getBoundingClientRect();
+    var styleElementBox = styleElement.getBoundingClientRect();
+
+    var noStyleDiv = div.lastElementChild;
+    var noStyleMath = noStyleDiv.firstElementChild;
+    var noStyleElement = FragmentHelper.element(noStyleMath);
+    var noStyleMathBox = noStyleMath.getBoundingClientRect();
+    var noStyleElementBox = noStyleElement.getBoundingClientRect();
+
+    var preferredWidthDelta =
+        styleDiv.getBoundingClientRect().width -
+        noStyleDiv.getBoundingClientRect().width;
+
+    div.style = "display: none;"; // Hide the div after measurement.
+
+    return {
+        preferred_width_delta: preferredWidthDelta,
+        width_delta: styleMathBox.width - noStyleMathBox.width,
+        height_delta: styleMathBox.height - noStyleMathBox.height,
+        element_width_delta: styleElementBox.width - noStyleElementBox.width,
+        element_height_delta: styleElementBox.height - noStyleElementBox.height
+    };
+};
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/support/layout-comparison.js b/LayoutTests/imported/w3c/web-platform-tests/mathml/support/layout-comparison.js
new file mode 100644 (file)
index 0000000..f9111d0
--- /dev/null
@@ -0,0 +1,105 @@
+function getWritingMode(element, reference) {
+    var style = window.getComputedStyle(reference);
+    if (style.getPropertyValue("writing-mode") !== "horizontal-tb" ||
+        style.getPropertyValue("direction") !== "ltr")
+        throw "Reference should have writing mode horizontal-tb and ltr";
+
+    style = window.getComputedStyle(element);
+    var param =  {
+        rtl: style.getPropertyValue("direction") === "rtl",
+        mode: style.getPropertyValue("writing-mode")
+    };
+
+    return param;
+}
+
+function compareSize(element, reference, epsilon) {
+    var param = getWritingMode(element, reference);
+    var elementBox = element.getBoundingClientRect();
+    var referenceBox = reference.getBoundingClientRect();
+
+    switch(param.mode) {
+    case "horizontal-tb":
+        assert_approx_equals(elementBox.width, referenceBox.width, epsilon,
+                             "inline size");
+        assert_approx_equals(elementBox.height, referenceBox.height, epsilon,
+                             "block size");
+        break;
+    case "vertical-lr":
+    case "vertical-rl":
+        assert_approx_equals(elementBox.width, referenceBox.height, epsilon,
+                             "inline size");
+        assert_approx_equals(elementBox.height, referenceBox.width, epsilon,
+                             "block size");
+        break;
+    default:
+        throw "compareSize: Unrecognized writing-mode value";
+    }
+}
+
+function participateToParentLayout(child) {
+    var style = window.getComputedStyle(child);
+    return style.getPropertyValue("display") !== "none" &&
+        style.getPropertyValue("position") !== "absolute" &&
+        style.getPropertyValue("position") !== "fixed";
+}
+
+function childrenParticipatingToLayout(element) {
+    var children = [];
+    Array.from(element.children).forEach(child => {
+        if (participateToParentLayout(child))
+            children.push(child);
+    })
+    return children;
+}
+
+function compareLayout(element, reference, epsilon) {
+    // Compare sizes of elements and children.
+    var param = getWritingMode(element, reference);
+
+    compareSize(element, reference, epsilon);
+    var elementBox = element.getBoundingClientRect();
+    var referenceBox = reference.getBoundingClientRect();
+
+    var elementChildren = childrenParticipatingToLayout(element);
+    var referenceChildren = childrenParticipatingToLayout(reference);
+    if (elementChildren.length != referenceChildren.length)
+        throw "Reference should have the same number of children participating to layout."
+
+    for (var i = 0; i < elementChildren.length; i++) {
+        compareSize(elementChildren[i], referenceChildren[i], epsilon);
+
+        var childBox = elementChildren[i].getBoundingClientRect();
+        var referenceChildBox = referenceChildren[i].getBoundingClientRect();
+
+        switch(param.mode) {
+        case "horizontal-tb":
+            assert_approx_equals(param.rtl ?
+                                 elementBox.right - childBox.right :
+                                 childBox.left - elementBox.left,
+                                 referenceChildBox.left - referenceBox.left,
+                                 epsilon,
+                                 `inline position (child ${i})`);
+            assert_approx_equals(childBox.top - elementBox.top,
+                                 referenceChildBox.top - referenceBox.top,
+                                 epsilon,
+                                 `block position (child ${i})`);
+            break;
+        case "vertical-lr":
+        case "vertical-rl":
+            assert_approx_equals(param.rtl ?
+                                 elementBox.bottom - childBox.bottom :
+                                 childBox.top - elementBox.top,
+                                 referenceChildBox.left - referenceBox.left,
+                                 epsilon,
+                                 `inline position (child ${i})`);
+            assert_approx_equals(elementBox.right - childBox.right,
+                                 referenceChildBox.top - referenceBox.top,
+                                 epsilon,
+                                 `block position (child ${i})`);
+            break;
+        default:
+            throw "compareLayout: Unrecognized writing-mode value";
+        }
+    }
+}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/support/mathml-fragments.js b/LayoutTests/imported/w3c/web-platform-tests/mathml/support/mathml-fragments.js
new file mode 100644 (file)
index 0000000..7c7b003
--- /dev/null
@@ -0,0 +1,162 @@
+var MathMLFragments = {
+    "annotation": "\
+<semantics>\
+  <mrow></mrow>\
+  <annotation class='element text-container'></annotation>\
+</semantics>",
+    "annotation-xml": "\
+<semantics>\
+  <mrow></mrow>\
+  <annotation-xml class='element text-container foreign-container'></annotation-xml>\
+</semantics>",
+    "maction": "\
+<maction class='element' actiontype='statusline'>\
+  <mrow class='mathml-container'></mrow>\
+  <mtext class='text-container'></mtext>\
+</maction>",
+    "menclose": "<menclose class='element mathml-container'></menclose>",
+    "merror": "<merror class='element mathml-container'></merror>",
+    "mfrac": "\
+<mfrac class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</mfrac>",
+    "mi": "<mi class='element text-container foreign-container'></mi>",
+    "mmultiscripts": "\
+<mmultiscripts class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</mmultiscripts>",
+    "mn": "<mn class='element text-container foreign-container'></mn>",
+    "mo": "<mo class='element text-container foreign-container'></mo>",
+    "mover": "\
+<mover class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</mover>",
+    "mpadded": "<mpadded class='element mathml-container'></mpadded>",
+    "mphantom": "<mphantom class='element mathml-container'></mphantom>",
+    "mprescripts": "\
+<mmultiscripts>\
+  <mrow class='mathml-container'></mrow>\
+  <mprescripts class='element'/>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</mmultiscripts>",
+    "mroot": "\
+<mroot class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</mroot>",
+    "mrow": "<mrow class='element mathml-container'></mrow>",
+    "ms": "<ms class='element text-container foreign-container'></ms>",
+    "mspace": "<mspace class='element'></mspace>",
+    "msqrt": "<msqrt class='element mathml-container'></msqrt>",
+    "mstyle": "<mstyle class='element mathml-container'></mstyle>",
+    "msub": "\
+<msub class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</msub>",
+    "msubsup": "\
+<msubsup class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</msubsup>",
+    "msup": "\
+<msup class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</msup>",
+    "mtable": "\
+<mtable class='element'>\
+  <mtr>\
+    <mtd class='mathml-container'>\
+    </mtd>\
+  </mtr>\
+</mtable>",
+    "mtd": "\
+<mtable>\
+  <mtr>\
+    <mtd class='element mathml-container'>\
+    </mtd>\
+  </mtr>\
+</mtable>",
+    "mtext": "<mtext class='element text-container foreign-container'></mtext>",
+    "mtr": "\
+<mtable>\
+  <mtr class='element'>\
+    <mtd class='mathml-container'>\
+    </mtd>\
+  </mtr>\
+</mtable>",
+    "munder": "\
+<munder class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</munder>",
+    "munderover": "\
+<munderover class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+  <mrow class='mathml-container'></mrow>\
+</munderover>",
+    "none": "\
+<mmultiscripts>\
+  <mrow class='mathml-container'></mrow>\
+  <none class='element'/>\
+  <mrow class='mathml-container'></mrow>\
+</mmultiscripts>",
+    "semantics": "\
+<semantics class='element'>\
+  <mrow class='mathml-container'></mrow>\
+  <annotation class='text-container'></annotation>\
+</semantics>"
+};
+
+var FragmentHelper = {
+    createElement: function(tag) {
+        return document.createElementNS("http://www.w3.org/1998/Math/MathML", tag);
+    },
+
+    isValidChildOfMrow: function(tag) {
+        return !(tag == "annotation" ||
+                 tag == "annotation-xml" ||
+                 tag == "mprescripts" ||
+                 tag == "none" ||
+                 tag == "mtr" ||
+                 tag == "mtd");
+    },
+
+    isEmpty: function(tag) {
+        return tag === "mspace" || tag == "mprescripts" || tag == "none";
+    },
+
+    element: function(fragment) {
+        return fragment.getElementsByClassName('element')[0];
+    },
+
+    appendChild: function(fragment, allowInvalid) {
+        var element = this.element(fragment) || fragment;
+        if (element.classList.contains("foreign-container")) {
+            var el = document.createElement("span");
+            el.textContent = "a";
+            return element.appendChild(el);
+        }
+        if (element.classList.contains("mathml-container") || allowInvalid) {
+            var el = this.createElement("mi");
+            el.textContent = "a";
+            return element.appendChild(el);
+        }
+        throw "Cannot append child to the element";
+    },
+
+    forceNonEmptyElement: function(fragment) {
+        var element = this.element(fragment) || fragment;
+        if (element.firstElementChild)
+            return element.firstElementChild;
+        return this.appendChild(fragment);
+    }
+}
diff --git a/LayoutTests/imported/w3c/web-platform-tests/mathml/support/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/mathml/support/w3c-import.log
new file mode 100644 (file)
index 0000000..96b025b
--- /dev/null
@@ -0,0 +1,21 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+       https://github.com/web-platform-tests/wpt
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/mathml/support/attribute-values.js
+/LayoutTests/imported/w3c/web-platform-tests/mathml/support/box-comparison.js
+/LayoutTests/imported/w3c/web-platform-tests/mathml/support/feature-detection.js
+/LayoutTests/imported/w3c/web-platform-tests/mathml/support/layout-comparison.js
+/LayoutTests/imported/w3c/web-platform-tests/mathml/support/mathml-fragments.js
diff --git a/LayoutTests/mathml/focus-event-handling-expected.txt b/LayoutTests/mathml/focus-event-handling-expected.txt
new file mode 100644 (file)
index 0000000..aec6b56
--- /dev/null
@@ -0,0 +1,15 @@
+TEST
+Test whether focus and blur events are dispatched and seen in the focus/blur event handlers:
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS focusSeen is "space1"
+PASS blurSeen is "space1"
+PASS focusSeen is "row"
+PASS blurSeen is "row"
+PASS focusSeen is "fraction"
+PASS blurSeen is "fraction"
+PASS focusSeen is "text"
+PASS blurSeen is "text"
+
diff --git a/LayoutTests/mathml/focus-event-handling.html b/LayoutTests/mathml/focus-event-handling.html
new file mode 100644 (file)
index 0000000..e709f70
--- /dev/null
@@ -0,0 +1,102 @@
+<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>
diff --git a/LayoutTests/mathml/tabindex-order-expected.txt b/LayoutTests/mathml/tabindex-order-expected.txt
new file mode 100644 (file)
index 0000000..5b25351
--- /dev/null
@@ -0,0 +1,61 @@
+This page tests that the MathML tabbing order is respected properly.
+
+To test, put focus in "a". Pressing Tab should focus "a" through "y" in order, and pressing Shift-Tab should reverse the order.
+
+ Tabbing forward....
+
+id: a tabindex: 1 mfrac is focused.
+id: b tabindex: 1 mrow is focused.
+id: c tabindex: 1 mpadded is focused.
+id: d tabindex: 1 msqrt is focused.
+id: e tabindex: 1 mroot is focused.
+id: g tabindex: 6 mspace is focused.
+id: h tabindex: 6 mtext is focused.
+id: i tabindex: 0 math is focused.
+id: j tabindex: 0 mover is focused.
+id: k tabindex: 0 munder is focused.
+id: l tabindex: 0 munderover is focused.
+id: m tabindex: 0 msub is focused.
+id: n tabindex: 0 msup is focused.
+id: o tabindex: 0 msubsup is focused.
+id: p tabindex: 0 mmultiscripts is focused.
+id: q tabindex: 0 menclose is focused.
+id: s tabindex: 0 mstyle is focused.
+id: t tabindex: 0 merror is focused.
+id: u tabindex: 0 mtable is focused.
+id: v tabindex: 0 ms is focused.
+id: w tabindex: 0 mi is focused.
+id: x tabindex: 0 mo is focused.
+id: y tabindex: 0 mn is focused.
+id: a tabindex: 1 mfrac is focused.
+
+Tabbing backward....
+
+id: y tabindex: 0 mn is focused.
+id: x tabindex: 0 mo is focused.
+id: w tabindex: 0 mi is focused.
+id: v tabindex: 0 ms is focused.
+id: u tabindex: 0 mtable is focused.
+id: t tabindex: 0 merror is focused.
+id: s tabindex: 0 mstyle is focused.
+id: q tabindex: 0 menclose is focused.
+id: p tabindex: 0 mmultiscripts is focused.
+id: o tabindex: 0 msubsup is focused.
+id: n tabindex: 0 msup is focused.
+id: m tabindex: 0 msub is focused.
+id: l tabindex: 0 munderover is focused.
+id: k tabindex: 0 munder is focused.
+id: j tabindex: 0 mover is focused.
+id: i tabindex: 0 math is focused.
+id: h tabindex: 6 mtext is focused.
+id: g tabindex: 6 mspace is focused.
+id: e tabindex: 1 mroot is focused.
+id: d tabindex: 1 msqrt is focused.
+id: c tabindex: 1 mpadded is focused.
+id: b tabindex: 1 mrow is focused.
+id: a tabindex: 1 mfrac is focused.
+id: y tabindex: 0 mn is focused.
+
+Test finished
+
+
diff --git a/LayoutTests/mathml/tabindex-order.html b/LayoutTests/mathml/tabindex-order.html
new file mode 100644 (file)
index 0000000..2a34c55
--- /dev/null
@@ -0,0 +1,126 @@
+<!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>
+
index 11dbdee..2b6f3fb 100644 (file)
@@ -1350,4 +1350,7 @@ fast/scrolling/ios/body-overflow-hidden-height-100-percent-keyboard.html [ Pass
 
 # Skip tests timing out for <rdar://problem/48616298>
 fast/viewport/ios/constant-width-viewport-after-changing-view-scale.html [ Skip ]
-fast/viewport/ios/ignore-minimum-device-width-for-page-with-viewport-device-width.html [ Skip ]
\ No newline at end of file
+fast/viewport/ios/ignore-minimum-device-width-for-page-with-viewport-device-width.html [ Skip ]
+
+# problem with blur handling
+mathml/focus-event-handling.html [ Failure ]
index 9fb4e0b..f1030a2 100644 (file)
@@ -907,6 +907,9 @@ set(WebCore_NON_SVG_IDL_FILES
 
     loader/appcache/DOMApplicationCache.idl
 
+    mathml/MathMLElement.idl
+    mathml/MathMLMathElement.idl
+
     page/BarProp.idl
     page/Crypto.idl
     page/DOMSelection.idl
index ee4a4e7..0e72459 100644 (file)
@@ -1,3 +1,39 @@
+2019-09-06  Rob Buis  <rbuis@igalia.com>
+
+        Implement MathML DOM
+        https://bugs.webkit.org/show_bug.cgi?id=200470
+
+        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:
+
 2019-09-06  Zan Dobersek  <zdobersek@igalia.com>
 
         [GStreamer] YUV buffers on iMX platforms have to be treated as RGBA
index 728d586..cca4c55 100644 (file)
@@ -856,6 +856,8 @@ $(PROJECT_DIR)/inspector/InspectorAuditResourcesObject.idl
 $(PROJECT_DIR)/inspector/InspectorFrontendHost.idl
 $(PROJECT_DIR)/loader/appcache/DOMApplicationCache.idl
 $(PROJECT_DIR)/make-hash-tools.pl
+$(PROJECT_DIR)/mathml/MathMLElement.idl
+$(PROJECT_DIR)/mathml/MathMLMathElement.idl
 $(PROJECT_DIR)/mathml/mathattrs.in
 $(PROJECT_DIR)/mathml/mathtags.in
 $(PROJECT_DIR)/page/BarProp.idl
index ecf2732..6757794 100644 (file)
@@ -931,6 +931,10 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMallocStatistics.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMallocStatistics.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLElementWrapperFactory.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLElementWrapperFactory.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLElement.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLElement.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLMathElement.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMathMLMathElement.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaCapabilities.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaCapabilities.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaCapabilitiesDecodingInfo.cpp
index 0d3c69a..e442dbf 100644 (file)
@@ -78,6 +78,7 @@ VPATH = \
     $(WebCore)/html/track \
     $(WebCore)/inspector \
     $(WebCore)/loader/appcache \
+    $(WebCore)/mathml \
     $(WebCore)/page \
     $(WebCore)/platform/network \
     $(WebCore)/plugins \
@@ -847,6 +848,8 @@ JS_BINDING_IDLS = \
     $(WebCore)/html/track/VTTRegionList.idl \
     $(WebCore)/html/track/VideoTrack.idl \
     $(WebCore)/html/track/VideoTrackList.idl \
+    $(WebCore)/mathml/MathMLElement.idl \
+    $(WebCore)/mathml/MathMLMathElement.idl \
     $(WebCore)/inspector/CommandLineAPIHost.idl \
     $(WebCore)/inspector/InspectorAuditAccessibilityObject.idl \
     $(WebCore)/inspector/InspectorAuditDOMObject.idl \
@@ -1682,6 +1685,7 @@ IDL_INCLUDES = \
     $(WebCore)/html/track \
     $(WebCore)/inspector \
     $(WebCore)/loader/appcache \
+    $(WebCore)/mathml \
     $(WebCore)/page \
     $(WebCore)/plugins \
     $(WebCore)/storage \
index fec1ca4..1d2fd00 100644 (file)
@@ -2567,6 +2567,7 @@ UserAgentStyleSheetsData.cpp
 WebCoreJSBuiltinInternals.cpp
 WebCoreJSBuiltins.cpp
 JSHTMLElementWrapperFactory.cpp
+JSMathMLElementWrapperFactory.cpp
 JSSVGElementWrapperFactory.cpp
 
 // IDL bindings
@@ -2933,6 +2934,8 @@ JSHashChangeEvent.cpp
 JSHistory.cpp
 JSHkdfParams.cpp
 JSHmacKeyParams.cpp
+JSMathMLElement.cpp
+JSMathMLMathElement.cpp
 JSIDBCursor.cpp
 JSIDBCursorDirection.cpp
 JSIDBCursorWithValue.cpp
index 41d329e..d732426 100644 (file)
                A9EE448F210FD69A00B6EAE6 /* AccessibilityRole.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AccessibilityRole.idl; sourceTree = "<group>"; };
                AA0978ED0ABAA6E100874480 /* CSSCursorImageValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCursorImageValue.cpp; sourceTree = "<group>"; };
                AA0978EE0ABAA6E100874480 /* CSSCursorImageValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSCursorImageValue.h; sourceTree = "<group>"; };
+               AA11C04B23169689009D9831 /* MathMLMathElement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MathMLMathElement.idl; sourceTree = "<group>"; };
+               AA11C04D2316973D009D9831 /* JSMathMLMathElement.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMathMLMathElement.cpp; sourceTree = "<group>"; };
+               AA11C04E23169782009D9831 /* JSMathMLMathElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSMathMLMathElement.h; sourceTree = "<group>"; };
                AA2A5AB816A485D500975A25 /* DOMWindowSpeechSynthesis.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowSpeechSynthesis.cpp; sourceTree = "<group>"; };
                AA2A5AB916A485D500975A25 /* DOMWindowSpeechSynthesis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowSpeechSynthesis.h; sourceTree = "<group>"; };
                AA2A5ABA16A485D500975A25 /* DOMWindowSpeechSynthesis.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowSpeechSynthesis.idl; sourceTree = "<group>"; };
                AA4C3A740B2B1679002334A2 /* InlineStyleSheetOwner.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InlineStyleSheetOwner.cpp; sourceTree = "<group>"; };
                AA4C3A750B2B1679002334A2 /* InlineStyleSheetOwner.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InlineStyleSheetOwner.h; sourceTree = "<group>"; };
                AA5F3B9016CC5BEB00455EB0 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = "<absolute>"; };
+               AA61BB5223167473002FE25A /* JSMathMLElementWrapperFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSMathMLElementWrapperFactory.cpp; path = DerivedSources/WebCore/JSMathMLElementWrapperFactory.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+               AA61BB5423167474002FE25A /* JSMathMLElementWrapperFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSMathMLElementWrapperFactory.h; path = DerivedSources/WebCore/JSMathMLElementWrapperFactory.h; sourceTree = BUILT_PRODUCTS_DIR; };
                AA7FEE9C16A4E6F3004C0C33 /* JSSpeechSynthesis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechSynthesis.cpp; sourceTree = "<group>"; };
                AA7FEE9E16A4E6F3004C0C33 /* JSSpeechSynthesisUtterance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSpeechSynthesisUtterance.cpp; sourceTree = "<group>"; };
                AA7FEE9F16A4E6F3004C0C33 /* JSSpeechSynthesisUtterance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSpeechSynthesisUtterance.h; sourceTree = "<group>"; };
                                7C330A041DF9F93B00D3395C /* Geolocation */,
                                A83B79080CCAFF2B000B0825 /* HTML */,
                                1C5FAECA0DCFD8C900D58F78 /* Inspector */,
+                               AACC83D92316578600EB6BF5 /* MATHML */,
                                CDAB6D2A17C7E97D00C60B34 /* MediaControls */,
                                CD61FE7B1794CA02004101EB /* MediaSource */,
                                07CFD99317D01405001C4FFC /* MediaStream */,
                                1C24EEA71C72A7B40080F8FC /* JSFontFaceSet.h */,
                                938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */,
                                938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */,
+                               AA61BB5223167473002FE25A /* JSMathMLElementWrapperFactory.cpp */,
+                               AA61BB5423167474002FE25A /* JSMathMLElementWrapperFactory.h */,
                                8574D1F10ADE6122004CBA11 /* JSSVGElementWrapperFactory.cpp */,
                                8574D1F20ADE6122004CBA11 /* JSSVGElementWrapperFactory.h */,
                                FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */,
                        path = ios;
                        sourceTree = "<group>";
                };
+               AACC83D92316578600EB6BF5 /* MATHML */ = {
+                       isa = PBXGroup;
+                       children = (
+                               AACC83DB2316583200EB6BF5 /* JSMathMLElement.cpp */,
+                               AACC83DA231657EC00EB6BF5 /* JSMathMLElement.h */,
+                               AA11C04D2316973D009D9831 /* JSMathMLMathElement.cpp */,
+                               AA11C04E23169782009D9831 /* JSMathMLMathElement.h */,
+                       );
+                       name = MATHML;
+                       sourceTree = "<group>";
+               };
                B1A942DD15B5CE2200D525D1 /* mediasource */ = {
                        isa = PBXGroup;
                        children = (
                                FABE72EE1059C1EB00D888CC /* MathMLAnnotationElement.h */,
                                FABE72ED1059C1EB00D999DD /* MathMLElement.cpp */,
                                FABE72EE1059C1EB00D999DD /* MathMLElement.h */,
+                               AACC83D42316568700EB6BF5 /* MathMLElement.idl */,
                                0BCF83EF1059C1EB00D999DD /* MathMLFractionElement.cpp */,
                                0BCF83F01059C1EB00D999DD /* MathMLFractionElement.h */,
                                FABE72F11059C1EB00D999DD /* MathMLMathElement.cpp */,
                                FABE72F21059C1EB00D999DD /* MathMLMathElement.h */,
+                               AA11C04B23169689009D9831 /* MathMLMathElement.idl */,
                                C3E61C653A64807A83E76FB8 /* MathMLMencloseElement.cpp */,
                                CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */,
                                D4F72C653A64807A83E76FB8 /* MathMLOperatorDictionary.cpp */,
                                A5B81CAE1FAA44620037D1E6 /* InspectorIndexedDBAgent.h in Headers */,
                                20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */,
                                A5840E1D187B74D500843B10 /* InspectorInstrumentationCookie.h in Headers */,
+                               A5860E6D230DE30300461AAE /* InspectorInstrumentationPublic.h in Headers */,
+                               A5860E6E230DE30A00461AAE /* InspectorInstrumentationWebKit.h in Headers */,
                                A5B81CAF1FAA44620037D1E6 /* InspectorLayerTreeAgent.h in Headers */,
                                A5B81CB01FAA44620037D1E6 /* InspectorMemoryAgent.h in Headers */,
                                A5B81CB11FAA44620037D1E6 /* InspectorNetworkAgent.h in Headers */,
                                07D60928214C5BFD00E7396C /* WindowDisplayCaptureSourceMac.h in Headers */,
                                BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
                                7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */,
-                               A5860E6E230DE30A00461AAE /* InspectorInstrumentationWebKit.h in Headers */,
                                463521AD2081092A00C28922 /* WindowProxy.h in Headers */,
                                E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */,
                                501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */,
                                A14832BE187F64CC00DA63A6 /* WKContentObservation.h in Headers */,
-                               A5860E6D230DE30300461AAE /* InspectorInstrumentationPublic.h in Headers */,
                                A14832BF187F652C00DA63A6 /* WKGraphics.h in Headers */,
                                A14832C1187F657A00DA63A6 /* WKTypes.h in Headers */,
                                A14832C3187F65DF00DA63A6 /* WKUtilities.h in Headers */,
index a90dcd9..0dac216 100644 (file)
 #include "JSAttr.h"
 #include "JSDOMBinding.h"
 #include "JSHTMLElementWrapperFactory.h"
+#include "JSMathMLElementWrapperFactory.h"
 #include "JSNodeList.h"
 #include "JSSVGElementWrapperFactory.h"
+#include "MathMLElement.h"
 #include "NodeList.h"
 #include "SVGElement.h"
 
@@ -53,6 +55,8 @@ static JSValue createNewElementWrapper(JSDOMGlobalObject* globalObject, Ref<Elem
         return createJSHTMLWrapper(globalObject, static_reference_cast<HTMLElement>(WTFMove(element)));
     if (is<SVGElement>(element))
         return createJSSVGWrapper(globalObject, static_reference_cast<SVGElement>(WTFMove(element)));
+    if (is<MathMLElement>(element))
+        return createJSMathMLWrapper(globalObject, static_reference_cast<MathMLElement>(WTFMove(element)));
     return createWrapper<Element>(globalObject, WTFMove(element));
 }
 
index 894b346..67c0fcd 100644 (file)
 #include "JSEventListener.h"
 #include "JSHTMLElement.h"
 #include "JSHTMLElementWrapperFactory.h"
+#include "JSMathMLElementWrapperFactory.h"
 #include "JSProcessingInstruction.h"
 #include "JSSVGElementWrapperFactory.h"
 #include "JSShadowRoot.h"
 #include "JSText.h"
+#include "MathMLElement.h"
 #include "Node.h"
 #include "ProcessingInstruction.h"
 #include "RegisteredEventListener.h"
@@ -150,6 +152,8 @@ static ALWAYS_INLINE JSValue createWrapperInline(ExecState* exec, JSDOMGlobalObj
                 wrapper = createJSHTMLWrapper(globalObject, static_reference_cast<HTMLElement>(WTFMove(node)));
             else if (is<SVGElement>(node))
                 wrapper = createJSSVGWrapper(globalObject, static_reference_cast<SVGElement>(WTFMove(node)));
+            else if (is<MathMLElement>(node))
+                wrapper = createJSMathMLWrapper(globalObject, static_reference_cast<MathMLElement>(WTFMove(node)));
             else
                 wrapper = createWrapper<Element>(globalObject, WTFMove(node));
             break;
index 8966c6a..9426b4a 100644 (file)
@@ -34,6 +34,8 @@
 #include "EventHandler.h"
 #include "FrameLoader.h"
 #include "HTMLAnchorElement.h"
+#include "HTMLElement.h"
+#include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "MathMLNames.h"
 #include "MouseEvent.h"
@@ -87,8 +89,20 @@ void MathMLElement::parseAttribute(const QualifiedName& name, const AtomString&
     } else if (name == columnspanAttr) {
         if (is<RenderTableCell>(renderer()) && hasTagName(mtdTag))
             downcast<RenderTableCell>(renderer())->colSpanOrRowSpanChanged();
-    } else
+    } else if (name == HTMLNames::tabindexAttr) {
+        if (value.isEmpty())
+            clearTabIndexExplicitlyIfNeeded();
+        else if (auto optionalTabIndex = parseHTMLInteger(value))
+            setTabIndexExplicitly(optionalTabIndex.value());
+    } else {
+        auto& eventName = HTMLElement::eventNameForEventHandlerAttribute(name);
+        if (!eventName.isNull()) {
+            setAttributeEventListener(eventName, name, value);
+            return;
+        }
+
         StyledElement::parseAttribute(name, value);
+    }
 }
 
 bool MathMLElement::isPresentationAttribute(const QualifiedName& name) const
diff --git a/Source/WebCore/mathml/MathMLElement.idl b/Source/WebCore/mathml/MathMLElement.idl
new file mode 100644 (file)
index 0000000..e9ad8e4
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    JSGenerateToNativeObject,
+] interface MathMLElement : Element { };
+
+MathMLElement implements ElementCSSInlineStyle;
+MathMLElement implements GlobalEventHandlers;
+MathMLElement implements DocumentAndElementEventHandlers;
+MathMLElement implements HTMLOrForeignElement;
diff --git a/Source/WebCore/mathml/MathMLMathElement.idl b/Source/WebCore/mathml/MathMLMathElement.idl
new file mode 100644 (file)
index 0000000..9c25fb2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2019 Igalia S.L. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+interface MathMLMathElement : MathMLElement { };
index bcf894b..bfd705a 100644 (file)
@@ -2,49 +2,50 @@ namespace="MathML"
 namespaceURI="http://www.w3.org/1998/Math/MathML"
 guardFactoryWith="ENABLE(MATHML)"
 fallbackInterfaceName="MathMLUnknownElement"
+fallbackJSInterfaceName="MathMLElement"
 
-annotation interfaceName=MathMLAnnotationElement
-annotation-xml interfaceName=MathMLAnnotationElement
-maction interfaceName=MathMLSelectElement
+annotation interfaceName=MathMLAnnotationElement, JSInterfaceName=MathMLElement
+annotation-xml interfaceName=MathMLAnnotationElement, JSInterfaceName=MathMLElement
+maction interfaceName=MathMLSelectElement, JSInterfaceName=MathMLElement
 math
-mfrac interfaceName=MathMLFractionElement
-mfenced interfaceName=MathMLRowElement
-msubsup interfaceName=MathMLScriptsElement
-merror interfaceName=MathMLRowElement
-mpadded interfaceName=MathMLPaddedElement
-mphantom interfaceName=MathMLRowElement
-mrow interfaceName=MathMLRowElement
-mstyle interfaceName=MathMLRowElement
-mover interfaceName=MathMLUnderOverElement
-munder interfaceName=MathMLUnderOverElement
-munderover interfaceName=MathMLUnderOverElement
-msqrt interfaceName=MathMLRootElement
-mroot interfaceName=MathMLRootElement
-mi interfaceName=MathMLTokenElement
-mn interfaceName=MathMLTokenElement
-mo interfaceName=MathMLOperatorElement
-mtext interfaceName=MathMLTokenElement
-ms interfaceName=MathMLTokenElement
-mspace interfaceName=MathMLSpaceElement
-msub interfaceName=MathMLScriptsElement
-msup interfaceName=MathMLScriptsElement
-mtable interfaceName=MathMLPresentationElement
-mtr interfaceName=MathMLPresentationElement
-mtd interfaceName=MathMLPresentationElement
-mmultiscripts interfaceName=MathMLScriptsElement
-mprescripts interfaceName=MathMLPresentationElement
-menclose interfaceName=MathMLMencloseElement
-none interfaceName=MathMLPresentationElement
-semantics interfaceName=MathMLSelectElement
+mfrac interfaceName=MathMLFractionElement, JSInterfaceName=MathMLElement
+mfenced interfaceName=MathMLRowElement, JSInterfaceName=MathMLElement
+msubsup interfaceName=MathMLScriptsElement, JSInterfaceName=MathMLElement
+merror interfaceName=MathMLRowElement, JSInterfaceName=MathMLElement
+mpadded interfaceName=MathMLPaddedElement, JSInterfaceName=MathMLElement
+mphantom interfaceName=MathMLRowElement, JSInterfaceName=MathMLElement
+mrow interfaceName=MathMLRowElement, JSInterfaceName=MathMLElement
+mstyle interfaceName=MathMLRowElement, JSInterfaceName=MathMLElement
+mover interfaceName=MathMLUnderOverElement, JSInterfaceName=MathMLElement
+munder interfaceName=MathMLUnderOverElement, JSInterfaceName=MathMLElement
+munderover interfaceName=MathMLUnderOverElement, JSInterfaceName=MathMLElement
+msqrt interfaceName=MathMLRootElement, JSInterfaceName=MathMLElement
+mroot interfaceName=MathMLRootElement, JSInterfaceName=MathMLElement
+mi interfaceName=MathMLTokenElement, JSInterfaceName=MathMLElement
+mn interfaceName=MathMLTokenElement, JSInterfaceName=MathMLElement
+mo interfaceName=MathMLOperatorElement, JSInterfaceName=MathMLElement
+mtext interfaceName=MathMLTokenElement, JSInterfaceName=MathMLElement
+ms interfaceName=MathMLTokenElement, JSInterfaceName=MathMLElement
+mspace interfaceName=MathMLSpaceElement, JSInterfaceName=MathMLElement
+msub interfaceName=MathMLScriptsElement, JSInterfaceName=MathMLElement
+msup interfaceName=MathMLScriptsElement, JSInterfaceName=MathMLElement
+mtable interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mtr interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mtd interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mmultiscripts interfaceName=MathMLScriptsElement, JSInterfaceName=MathMLElement
+mprescripts interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+menclose interfaceName=MathMLMencloseElement, JSInterfaceName=MathMLElement
+none interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+semantics interfaceName=MathMLSelectElement, JSInterfaceName=MathMLElement
 
-maligngroup interfaceName=MathMLPresentationElement
-malignmark interfaceName=MathMLPresentationElement
-mglyph interfaceName=MathMLPresentationElement
-mlabeledtr interfaceName=MathMLPresentationElement
-mlongdiv interfaceName=MathMLPresentationElement
-mscarries interfaceName=MathMLPresentationElement
-mscarry interfaceName=MathMLPresentationElement
-msgroup interfaceName=MathMLPresentationElement
-msline interfaceName=MathMLPresentationElement
-msrow interfaceName=MathMLPresentationElement
-mstack interfaceName=MathMLPresentationElement
+maligngroup interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+malignmark interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mglyph interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mlabeledtr interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mlongdiv interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mscarries interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mscarry interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+msgroup interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+msline interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+msrow interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement
+mstack interfaceName=MathMLPresentationElement, JSInterfaceName=MathMLElement