Skip to content

Commit 83e92a3

Browse files
annevkrwlbuis
authored andcommitted
HTML parser: only adjust approved SVG and MathML attributes
https://bugs.webkit.org/show_bug.cgi?id=254755 rdar://107428878 Reviewed by Chris Dumez. Instead of the HTML parser using global lists of SVG, MathML, XLink, and XML attributes, define them locally as the HTML Standard does. As the HTML parser is the sole consumer of these lists that allows them to be smaller and also makes it clearer that any new attributes should follow HTML naming conventions. Additionally this removes a number of unused attributes: - SVG contentScriptType - SVG contentStyleType - SVG externalResourcesRequired - XML xml:base * LayoutTests/html5lib/resources/tests11.dat: * LayoutTests/html5lib/resources/webkit02.dat: * LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=uri-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=write-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=write_single-expected.txt: * Source/WebCore/WebCore.order: * Source/WebCore/dom/make_names.pl: (printConstructorInterior): (upperCaseName): (printNamesHeaderFile): (printNamesCppFile): (printWrapperFactoryHeaderFile): * Source/WebCore/html/parser/HTMLTreeBuilder.cpp: (WebCore::createSVGAttributesMap): (WebCore::adjustSVGAttributes): (WebCore::createMathMLAttributesMap): (WebCore::adjustMathMLAttributes): (WebCore::createForeignAttributesMap): (WebCore::createCaseMap): Deleted. * Source/WebCore/mathml/mathattrs.in: * Source/WebCore/svg/SVGElement.cpp: (WebCore::SVGElement::addEventListener): (WebCore::SVGElement::childShouldCreateRenderer const): (WebCore::SVGElement::createAnimator): (WebCore::SVGElement::animatableAttributeForName): * Source/WebCore/svg/svgattrs.in: * Source/WebCore/xml/xmlattrs.in: Canonical link: https://commits.webkit.org/262502@main
1 parent df53f7d commit 83e92a3

File tree

12 files changed

+182
-414
lines changed

12 files changed

+182
-414
lines changed

LayoutTests/html5lib/resources/tests11.dat

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
| baseProfile=""
1414
| calcMode=""
1515
| clipPathUnits=""
16-
| contentScriptType=""
17-
| contentStyleType=""
16+
| contentscripttype=""
17+
| contentstyletype=""
1818
| diffuseConstant=""
1919
| edgeMode=""
20-
| externalResourcesRequired=""
20+
| externalresourcesrequired=""
2121
| filterUnits=""
2222
| glyphRef=""
2323
| gradientTransform=""
@@ -84,11 +84,11 @@
8484
| baseProfile=""
8585
| calcMode=""
8686
| clipPathUnits=""
87-
| contentScriptType=""
88-
| contentStyleType=""
87+
| contentscripttype=""
88+
| contentstyletype=""
8989
| diffuseConstant=""
9090
| edgeMode=""
91-
| externalResourcesRequired=""
91+
| externalresourcesrequired=""
9292
| filterUnits=""
9393
| glyphRef=""
9494
| gradientTransform=""
@@ -155,11 +155,11 @@
155155
| baseProfile=""
156156
| calcMode=""
157157
| clipPathUnits=""
158-
| contentScriptType=""
159-
| contentStyleType=""
158+
| contentscripttype=""
159+
| contentstyletype=""
160160
| diffuseConstant=""
161161
| edgeMode=""
162-
| externalResourcesRequired=""
162+
| externalresourcesrequired=""
163163
| filterUnits=""
164164
| glyphRef=""
165165
| gradientTransform=""

LayoutTests/html5lib/resources/webkit02.dat

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,39 @@ select
199199
| <body>
200200
| <plaintext>
201201
| "<div>foo</div>"
202+
203+
#data
204+
<svg xml:base xml:lang xml:space xml:baaah definitionurl>
205+
#errors
206+
#document
207+
| <html>
208+
| <head>
209+
| <body>
210+
| <svg svg>
211+
| definitionurl=""
212+
| xml lang=""
213+
| xml space=""
214+
| xml:baaah=""
215+
| xml:base=""
216+
217+
#data
218+
<math definitionurl xlink:title xlink:show>
219+
#errors
220+
#document
221+
| <html>
222+
| <head>
223+
| <body>
224+
| <math math>
225+
| definitionURL=""
226+
| xlink show=""
227+
| xlink title=""
228+
229+
#data
230+
<math DEFINITIONURL>
231+
#errors
232+
#document
233+
| <html>
234+
| <head>
235+
| <body>
236+
| <math math>
237+
| definitionURL=""

LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=uri-expected.txt

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -8,100 +8,13 @@ PASS html5lib_tests11.html ba7a66dfcf59885c08e8638d15b01df3878531e7
88
PASS html5lib_tests11.html e69c7c08a54ca868ab33b2825d998fa6c3cac90e
99
PASS html5lib_tests11.html 0e5897aafe87e460f84576c2d1d983504d12a7db
1010
PASS html5lib_tests11.html f71dd198831309fc9ccd66ef91cde63fda9b9bda
11-
FAIL html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
12-
FAIL html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
13-
FAIL html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3 assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
11+
PASS html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b
12+
PASS html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
13+
PASS html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3
1414
PASS html5lib_tests11.html 8f77b846acce75edf1988ea655c79f1de4321de9
1515
PASS html5lib_tests11.html 39c50f080b2b9ae9e7a1070679ab97d7b814f9ec
1616
PASS html5lib_tests11.html 6d1fa1599f75625fe4d019abb04a064cf6ed39e8
1717
PASS html5lib_tests11.html 791437ece7ba684e00162d1dd79dfe540e3621a7
1818
PASS html5lib_tests11.html af40d26164229c29b9be77ed6dd7dda780cba55c
1919
PASS html5lib_tests11.html 16e68d18f8f0fb81013fe77a30b7d396c5081e5e
20-
a8f7a23601363454b4a13f66aed99ec9708ae87b
21-
22-
Input
23-
24-
<!DOCTYPE html><body><svg contentScriptType='' contentStyleType='' externalResourcesRequired='' filterRes=''></svg>
25-
Expected
26-
27-
#document
28-
| <!DOCTYPE html>
29-
| <html>
30-
| <head>
31-
| <body>
32-
| <svg svg>
33-
| contentscripttype=""
34-
| contentstyletype=""
35-
| externalresourcesrequired=""
36-
| filterres=""
37-
Actual
38-
39-
#document
40-
| <!DOCTYPE html>
41-
| <html>
42-
| <head>
43-
| <body>
44-
| <svg svg>
45-
| contentScriptType=""
46-
| contentStyleType=""
47-
| externalResourcesRequired=""
48-
| filterres=""
49-
f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
50-
51-
Input
52-
53-
<!DOCTYPE html><body><svg CONTENTSCRIPTTYPE='' CONTENTSTYLETYPE='' EXTERNALRESOURCESREQUIRED='' FILTERRES=''></svg>
54-
Expected
55-
56-
#document
57-
| <!DOCTYPE html>
58-
| <html>
59-
| <head>
60-
| <body>
61-
| <svg svg>
62-
| contentscripttype=""
63-
| contentstyletype=""
64-
| externalresourcesrequired=""
65-
| filterres=""
66-
Actual
67-
68-
#document
69-
| <!DOCTYPE html>
70-
| <html>
71-
| <head>
72-
| <body>
73-
| <svg svg>
74-
| contentScriptType=""
75-
| contentStyleType=""
76-
| externalResourcesRequired=""
77-
| filterres=""
78-
fb4dc9f70129a8a045fca3a1e3acee052d0990b3
79-
80-
Input
81-
82-
<!DOCTYPE html><body><svg contentscripttype='' contentstyletype='' externalresourcesrequired='' filterres=''></svg>
83-
Expected
84-
85-
#document
86-
| <!DOCTYPE html>
87-
| <html>
88-
| <head>
89-
| <body>
90-
| <svg svg>
91-
| contentscripttype=""
92-
| contentstyletype=""
93-
| externalresourcesrequired=""
94-
| filterres=""
95-
Actual
96-
97-
#document
98-
| <!DOCTYPE html>
99-
| <html>
100-
| <head>
101-
| <body>
102-
| <svg svg>
103-
| contentScriptType=""
104-
| contentStyleType=""
105-
| externalResourcesRequired=""
106-
| filterres=""
10720

LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=write-expected.txt

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -8,100 +8,13 @@ PASS html5lib_tests11.html ba7a66dfcf59885c08e8638d15b01df3878531e7
88
PASS html5lib_tests11.html e69c7c08a54ca868ab33b2825d998fa6c3cac90e
99
PASS html5lib_tests11.html 0e5897aafe87e460f84576c2d1d983504d12a7db
1010
PASS html5lib_tests11.html f71dd198831309fc9ccd66ef91cde63fda9b9bda
11-
FAIL html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
12-
FAIL html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
13-
FAIL html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3 assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
11+
PASS html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b
12+
PASS html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
13+
PASS html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3
1414
PASS html5lib_tests11.html 8f77b846acce75edf1988ea655c79f1de4321de9
1515
PASS html5lib_tests11.html 39c50f080b2b9ae9e7a1070679ab97d7b814f9ec
1616
PASS html5lib_tests11.html 6d1fa1599f75625fe4d019abb04a064cf6ed39e8
1717
PASS html5lib_tests11.html 791437ece7ba684e00162d1dd79dfe540e3621a7
1818
PASS html5lib_tests11.html af40d26164229c29b9be77ed6dd7dda780cba55c
1919
PASS html5lib_tests11.html 16e68d18f8f0fb81013fe77a30b7d396c5081e5e
20-
a8f7a23601363454b4a13f66aed99ec9708ae87b
21-
22-
Input
23-
24-
<!DOCTYPE html><body><svg contentScriptType='' contentStyleType='' externalResourcesRequired='' filterRes=''></svg>
25-
Expected
26-
27-
#document
28-
| <!DOCTYPE html>
29-
| <html>
30-
| <head>
31-
| <body>
32-
| <svg svg>
33-
| contentscripttype=""
34-
| contentstyletype=""
35-
| externalresourcesrequired=""
36-
| filterres=""
37-
Actual
38-
39-
#document
40-
| <!DOCTYPE html>
41-
| <html>
42-
| <head>
43-
| <body>
44-
| <svg svg>
45-
| contentScriptType=""
46-
| contentStyleType=""
47-
| externalResourcesRequired=""
48-
| filterres=""
49-
f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
50-
51-
Input
52-
53-
<!DOCTYPE html><body><svg CONTENTSCRIPTTYPE='' CONTENTSTYLETYPE='' EXTERNALRESOURCESREQUIRED='' FILTERRES=''></svg>
54-
Expected
55-
56-
#document
57-
| <!DOCTYPE html>
58-
| <html>
59-
| <head>
60-
| <body>
61-
| <svg svg>
62-
| contentscripttype=""
63-
| contentstyletype=""
64-
| externalresourcesrequired=""
65-
| filterres=""
66-
Actual
67-
68-
#document
69-
| <!DOCTYPE html>
70-
| <html>
71-
| <head>
72-
| <body>
73-
| <svg svg>
74-
| contentScriptType=""
75-
| contentStyleType=""
76-
| externalResourcesRequired=""
77-
| filterres=""
78-
fb4dc9f70129a8a045fca3a1e3acee052d0990b3
79-
80-
Input
81-
82-
<!DOCTYPE html><body><svg contentscripttype='' contentstyletype='' externalresourcesrequired='' filterres=''></svg>
83-
Expected
84-
85-
#document
86-
| <!DOCTYPE html>
87-
| <html>
88-
| <head>
89-
| <body>
90-
| <svg svg>
91-
| contentscripttype=""
92-
| contentstyletype=""
93-
| externalresourcesrequired=""
94-
| filterres=""
95-
Actual
96-
97-
#document
98-
| <!DOCTYPE html>
99-
| <html>
100-
| <head>
101-
| <body>
102-
| <svg svg>
103-
| contentScriptType=""
104-
| contentStyleType=""
105-
| externalResourcesRequired=""
106-
| filterres=""
10720

LayoutTests/imported/w3c/web-platform-tests/html/syntax/parsing/html5lib_tests11_run_type=write_single-expected.txt

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -8,100 +8,13 @@ PASS html5lib_tests11.html ba7a66dfcf59885c08e8638d15b01df3878531e7
88
PASS html5lib_tests11.html e69c7c08a54ca868ab33b2825d998fa6c3cac90e
99
PASS html5lib_tests11.html 0e5897aafe87e460f84576c2d1d983504d12a7db
1010
PASS html5lib_tests11.html f71dd198831309fc9ccd66ef91cde63fda9b9bda
11-
FAIL html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
12-
FAIL html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
13-
FAIL html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3 assert_equals: expected "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentscripttype=\"\"\n| contentstyletype=\"\"\n| externalresourcesrequired=\"\"\n| filterres=\"\"" but got "#document\n| <!DOCTYPE html>\n| <html>\n| <head>\n| <body>\n| <svg svg>\n| contentScriptType=\"\"\n| contentStyleType=\"\"\n| externalResourcesRequired=\"\"\n| filterres=\"\""
11+
PASS html5lib_tests11.html a8f7a23601363454b4a13f66aed99ec9708ae87b
12+
PASS html5lib_tests11.html f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
13+
PASS html5lib_tests11.html fb4dc9f70129a8a045fca3a1e3acee052d0990b3
1414
PASS html5lib_tests11.html 8f77b846acce75edf1988ea655c79f1de4321de9
1515
PASS html5lib_tests11.html 39c50f080b2b9ae9e7a1070679ab97d7b814f9ec
1616
PASS html5lib_tests11.html 6d1fa1599f75625fe4d019abb04a064cf6ed39e8
1717
PASS html5lib_tests11.html 791437ece7ba684e00162d1dd79dfe540e3621a7
1818
PASS html5lib_tests11.html af40d26164229c29b9be77ed6dd7dda780cba55c
1919
PASS html5lib_tests11.html 16e68d18f8f0fb81013fe77a30b7d396c5081e5e
20-
a8f7a23601363454b4a13f66aed99ec9708ae87b
21-
22-
Input
23-
24-
<!DOCTYPE html><body><svg contentScriptType='' contentStyleType='' externalResourcesRequired='' filterRes=''></svg>
25-
Expected
26-
27-
#document
28-
| <!DOCTYPE html>
29-
| <html>
30-
| <head>
31-
| <body>
32-
| <svg svg>
33-
| contentscripttype=""
34-
| contentstyletype=""
35-
| externalresourcesrequired=""
36-
| filterres=""
37-
Actual
38-
39-
#document
40-
| <!DOCTYPE html>
41-
| <html>
42-
| <head>
43-
| <body>
44-
| <svg svg>
45-
| contentScriptType=""
46-
| contentStyleType=""
47-
| externalResourcesRequired=""
48-
| filterres=""
49-
f8f7f6c576acc9eb874acb0dce6988f0f7b6fc5f
50-
51-
Input
52-
53-
<!DOCTYPE html><body><svg CONTENTSCRIPTTYPE='' CONTENTSTYLETYPE='' EXTERNALRESOURCESREQUIRED='' FILTERRES=''></svg>
54-
Expected
55-
56-
#document
57-
| <!DOCTYPE html>
58-
| <html>
59-
| <head>
60-
| <body>
61-
| <svg svg>
62-
| contentscripttype=""
63-
| contentstyletype=""
64-
| externalresourcesrequired=""
65-
| filterres=""
66-
Actual
67-
68-
#document
69-
| <!DOCTYPE html>
70-
| <html>
71-
| <head>
72-
| <body>
73-
| <svg svg>
74-
| contentScriptType=""
75-
| contentStyleType=""
76-
| externalResourcesRequired=""
77-
| filterres=""
78-
fb4dc9f70129a8a045fca3a1e3acee052d0990b3
79-
80-
Input
81-
82-
<!DOCTYPE html><body><svg contentscripttype='' contentstyletype='' externalresourcesrequired='' filterres=''></svg>
83-
Expected
84-
85-
#document
86-
| <!DOCTYPE html>
87-
| <html>
88-
| <head>
89-
| <body>
90-
| <svg svg>
91-
| contentscripttype=""
92-
| contentstyletype=""
93-
| externalresourcesrequired=""
94-
| filterres=""
95-
Actual
96-
97-
#document
98-
| <!DOCTYPE html>
99-
| <html>
100-
| <head>
101-
| <body>
102-
| <svg svg>
103-
| contentScriptType=""
104-
| contentStyleType=""
105-
| externalResourcesRequired=""
106-
| filterres=""
10720

0 commit comments

Comments
 (0)