| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../../http/tests/inspector/elements-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/timeline-test.js"></script> | 5 <script src="../../../http/tests/inspector/timeline-test.js"></script> |
| 6 <style> | 6 <style> |
| 7 .relayout-boundary { | 7 .relayout-boundary { |
| 8 overflow: hidden; | 8 overflow: hidden; |
| 9 width: 100px; | 9 width: 100px; |
| 10 height: 100px; | 10 height: 100px; |
| 11 } | 11 } |
| 12 </style> | 12 </style> |
| 13 <script> | 13 <script> |
| 14 | 14 |
| 15 function performActions() | 15 function performActions() |
| 16 { | 16 { |
| 17 var element = document.getElementById("invalidate1"); | 17 var element = document.getElementById("invalidate1"); |
| 18 element.style.marginTop = "10px"; | 18 element.style.marginTop = "10px"; |
| 19 var unused = element.offsetHeight; | 19 var unused = element.offsetHeight; |
| 20 } | 20 } |
| 21 | 21 |
| 22 function test() | 22 function test() |
| 23 { | 23 { |
| 24 InspectorTest.evaluateInPage("var unused = document.body.offsetWidth;", func
tion() { | 24 InspectorTest.evaluateInPage("var unused = document.body.offsetWidth;", func
tion() { |
| 25 InspectorTest.evaluateWithTimeline("performActions()", onTimelineRecord
ed); | 25 InspectorTest.evaluateWithTimeline("performActions()", onTimelineRecord
ed); |
| 26 }); | 26 }); |
| 27 | 27 |
| 28 function clickValueLink(record, row) | 28 function clickValueLink(record, row) |
| 29 { | 29 { |
| 30 var panel = WebInspector.panels.timeline; | 30 var panel = UI.panels.timeline; |
| 31 WebInspector.TimelineUIUtils.buildTraceEventDetails(record.traceEvent(),
panel._model, new WebInspector.Linkifier(), true, onDetailsContentReady); | 31 Timeline.TimelineUIUtils.buildTraceEventDetails(record.traceEvent(), pan
el._model, new Components.Linkifier(), true, onDetailsContentReady); |
| 32 | 32 |
| 33 function onDetailsContentReady(element) | 33 function onDetailsContentReady(element) |
| 34 { | 34 { |
| 35 var rows = element.querySelectorAll(".timeline-details-view-row"); | 35 var rows = element.querySelectorAll(".timeline-details-view-row"); |
| 36 for (var i = 0; i < rows.length; ++i) { | 36 for (var i = 0; i < rows.length; ++i) { |
| 37 if (rows[i].firstChild.textContent.indexOf(row) !== -1) { | 37 if (rows[i].firstChild.textContent.indexOf(row) !== -1) { |
| 38 rows[i].lastChild.firstChild.shadowRoot.lastChild.click(); | 38 rows[i].lastChild.firstChild.shadowRoot.lastChild.click(); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 function onTimelineRecorded(records) | 45 function onTimelineRecorded(records) |
| 46 { | 46 { |
| 47 var layoutRecord = InspectorTest.findFirstTimelineRecord("Layout"); | 47 var layoutRecord = InspectorTest.findFirstTimelineRecord("Layout"); |
| 48 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onSel
ectedNodeChanged); | 48 UI.context.addFlavorChangeListener(SDK.DOMNode, onSelectedNodeChanged); |
| 49 clickValueLink(layoutRecord, "Layout root"); | 49 clickValueLink(layoutRecord, "Layout root"); |
| 50 } | 50 } |
| 51 | 51 |
| 52 function onSelectedNodeChanged() | 52 function onSelectedNodeChanged() |
| 53 { | 53 { |
| 54 var node = WebInspector.panels.elements.selectedDOMNode(); | 54 var node = UI.panels.elements.selectedDOMNode(); |
| 55 // We may first get an old selected node while switching to the Elements
panel. | 55 // We may first get an old selected node while switching to the Elements
panel. |
| 56 if (node.nodeName() === "BODY") | 56 if (node.nodeName() === "BODY") |
| 57 return; | 57 return; |
| 58 WebInspector.context.removeFlavorChangeListener(WebInspector.DOMNode, on
SelectedNodeChanged); | 58 UI.context.removeFlavorChangeListener(SDK.DOMNode, onSelectedNodeChanged
); |
| 59 InspectorTest.addResult("Layout root node id: " + node.getAttribute("id"
)); | 59 InspectorTest.addResult("Layout root node id: " + node.getAttribute("id"
)); |
| 60 InspectorTest.completeTest(); | 60 InspectorTest.completeTest(); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 </script> | 64 </script> |
| 65 </head> | 65 </head> |
| 66 | 66 |
| 67 <body onload="runTest()"> | 67 <body onload="runTest()"> |
| 68 <p> | 68 <p> |
| 69 Tests the Timeline API instrumentation of a Layout event | 69 Tests the Timeline API instrumentation of a Layout event |
| 70 </p> | 70 </p> |
| 71 <div id="boundary" class="relayout-boundary"> | 71 <div id="boundary" class="relayout-boundary"> |
| 72 <div> | 72 <div> |
| 73 <div id="invalidate1"><div>text</div></div> | 73 <div id="invalidate1"><div>text</div></div> |
| 74 </div> | 74 </div> |
| 75 </div> | 75 </div> |
| 76 | 76 |
| 77 </body> | 77 </body> |
| 78 </html> | 78 </html> |
| OLD | NEW |