| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../http/tests/inspector/inspector-test.js"></script> | 4 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 5 <script src="../../http/tests/inspector/timeline-test.js"></script> | 5 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 function multipleStyleRecalcsAndDisplay(callback) | 7 function multipleStyleRecalcsAndDisplay(callback) |
| 8 { | 8 { |
| 9 requestAnimationFrame(function() { | 9 requestAnimationFrame(function() { |
| 10 document.getElementById("testElementOne").className = "red"; | 10 document.getElementById("testElementOne").className = "red"; |
| 11 var forceStyleRecalc1 = document.body.offsetTop; | 11 var forceStyleRecalc1 = document.body.offsetTop; |
| 12 document.getElementById("testElementOne").className = "snow"; | 12 document.getElementById("testElementOne").className = "snow"; |
| 13 var forceStyleRecalc2 = document.body.offsetTop; | 13 var forceStyleRecalc2 = document.body.offsetTop; |
| 14 if (window.testRunner) | 14 if (window.testRunner) |
| 15 testRunner.layoutAndPaintAsyncThen(callback); | 15 testRunner.layoutAndPaintAsyncThen(callback); |
| 16 }); | 16 }); |
| 17 } | 17 } |
| 18 | 18 |
| 19 | 19 |
| 20 function test() | 20 function test() |
| 21 { | 21 { |
| 22 var currentPanel = WebInspector.inspectorView.currentPanel(); | 22 var currentPanel = WebInspector.inspectorView.currentPanel(); |
| 23 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); | 23 InspectorTest.assertEquals(currentPanel._panelName, "timeline", "Current pan
el should be the timeline."); |
| 24 Runtime.experiments.enableForTest("timelineInvalidationTracking"); | 24 Runtime.experiments.enableForTest("timelineInvalidationTracking"); |
| 25 InspectorTest.invokeAsyncWithTimeline("multipleStyleRecalcsAndDisplay", test
MultipleStyleRecalcs); | 25 InspectorTest.invokeAsyncWithTimeline("multipleStyleRecalcsAndDisplay", test
MultipleStyleRecalcs); |
| 26 | 26 |
| 27 function testMultipleStyleRecalcs() | 27 function testMultipleStyleRecalcs() |
| 28 { | 28 { |
| 29 var firstRecalc = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.UpdateLayoutTree, 0); | 29 var firstRecalc = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.UpdateStyleAndLayoutTree, 0); |
| 30 InspectorTest.addArray(firstRecalc._event.invalidationTrackingEvents, In
spectorTest.InvalidationFormatters, "", "first style recalc"); | 30 InspectorTest.addArray(firstRecalc._event.invalidationTrackingEvents, In
spectorTest.InvalidationFormatters, "", "first style recalc"); |
| 31 var secondRecalc = InspectorTest.findTimelineRecord(WebInspector.Timelin
eModel.RecordType.UpdateLayoutTree, 1); | 31 var secondRecalc = InspectorTest.findTimelineRecord(WebInspector.Timelin
eModel.RecordType.UpdateStyleAndLayoutTree, 1); |
| 32 InspectorTest.addArray(secondRecalc._event.invalidationTrackingEvents, I
nspectorTest.InvalidationFormatters, "", "second style recalc"); | 32 InspectorTest.addArray(secondRecalc._event.invalidationTrackingEvents, I
nspectorTest.InvalidationFormatters, "", "second style recalc"); |
| 33 var firstPaint = InspectorTest.findTimelineRecord(WebInspector.TimelineM
odel.RecordType.Paint, 0); | 33 var firstPaint = InspectorTest.findTimelineRecord(WebInspector.TimelineM
odel.RecordType.Paint, 0); |
| 34 InspectorTest.addArray(firstPaint._event.invalidationTrackingEvents, Ins
pectorTest.InvalidationFormatters, "", "first paint"); | 34 InspectorTest.addArray(firstPaint._event.invalidationTrackingEvents, Ins
pectorTest.InvalidationFormatters, "", "first paint"); |
| 35 | 35 |
| 36 var thirdRecalc = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.UpdateLayoutTree, 2); | 36 var thirdRecalc = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.UpdateStyleAndLayoutTree, 2); |
| 37 InspectorTest.assertTrue(thirdRecalc === undefined, "There should be no
additional style recalc records."); | 37 InspectorTest.assertTrue(thirdRecalc === undefined, "There should be no
additional style recalc records."); |
| 38 var secondPaint = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint, 1); | 38 var secondPaint = InspectorTest.findTimelineRecord(WebInspector.Timeline
Model.RecordType.Paint, 1); |
| 39 InspectorTest.assertTrue(secondPaint === undefined, "There should be no
additional paint records."); | 39 InspectorTest.assertTrue(secondPaint === undefined, "There should be no
additional paint records."); |
| 40 InspectorTest.completeTest(); | 40 InspectorTest.completeTest(); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 </script> | 43 </script> |
| 44 <style> | 44 <style> |
| 45 .testHolder > .red { background-color: red; } | 45 .testHolder > .red { background-color: red; } |
| 46 .testHolder > .green { background-color: green; } | 46 .testHolder > .green { background-color: green; } |
| 47 .testHolder > .blue { background-color: blue; } | 47 .testHolder > .blue { background-color: blue; } |
| 48 .testHolder > .snow { background-color: snow; } | 48 .testHolder > .snow { background-color: snow; } |
| 49 .testHolder > .red .dummy { } | 49 .testHolder > .red .dummy { } |
| 50 .testHolder > .green .dummy { } | 50 .testHolder > .green .dummy { } |
| 51 .testHolder > .blue .dummy { } | 51 .testHolder > .blue .dummy { } |
| 52 .testHolder > .snow .dummy { } | 52 .testHolder > .snow .dummy { } |
| 53 </style> | 53 </style> |
| 54 </head> | 54 </head> |
| 55 <body onload="runTest()"> | 55 <body onload="runTest()"> |
| 56 <p>Tests the Timeline API instrumentation of multiple style recalc invalidations
and ensures they are all collected on the paint event.</p> | 56 <p>Tests the Timeline API instrumentation of multiple style recalc invalidations
and ensures they are all collected on the paint event.</p> |
| 57 <div class="testHolder"> | 57 <div class="testHolder"> |
| 58 <div id="testElementOne">PASS</div><div id="testElementTwo">PASS</div><div id="t
estElementThree">PASS</div> | 58 <div id="testElementOne">PASS</div><div id="testElementTwo">PASS</div><div id="t
estElementThree">PASS</div> |
| 59 </div> | 59 </div> |
| 60 </body> | 60 </body> |
| 61 </html> | 61 </html> |
| OLD | NEW |