3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
14 function performActions()
16 var element = document.getElementById("invalidate1");
17 element.style.marginTop = "10px";
18 var unused = element.offsetHeight;
24 WebInspector.inspectorView.panel("elements");
26 InspectorTest.evaluateInPage("var unused = document.body.offsetWidth;", function() {
27 InspectorTest.evaluateWithTimeline("performActions()", onTimelineRecorded);
30 function clickValueLink(record, row)
32 var panel = WebInspector.inspectorView.panel("timeline");
33 var helper = panel._uiUtils.generateDetailsContent(record, panel._model, new WebInspector.Linkifier(), onDetailsContentReady);
35 function onDetailsContentReady(element)
37 var rows = element.querySelectorAll(".timeline-details-view-row");
38 for (var i = 0; i < rows.length; ++i) {
39 if (rows[i].firstChild.textContent.indexOf(row) !== -1) {
40 rows[i].lastChild.firstChild.click();
47 function onTimelineRecorded(records)
49 var layoutRecord = InspectorTest.findFirstTimelineRecord("Layout");
50 WebInspector.notifications.addEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged, onSelectedNodeChanged);
51 clickValueLink(layoutRecord, "Layout root");
54 function onSelectedNodeChanged()
56 // avoid using WebInspector.inspectorView.panel("elements"), as we get first event from constructor,
57 // and this call would cause another instance to get constructed.
58 var node = WebInspector.panels.elements.selectedDOMNode();
59 // We may first get an old selected node while switching to the Elements panel.
60 if (node.nodeName() === "BODY")
62 WebInspector.notifications.removeEventListener(WebInspector.NotificationService.Events.SelectedNodeChanged, onSelectedNodeChanged);
63 InspectorTest.addResult("Layout root node id: " + node.getAttribute("id"));
64 InspectorTest.completeTest();
71 <body onload="runTest()">
73 Tests the Timeline API instrumentation of a Layout event
75 <div id="boundary" class="relayout-boundary">
77 <div id="invalidate1"><div>text</div></div>