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)
; | 15 InspectorTest.sendCommandOrDie("DOM.getDocument", {"depth": -1}, onDocument)
; |
16 | 16 |
17 function onDocument(response) { | 17 function onDocument(response) { |
18 var whitelist = ["transform", "transform-origin", "height", "width", "di
splay", "outline-color"]; | 18 var whitelist = ["transform", "transform-origin", "height", "width", "di
splay", "outline-color"]; |
19 InspectorTest.sendCommandOrDie("CSS.getLayoutTreeAndStyles", {"computedS
tyleWhitelist": whitelist}, onLayoutTreeNodes); | 19 InspectorTest.sendCommandOrDie("CSS.getLayoutTreeAndStyles", {"computedS
tyleWhitelist": whitelist}, onLayoutTreeNodes); |
20 } | 20 } |
21 | 21 |
22 function onLayoutTreeNodes(response) | 22 function onLayoutTreeNodes(response) |
23 { | 23 { |
24 InspectorTest.log("\nLayoutTreeNodes result:"); | 24 InspectorTest.log("\nLayoutTreeNodes result:"); |
25 canonicalizeBackendNodeIds(response); | |
26 InspectorTest.log(JSON.stringify(response, null, 2)); | 25 InspectorTest.log(JSON.stringify(response, null, 2)); |
27 InspectorTest.completeTest(); | 26 InspectorTest.completeTest(); |
28 } | 27 } |
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 } | 28 } |
46 | 29 |
47 </script> | 30 </script> |
48 <template id="shadow-template"> | 31 <template id="shadow-template"> |
49 <style> | 32 <style> |
50 :host { | 33 :host { |
51 color: red; | 34 color: red; |
52 } | 35 } |
53 </style> | 36 </style> |
54 <div style="font-family: ahem;"><h1>Hi!</h1></div> | 37 <div style="font-family: ahem;"><h1>Hi!</h1></div> |
(...skipping 20 matching lines...) Expand all Loading... |
75 <script type="text/javascript"> | 58 <script type="text/javascript"> |
76 var host = document.querySelector("#shadow-host").createShadowRoot(); | 59 var host = document.querySelector("#shadow-host").createShadowRoot(); |
77 var template = document.querySelector("#shadow-template"); | 60 var template = document.querySelector("#shadow-template"); |
78 host.appendChild(template.content); | 61 host.appendChild(template.content); |
79 template.remove(); | 62 template.remove(); |
80 window.onload = runTest; | 63 window.onload = runTest; |
81 </script> | 64 </script> |
82 </div> | 65 </div> |
83 </body> | 66 </body> |
84 </html> | 67 </html> |
OLD | NEW |