Skip to content

Commit 4e59367

Browse files
rwlbuiswebkit-commit-queue
authored andcommitted
[GTK][WPE] Remove attributes deprecated from MathML3
https://bugs.webkit.org/show_bug.cgi?id=197492 Patch by Rob Buis <[email protected]> on 2019-09-09 Reviewed by Frédéric Wang. LayoutTests/imported/w3c: Import relevant WPT test. * web-platform-tests/mathml/relations/css-styling/attribute-mapping-001-expected.txt: Added. * web-platform-tests/mathml/relations/css-styling/attribute-mapping-001.html: Added. Source/WebCore: Remove some MathML3 deprecated attributes: w3c/mathml#5 (comment) This change also maps the dir attribute to direction for MathML Core. Test: imported/w3c/web-platform-tests/mathml/relations/css-styling/attribute-mapping-001.html * mathml/MathMLElement.cpp: (WebCore::MathMLElement::collectStyleForPresentationAttribute): LayoutTests: Disable the MathML Core flag for tests assuming MathML3 behavior. * mathml/presentation/attributes-background-color-expected.html: * mathml/presentation/attributes-background-color.html: * mathml/presentation/attributes-mathvariant.html: * mathml/presentation/direction-overall.html: * mathml/presentation/mstyle-css-attributes.html: Canonical link: https://commits.webkit.org/215237@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent a9d51a0 commit 4e59367

File tree

11 files changed

+340
-22
lines changed

11 files changed

+340
-22
lines changed

LayoutTests/ChangeLog

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2019-09-09 Rob Buis <[email protected]>
2+
3+
[GTK][WPE] Remove attributes deprecated from MathML3
4+
https://bugs.webkit.org/show_bug.cgi?id=197492
5+
6+
Reviewed by Frédéric Wang.
7+
8+
Disable the MathML Core flag for tests assuming MathML3 behavior.
9+
10+
* mathml/presentation/attributes-background-color-expected.html:
11+
* mathml/presentation/attributes-background-color.html:
12+
* mathml/presentation/attributes-mathvariant.html:
13+
* mathml/presentation/direction-overall.html:
14+
* mathml/presentation/mstyle-css-attributes.html:
15+
116
2019-09-08 Saam Barati <[email protected]>
217

318
[WHLSL] Add back a version of the property resolver

LayoutTests/imported/w3c/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2019-09-09 Rob Buis <[email protected]>
2+
3+
[GTK][WPE] Remove attributes deprecated from MathML3
4+
https://bugs.webkit.org/show_bug.cgi?id=197492
5+
6+
Reviewed by Frédéric Wang.
7+
8+
Import relevant WPT test.
9+
10+
* web-platform-tests/mathml/relations/css-styling/attribute-mapping-001-expected.txt: Added.
11+
* web-platform-tests/mathml/relations/css-styling/attribute-mapping-001.html: Added.
12+
113
2019-09-07 Chris Dumez <[email protected]>
214

315
Add support for postMessage buffering between the service worker and window
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
2+
PASS dir on the math element is mapped to CSS direction
3+
PASS mathcolor on the math element is mapped to CSS color
4+
PASS mathbackground on the math element is mapped to CSS background-color
5+
PASS mathsize on the math element is mapped to CSS font-size
6+
PASS deprecated MathML3 attributes on the math element are not mapped to CSS
7+
PASS dir on the annotation element is mapped to CSS direction
8+
PASS mathcolor on the annotation element is mapped to CSS color
9+
PASS mathbackground on the annotation element is mapped to CSS background-color
10+
PASS mathsize on the annotation element is mapped to CSS font-size
11+
PASS deprecated MathML3 attributes on the annotation element are not mapped to CSS
12+
PASS dir on the annotation-xml element is mapped to CSS direction
13+
PASS mathcolor on the annotation-xml element is mapped to CSS color
14+
PASS mathbackground on the annotation-xml element is mapped to CSS background-color
15+
PASS mathsize on the annotation-xml element is mapped to CSS font-size
16+
PASS deprecated MathML3 attributes on the annotation-xml element are not mapped to CSS
17+
PASS dir on the maction element is mapped to CSS direction
18+
PASS mathcolor on the maction element is mapped to CSS color
19+
PASS mathbackground on the maction element is mapped to CSS background-color
20+
PASS mathsize on the maction element is mapped to CSS font-size
21+
PASS deprecated MathML3 attributes on the maction element are not mapped to CSS
22+
PASS dir on the menclose element is mapped to CSS direction
23+
PASS mathcolor on the menclose element is mapped to CSS color
24+
PASS mathbackground on the menclose element is mapped to CSS background-color
25+
PASS mathsize on the menclose element is mapped to CSS font-size
26+
PASS deprecated MathML3 attributes on the menclose element are not mapped to CSS
27+
PASS dir on the merror element is mapped to CSS direction
28+
FAIL mathcolor on the merror element is mapped to CSS color assert_equals: no attribute expected "rgb(255, 0, 0)" but got "rgb(0, 0, 255)"
29+
PASS mathbackground on the merror element is mapped to CSS background-color
30+
PASS mathsize on the merror element is mapped to CSS font-size
31+
PASS deprecated MathML3 attributes on the merror element are not mapped to CSS
32+
PASS dir on the mfrac element is mapped to CSS direction
33+
PASS mathcolor on the mfrac element is mapped to CSS color
34+
PASS mathbackground on the mfrac element is mapped to CSS background-color
35+
PASS mathsize on the mfrac element is mapped to CSS font-size
36+
PASS deprecated MathML3 attributes on the mfrac element are not mapped to CSS
37+
PASS dir on the mi element is mapped to CSS direction
38+
PASS mathcolor on the mi element is mapped to CSS color
39+
PASS mathbackground on the mi element is mapped to CSS background-color
40+
PASS mathsize on the mi element is mapped to CSS font-size
41+
PASS deprecated MathML3 attributes on the mi element are not mapped to CSS
42+
PASS dir on the mmultiscripts element is mapped to CSS direction
43+
PASS mathcolor on the mmultiscripts element is mapped to CSS color
44+
PASS mathbackground on the mmultiscripts element is mapped to CSS background-color
45+
PASS mathsize on the mmultiscripts element is mapped to CSS font-size
46+
PASS deprecated MathML3 attributes on the mmultiscripts element are not mapped to CSS
47+
PASS dir on the mn element is mapped to CSS direction
48+
PASS mathcolor on the mn element is mapped to CSS color
49+
PASS mathbackground on the mn element is mapped to CSS background-color
50+
PASS mathsize on the mn element is mapped to CSS font-size
51+
PASS deprecated MathML3 attributes on the mn element are not mapped to CSS
52+
PASS dir on the mo element is mapped to CSS direction
53+
PASS mathcolor on the mo element is mapped to CSS color
54+
PASS mathbackground on the mo element is mapped to CSS background-color
55+
PASS mathsize on the mo element is mapped to CSS font-size
56+
PASS deprecated MathML3 attributes on the mo element are not mapped to CSS
57+
PASS dir on the mover element is mapped to CSS direction
58+
PASS mathcolor on the mover element is mapped to CSS color
59+
PASS mathbackground on the mover element is mapped to CSS background-color
60+
PASS mathsize on the mover element is mapped to CSS font-size
61+
PASS deprecated MathML3 attributes on the mover element are not mapped to CSS
62+
PASS dir on the mpadded element is mapped to CSS direction
63+
PASS mathcolor on the mpadded element is mapped to CSS color
64+
PASS mathbackground on the mpadded element is mapped to CSS background-color
65+
PASS mathsize on the mpadded element is mapped to CSS font-size
66+
PASS deprecated MathML3 attributes on the mpadded element are not mapped to CSS
67+
PASS dir on the mphantom element is mapped to CSS direction
68+
PASS mathcolor on the mphantom element is mapped to CSS color
69+
PASS mathbackground on the mphantom element is mapped to CSS background-color
70+
PASS mathsize on the mphantom element is mapped to CSS font-size
71+
PASS deprecated MathML3 attributes on the mphantom element are not mapped to CSS
72+
PASS dir on the mprescripts element is mapped to CSS direction
73+
PASS mathcolor on the mprescripts element is mapped to CSS color
74+
PASS mathbackground on the mprescripts element is mapped to CSS background-color
75+
FAIL mathsize on the mprescripts element is mapped to CSS font-size assert_equals: no attribute expected "50px" but got "37.5px"
76+
PASS deprecated MathML3 attributes on the mprescripts element are not mapped to CSS
77+
PASS dir on the mroot element is mapped to CSS direction
78+
PASS mathcolor on the mroot element is mapped to CSS color
79+
PASS mathbackground on the mroot element is mapped to CSS background-color
80+
PASS mathsize on the mroot element is mapped to CSS font-size
81+
PASS deprecated MathML3 attributes on the mroot element are not mapped to CSS
82+
PASS dir on the mrow element is mapped to CSS direction
83+
PASS mathcolor on the mrow element is mapped to CSS color
84+
PASS mathbackground on the mrow element is mapped to CSS background-color
85+
PASS mathsize on the mrow element is mapped to CSS font-size
86+
PASS deprecated MathML3 attributes on the mrow element are not mapped to CSS
87+
PASS dir on the ms element is mapped to CSS direction
88+
PASS mathcolor on the ms element is mapped to CSS color
89+
PASS mathbackground on the ms element is mapped to CSS background-color
90+
PASS mathsize on the ms element is mapped to CSS font-size
91+
PASS deprecated MathML3 attributes on the ms element are not mapped to CSS
92+
PASS dir on the mspace element is mapped to CSS direction
93+
PASS mathcolor on the mspace element is mapped to CSS color
94+
PASS mathbackground on the mspace element is mapped to CSS background-color
95+
PASS mathsize on the mspace element is mapped to CSS font-size
96+
PASS deprecated MathML3 attributes on the mspace element are not mapped to CSS
97+
PASS dir on the msqrt element is mapped to CSS direction
98+
PASS mathcolor on the msqrt element is mapped to CSS color
99+
PASS mathbackground on the msqrt element is mapped to CSS background-color
100+
PASS mathsize on the msqrt element is mapped to CSS font-size
101+
PASS deprecated MathML3 attributes on the msqrt element are not mapped to CSS
102+
PASS dir on the mstyle element is mapped to CSS direction
103+
PASS mathcolor on the mstyle element is mapped to CSS color
104+
PASS mathbackground on the mstyle element is mapped to CSS background-color
105+
PASS mathsize on the mstyle element is mapped to CSS font-size
106+
PASS deprecated MathML3 attributes on the mstyle element are not mapped to CSS
107+
PASS dir on the msub element is mapped to CSS direction
108+
PASS mathcolor on the msub element is mapped to CSS color
109+
PASS mathbackground on the msub element is mapped to CSS background-color
110+
PASS mathsize on the msub element is mapped to CSS font-size
111+
PASS deprecated MathML3 attributes on the msub element are not mapped to CSS
112+
PASS dir on the msubsup element is mapped to CSS direction
113+
PASS mathcolor on the msubsup element is mapped to CSS color
114+
PASS mathbackground on the msubsup element is mapped to CSS background-color
115+
PASS mathsize on the msubsup element is mapped to CSS font-size
116+
PASS deprecated MathML3 attributes on the msubsup element are not mapped to CSS
117+
PASS dir on the msup element is mapped to CSS direction
118+
PASS mathcolor on the msup element is mapped to CSS color
119+
PASS mathbackground on the msup element is mapped to CSS background-color
120+
PASS mathsize on the msup element is mapped to CSS font-size
121+
PASS deprecated MathML3 attributes on the msup element are not mapped to CSS
122+
PASS dir on the mtable element is mapped to CSS direction
123+
PASS mathcolor on the mtable element is mapped to CSS color
124+
PASS mathbackground on the mtable element is mapped to CSS background-color
125+
PASS mathsize on the mtable element is mapped to CSS font-size
126+
PASS deprecated MathML3 attributes on the mtable element are not mapped to CSS
127+
PASS dir on the mtd element is mapped to CSS direction
128+
PASS mathcolor on the mtd element is mapped to CSS color
129+
PASS mathbackground on the mtd element is mapped to CSS background-color
130+
PASS mathsize on the mtd element is mapped to CSS font-size
131+
PASS deprecated MathML3 attributes on the mtd element are not mapped to CSS
132+
PASS dir on the mtext element is mapped to CSS direction
133+
PASS mathcolor on the mtext element is mapped to CSS color
134+
PASS mathbackground on the mtext element is mapped to CSS background-color
135+
PASS mathsize on the mtext element is mapped to CSS font-size
136+
PASS deprecated MathML3 attributes on the mtext element are not mapped to CSS
137+
PASS dir on the mtr element is mapped to CSS direction
138+
PASS mathcolor on the mtr element is mapped to CSS color
139+
PASS mathbackground on the mtr element is mapped to CSS background-color
140+
PASS mathsize on the mtr element is mapped to CSS font-size
141+
PASS deprecated MathML3 attributes on the mtr element are not mapped to CSS
142+
PASS dir on the munder element is mapped to CSS direction
143+
PASS mathcolor on the munder element is mapped to CSS color
144+
PASS mathbackground on the munder element is mapped to CSS background-color
145+
PASS mathsize on the munder element is mapped to CSS font-size
146+
PASS deprecated MathML3 attributes on the munder element are not mapped to CSS
147+
PASS dir on the munderover element is mapped to CSS direction
148+
PASS mathcolor on the munderover element is mapped to CSS color
149+
PASS mathbackground on the munderover element is mapped to CSS background-color
150+
PASS mathsize on the munderover element is mapped to CSS font-size
151+
PASS deprecated MathML3 attributes on the munderover element are not mapped to CSS
152+
PASS dir on the none element is mapped to CSS direction
153+
PASS mathcolor on the none element is mapped to CSS color
154+
PASS mathbackground on the none element is mapped to CSS background-color
155+
FAIL mathsize on the none element is mapped to CSS font-size assert_equals: no attribute expected "50px" but got "37.5px"
156+
PASS deprecated MathML3 attributes on the none element are not mapped to CSS
157+
PASS dir on the semantics element is mapped to CSS direction
158+
PASS mathcolor on the semantics element is mapped to CSS color
159+
PASS mathbackground on the semantics element is mapped to CSS background-color
160+
PASS mathsize on the semantics element is mapped to CSS font-size
161+
PASS deprecated MathML3 attributes on the semantics element are not mapped to CSS
162+
163+
164+
165+
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!DOCTYPE html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=true ] -->
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Attribute mapping</title>
6+
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#legacy-mathml-style-attributes">
7+
<link rel="help" href="https://mathml-refresh.github.io/mathml-core/#attributes-common-to-html-and-mathml-elements">
8+
<meta name="assert" content="Verify that dir, mathcolor, mathbackground and mathsize are mapped to CSS but that deprecated MathML3 attributes are not.">
9+
<script src="/resources/testharness.js"></script>
10+
<script src="/resources/testharnessreport.js"></script>
11+
<script src="/mathml/support/mathml-fragments.js"></script>
12+
<style>
13+
#container {
14+
color: blue;
15+
font-size: 50px;
16+
}
17+
</style>
18+
<script>
19+
setup({ explicit_done: true });
20+
window.addEventListener("load", runTests);
21+
function runTests() {
22+
var container = document.getElementById("container");
23+
for (tag in MathMLFragments) {
24+
container.insertAdjacentHTML("beforeend", `<math>${MathMLFragments[tag]}</math>`);
25+
}
26+
Array.from(document.getElementsByClassName("element")).forEach(element => {
27+
var tag = element.tagName;
28+
var style = window.getComputedStyle(element);
29+
30+
test(function() {
31+
assert_equals(style.getPropertyValue("direction"), "ltr", "no attribute");
32+
element.setAttribute("dir", "rtl");
33+
assert_equals(style.getPropertyValue("direction"), "rtl", "attribute specified");
34+
element.setAttribute("dir", "RtL");
35+
assert_equals(style.getPropertyValue("direction"), "rtl", "case insensitive");
36+
}, `dir on the ${tag} element is mapped to CSS direction`)
37+
38+
test(function() {
39+
assert_equals(style.getPropertyValue("color"),
40+
tag === "merror" ?
41+
"rgb(255, 0, 0)" : "rgb(0, 0, 255)",
42+
"no attribute");
43+
element.setAttribute("mathcolor", "black");
44+
assert_equals(style.getPropertyValue("color"), "rgb(0, 0, 0)", "attribute specified");
45+
// The color names are case-insensitive.
46+
// See https://www.w3.org/TR/css-color-3/#html4
47+
element.setAttribute("mathcolor", "GrEeN");
48+
assert_equals(style.getPropertyValue("color"), "rgb(0, 128, 0)", "case insensitive");
49+
}, `mathcolor on the ${tag} element is mapped to CSS color`);
50+
51+
test(function() {
52+
assert_equals(style.getPropertyValue("background-color"),
53+
tag === "merror" ?
54+
"rgb(255, 255, 224)" : "rgba(0, 0, 0, 0)",
55+
"no attribute");
56+
element.setAttribute("mathbackground", "lightblue");
57+
assert_equals(style.getPropertyValue("background-color"), "rgb(173, 216, 230)", "attribute specified");
58+
// The color names are case-insensitive.
59+
// See https://www.w3.org/TR/css-color-3/#html4
60+
element.setAttribute("mathbackground", "YeLlOw");
61+
assert_equals(style.getPropertyValue("background-color"), "rgb(255, 255, 0)", "case insensitive");
62+
}, `mathbackground on the ${tag} element is mapped to CSS background-color`);
63+
64+
test(function() {
65+
assert_equals(style.getPropertyValue("font-size"), "50px", "no attribute");
66+
element.setAttribute("mathsize", "20px");
67+
assert_equals(style.getPropertyValue("font-size"), "20px", "attribute specified");
68+
// unit identifiers are ASCII case-insensitive.
69+
// https://www.w3.org/TR/css-values-3/#typedef-dimension
70+
element.setAttribute("mathsize", "30Px");
71+
assert_equals(style.getPropertyValue("font-size"), "30px", "case insensitive");
72+
}, `mathsize on the ${tag} element is mapped to CSS font-size`);
73+
74+
test(function() {
75+
var properties = ["background-color", "color", "fontfamily", "font-size", "font-style", "font-weight"];
76+
var oldStyle = {};
77+
properties.forEach(property => {
78+
oldStyle[property] = style.getPropertyValue(property);
79+
});
80+
element.setAttribute("background", "red");
81+
element.setAttribute("color", "blue");
82+
element.setAttribute("fontfamily", "monospace");
83+
element.setAttribute("fontsize", "50px");
84+
element.setAttribute("fontstyle", "italic");
85+
element.setAttribute("fontweight", "bold");
86+
properties.forEach(property => {
87+
assert_equals(style.getPropertyValue(property), oldStyle[property], `${property}`);
88+
});
89+
}, `deprecated MathML3 attributes on the ${tag} element are not mapped to CSS`);
90+
});
91+
92+
done();
93+
}
94+
</script>
95+
</head>
96+
<body>
97+
<div id="log"></div>
98+
<div id="container">
99+
<math class="element"></math>
100+
</div>
101+
</body>
102+
</html>

LayoutTests/mathml/presentation/attributes-background-color-expected.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!doctype html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
22
<html>
33
<head>
44
<title>background, color</title>

LayoutTests/mathml/presentation/attributes-background-color.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!doctype html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
22
<html>
33
<head>
44
<title>background, color</title>

LayoutTests/mathml/presentation/attributes-mathvariant.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!doctype html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
22
<html>
33
<head>
44
<title>mathvariant</title>

LayoutTests/mathml/presentation/direction-overall.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
22
<html>
33
<head><title>Test overall directionality</title></head>
44
<body>

LayoutTests/mathml/presentation/mstyle-css-attributes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!doctype html>
1+
<!doctype html><!-- webkit-test-runner [ experimental:CoreMathMLEnabled=false ] -->
22
<html>
33
<head>
44
<title>mstyle css attributes</title>

Source/WebCore/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2019-09-09 Rob Buis <[email protected]>
2+
3+
[GTK][WPE] Remove attributes deprecated from MathML3
4+
https://bugs.webkit.org/show_bug.cgi?id=197492
5+
6+
Reviewed by Frédéric Wang.
7+
8+
Remove some MathML3 deprecated attributes:
9+
https://github.com/mathml-refresh/mathml/issues/5#issuecomment-475506856
10+
11+
This change also maps the dir attribute to direction for MathML Core.
12+
13+
Test: imported/w3c/web-platform-tests/mathml/relations/css-styling/attribute-mapping-001.html
14+
15+
* mathml/MathMLElement.cpp:
16+
(WebCore::MathMLElement::collectStyleForPresentationAttribute):
17+
118
2019-09-09 Youenn Fablet <[email protected]>
219

320
Move checkProcessLocalPortForActivity from provider to registry

0 commit comments

Comments
 (0)