Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Side by Side Diff: LayoutTests/svg/dom/content-model.html

Issue 1006863002: Some minor touch-ups to the SVG content-model test framework (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add text element classes. Drop some dead containers. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/svg/dom/content-model-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/svgtags.js"></script> 5 <script src="resources/svgtags.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <div id="console"></div> 8 <div id="console"></div>
9 <div id="container" style="position: fixed;"></div> 9 <div id="container" style="position: fixed;"></div>
10 10
11 <script> 11 <script>
12 var svgNS = "http://www.w3.org/2000/svg"; 12 var svgNS = "http://www.w3.org/2000/svg";
13 13
14 function createNode(tag, container) { 14 function createNode(tag, container) {
15 var node = document.createElementNS(svgNS, tag); 15 var node = document.createElementNS(svgNS, tag);
16 container.appendChild(node); 16 container.appendChild(node);
17 return node; 17 return node;
18 } 18 }
19 19
20 function createValidNode(tag, container, createAncestors) { 20 function createValidNode(tag, container, createAncestors) {
21 var realContainer = container; 21 var realContainer = container;
22 22
23 if (createAncestors && SvgTags[tag].needParent) 23 if (createAncestors && SvgTags[tag].needParent)
24 realContainer = createValidNode(SvgTags[tag].needParent, container, tr ue); 24 realContainer = createValidNode(SvgTags[tag].needParent, container, tr ue);
25 25
26 var node = createNode(tag, realContainer); 26 var node = createNode(tag, realContainer);
27 for (var attr in SvgTags[tag].needAttr) 27 for (var attr in SvgTags[tag].needAttr)
28 node.setAttribute(attr, SvgTags[tag].needAttr[attr]); 28 node.setAttribute(attr, SvgTags[tag].needAttr[attr]);
29 29
30 var requiredChildren = SvgTags[tag].needChld; 30 var requiredChildren = SvgTags[tag].needChild || [];
31 if (requiredChildren) { 31 for (var childTag of requiredChildren)
32 for (var i = 0; i < requiredChildren.length; i++) 32 createValidNode(childTag, node, false);
33 createValidNode(requiredChildren[i], node, false);
34 }
35 33
36 return node; 34 return node;
37 } 35 }
38 36
39 function expandClasses(tags) { 37 function expandClasses(tags) {
40 var expandedTags = []; 38 var expandedTags = [];
41 for (var i = 0; i < tags.length; i++) { 39 for (var tag of tags)
42 if (SvgTagClasses[tags[i]]) 40 Array.prototype.push.apply(expandedTags, SvgTagClasses[tag] || [tag]);
43 expandedTags = expandedTags.concat(SvgTagClasses[tags[i]]);
44 else
45 expandedTags.push(tags[i]);
46 }
47
48 return expandedTags; 41 return expandedTags;
49 } 42 }
50 43
51 function createsRenderer(parentTag, childTag) { 44 function createsRenderer(parentTag, childTag) {
52 var divContainer = document.getElementById('container'); 45 var divContainer = document.getElementById('container');
53 var svgContainer = createNode('svg', divContainer); 46 var svgContainer = createNode('svg', divContainer);
54 var parentNode = createValidNode(parentTag, svgContainer, true); 47 var parentNode = createValidNode(parentTag, svgContainer, true);
55 createValidNode(childTag, parentNode, false); 48 createValidNode(childTag, parentNode, false);
56 49
57 var drt = internals.elementLayoutTreeAsText(divContainer); 50 var drt = internals.elementLayoutTreeAsText(divContainer);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 91 }
99 } 92 }
100 93
101 94
102 if (!window.testRunner || !window.internals) 95 if (!window.testRunner || !window.internals)
103 testFailed('this test requires DumpRenderTree.'); 96 testFailed('this test requires DumpRenderTree.');
104 97
105 description('This test validates renderer instantiation against the SVG co ntent model.'); 98 description('This test validates renderer instantiation against the SVG co ntent model.');
106 99
107 validateTag('filter', [ 100 validateTag('filter', [
108 // http://www.w3.org/TR/SVG/filters.html#FilterElement 101 // http://dev.w3.org/fxtf/filters/#FilterElement
109 'CLASS_DESCRIPTIVE', 'CLASS_FILTER_PRIMITIVE', 'animate', 'feDropShadow' , 'set' 102 'CLASS_DESCRIPTIVE', 'CLASS_FILTER_PRIMITIVE', 'animate', 'set'
110 ]); 103 ]);
111 </script> 104 </script>
112 </body> 105 </body>
113 </html> 106 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/svg/dom/content-model-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698