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

Side by Side Diff: LayoutTests/svg/custom/dynamic-svg-document-creation.svg

Issue 146193003: Remove SVGDocument binding (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase against ToT Created 6 years, 10 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
OLDNEW
1 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?> 1 <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2 <svg onload="init()" width="100%" height="100%" xmlns="http://www.w3.org/2000/sv g"> 2 <svg onload="init()" width="100%" height="100%" xmlns="http://www.w3.org/2000/sv g">
3 <foreignObject width="100%" height="100%"> 3 <foreignObject width="100%" height="100%">
4 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <html xmlns="http://www.w3.org/1999/xhtml">
5 <div id="log"> 5 <div id="log">
6 This tests assures dynamic SVGDocument creation via DOMParser interf ace works. 6 This tests assures dynamic SVGDocument creation via DOMParser interf ace works.
7 </div> 7 </div>
8 </html> 8 </html>
9 </foreignObject> 9 </foreignObject>
10 10
11 <script> 11 <script>
12 <![CDATA[ 12 <![CDATA[
13 if (window.testRunner) {
14 testRunner.dumpAsText();
15 }
16
13 function log(message) { 17 function log(message) {
14 var logDiv = document.getElementById('log'); 18 var logDiv = document.getElementById('log');
15 var newDiv = document.createElementNS("http://www.w3.org/1999/xhtml",'div'); 19 var newDiv = document.createElementNS("http://www.w3.org/1999/xhtml",'div');
16 newDiv.appendChild(document.createTextNode(message)); 20 newDiv.appendChild(document.createTextNode(message));
17 logDiv.appendChild(newDiv); 21 logDiv.appendChild(newDiv);
18 } 22 }
19 23
20 function init() { 24 function init() {
21 // Prepare SVG Content as string. 25 // Prepare SVG Content as string.
22 var documentString = "<svg xmlns='http://www.w3.org/2000/svg' width='400' he ight='400'>" + 26 var documentString = "<svg xmlns='http://www.w3.org/2000/svg' width='400' he ight='400'>" +
23 "<g transform='translate(-50, -50)'>" + 27 "<g transform='translate(-50, -50)'>" +
24 "<path id='path' onclick='mouseHandler(evt)' fill='#FF0 000' stroke='#00C000' " + 28 "<path id='path' onclick='mouseHandler(evt)' fill='#FF0 000' stroke='#00C000' " +
25 "d='M 250 130 C 185 130 150 80 150 80 S 115 25 50 25 m 0 105 c 65 0 100 -50 100 -50 s 35 -55 100 -55'/>" + 29 "d='M 250 130 C 185 130 150 80 150 80 S 115 25 50 25 m 0 105 c 65 0 100 -50 100 -50 s 35 -55 100 -55'/>" +
26 "</g></svg>"; 30 "</g></svg>";
27 31
28 // Use DOMParser interface to create a SVGDocument datastructure from SVG co ntent string 32 // Use DOMParser interface to create a SVGDocument datastructure from SVG co ntent string
29 var parser = new DOMParser(); 33 var parser = new DOMParser();
30 var svgDocument = parser.parseFromString(documentString, "image/svg+xml"); 34 var svgDocument = parser.parseFromString(documentString, "image/svg+xml");
31 35
32 log("DOMParser.parseFromString returned: " + svgDocument + " should be: [obj ect SVGDocument]"); 36 log("DOMParser.parseFromString returned: " + svgDocument + " should be: [obj ect XMLDocument]");
33 37
34 // Try some operations on the new document 38 // Try some operations on the new document
35 log("SVGDocument's rootElement: " + svgDocument.rootElement + " should be: [ object SVGSVGElement]"); 39 log("SVGDocument's rootElement: " + svgDocument.rootElement + " should be: [ object SVGSVGElement]");
36 log("SVGDocument's rootElement width: " + svgDocument.rootElement.width.base Val.value + " should be: 400"); 40 log("SVGDocument's rootElement width: " + svgDocument.rootElement.width.base Val.value + " should be: 400");
37 log("SVGDocument's rootElement height: " + svgDocument.rootElement.height.ba seVal.value + " should be: 400"); 41 log("SVGDocument's rootElement height: " + svgDocument.rootElement.height.ba seVal.value + " should be: 400");
38 log("SVGDocument's rootElement first child: " + svgDocument.rootElement.firs tChild + " should be: [object SVGGElement]"); 42 log("SVGDocument's rootElement first child: " + svgDocument.rootElement.firs tChild + " should be: [object SVGGElement]");
39 43
40 // Use XMLSerializer interface to return a textual presentation of the newly created document 44 // Use XMLSerializer interface to return a textual presentation of the newly created document
41 var serializer = new XMLSerializer(); 45 var serializer = new XMLSerializer();
42 var svgDocumentString = serializer.serializeToString(svgDocument); 46 var svgDocumentString = serializer.serializeToString(svgDocument);
43 47
44 log("XMLSerializer.serializeToString returned: " + svgDocumentString); 48 log("XMLSerializer.serializeToString returned: " + svgDocumentString);
45 49
46 // Import all children of the new document's root element in our current doc ument 50 // Import all children of the new document's root element in our current doc ument
47 var importedNode = document.importNode(svgDocument.rootElement.firstChild, t rue); 51 var importedNode = document.importNode(svgDocument.rootElement.firstChild, t rue);
48 log("Imported the SVGGElement into our document: " + importedNode + " should be: [object SVGGElement]"); 52 log("Imported the SVGGElement into our document: " + importedNode + " should be: [object SVGGElement]");
49 53
50 document.getElementById("content").appendChild(importedNode); 54 document.getElementById("content").appendChild(importedNode);
51 } 55 }
52 ]]> 56 ]]>
53 </script> 57 </script>
54 <g id="content" transform="translate(250, 250) rotate(45)"> 58 <g id="content" transform="translate(250, 250) rotate(45)">
55 </g> 59 </g>
56 </svg> 60 </svg>
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/clone-node-expected.txt ('k') | LayoutTests/svg/custom/dynamic-svg-document-creation-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698