OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <style> | 3 <style> |
4 @font-face { | 4 @font-face { |
5 font-family: 'ahem'; | 5 font-family: 'ahem'; |
6 src: url(../../resources/Ahem.ttf); | 6 src: url(../../resources/Ahem.ttf); |
7 } | 7 } |
8 </style> | 8 </style> |
9 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | 9 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> |
10 <script> | 10 <script> |
11 | 11 |
12 function test() | 12 function test() |
13 { | 13 { |
14 InspectorTest.sendCommand("DOM.enable", {}); | 14 InspectorTest.sendCommand("DOM.enable", {}); |
15 InspectorTest.sendCommandOrDie("DOM.getDocument", {"depth": -1}, onDocument)
; | |
16 | 15 |
17 function onDocument(response) { | 16 var whitelist = ["transform", "transform-origin", "height", "width", "displa
y", "outline-color"]; |
18 var whitelist = ["transform", "transform-origin", "height", "width", "di
splay", "outline-color"]; | 17 InspectorTest.sendCommandOrDie("CSS.getDocumentSnapshot", {"computedStyleWhi
telist": whitelist, "depth": -1, "pierce": true}, onDocumentSnapshot); |
19 InspectorTest.sendCommandOrDie("CSS.getLayoutTreeAndStyles", {"computedS
tyleWhitelist": whitelist}, onLayoutTreeNodes); | |
20 } | |
21 | 18 |
22 function onLayoutTreeNodes(response) | 19 function onDocumentSnapshot(response) { |
23 { | 20 function stabilize(key, value) { |
24 InspectorTest.log("\nLayoutTreeNodes result:"); | 21 var unstableKeys = ["backendNodeId", "documentURL", "baseURL", "fram
eId"]; |
25 canonicalizeBackendNodeIds(response); | 22 if (unstableKeys.indexOf(key) !== -1) |
26 InspectorTest.log(JSON.stringify(response, null, 2)); | 23 return "<" + typeof(value) + ">"; |
| 24 return value; |
| 25 } |
| 26 InspectorTest.log(JSON.stringify(response, stabilize, 2)); |
27 InspectorTest.completeTest(); | 27 InspectorTest.completeTest(); |
28 } | 28 } |
29 | |
30 // While unique the backendNodeId IDs are not stable cross platform, so we c
anonicalize them. | |
31 var nextId = 1; | |
32 var nodeMap = {}; | |
33 function canonicalizeBackendNodeIds(node) { | |
34 if (node.hasOwnProperty('backendNodeId')) { | |
35 if (!nodeMap.hasOwnProperty(node.backendNodeId)) { | |
36 nodeMap[node.backendNodeId] = nextId++; | |
37 } | |
38 node.backendNodeId = nodeMap[node.backendNodeId]; | |
39 } | |
40 for (var property in node) { | |
41 if (!node.hasOwnProperty(property) || typeof node[property] === 'obj
ect') | |
42 canonicalizeBackendNodeIds(node[property]); | |
43 } | |
44 } | |
45 } | 29 } |
46 | 30 |
47 </script> | 31 </script> |
48 <template id="shadow-template"> | 32 <template id="shadow-template"> |
49 <style> | 33 <style> |
50 :host { | 34 :host { |
51 color: red; | 35 color: red; |
52 } | 36 } |
53 </style> | 37 </style> |
54 <div style="font-family: ahem;"><h1>Hi!</h1></div> | 38 <div style="font-family: ahem;"><h1>Hi!</h1></div> |
(...skipping 20 matching lines...) Expand all Loading... |
75 <script type="text/javascript"> | 59 <script type="text/javascript"> |
76 var host = document.querySelector("#shadow-host").createShadowRoot(); | 60 var host = document.querySelector("#shadow-host").createShadowRoot(); |
77 var template = document.querySelector("#shadow-template"); | 61 var template = document.querySelector("#shadow-template"); |
78 host.appendChild(template.content); | 62 host.appendChild(template.content); |
79 template.remove(); | 63 template.remove(); |
80 window.onload = runTest; | 64 window.onload = runTest; |
81 </script> | 65 </script> |
82 </div> | 66 </div> |
83 </body> | 67 </body> |
84 </html> | 68 </html> |
OLD | NEW |