Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <style> | |
| 3 body { | |
| 4 margin: 0; | |
| 5 } | |
| 6 | |
| 7 .container { | |
| 8 height: 250px; | |
| 9 width: 250px; | |
| 10 display: block; | |
| 11 } | |
| 12 | |
| 13 #nonFastRegion { | |
| 14 height: 222px; | |
| 15 width: 222px; | |
| 16 display: block; | |
| 17 border: none; | |
| 18 } | |
| 19 | |
| 20 #nonFastRegion.animate { | |
| 21 transform: translateX(100px) translateY(100px); | |
| 22 transition: transform 5ms; | |
| 23 } | |
| 24 </style> | |
| 25 | |
| 26 <div class="container"> | |
| 27 <iframe id='nonFastRegion' onload='runAfterLayoutAndPaint(window.runTests)' | |
| 28 srcdoc="<div style='height:1000px; width:1000px; background: linear-gr adient(to bottom, red, white);'>This should be covered.</div>"> | |
| 29 </iframe> | |
| 30 </div> | |
| 31 | |
| 32 <p>A single square should be visible covered by a green overlay.</p> | |
| 33 <div id="console"></div> | |
| 34 | |
| 35 <script src="../resources/js-test.js"></script> | |
| 36 <script src="../resources/run-after-layout-and-paint.js"></script> | |
| 37 <script src="resources/non-fast-scrollable-region-testing.js"></script> | |
| 38 <script> | |
| 39 jsTestIsAsync = true; | |
| 40 // print result lazily to avoid layouts during the test | |
| 41 setPrintTestResultsLazily(); | |
| 42 description('This test ensures that animating a non-fast scrollable area ' + | |
| 43 'correctly updates list of non-fast scrollable rects ' + | |
| 44 '(See http://crbug.com/417345).'); | |
| 45 | |
| 46 runTests = function() { | |
| 47 nonFastScrollableRects = internals.nonFastScrollableRects(document); | |
| 48 shouldBe('nonFastScrollableRects.length', '1'); | |
| 49 shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[0, 0, 222 , 222]'); | |
| 50 | |
| 51 // animating transforms hits an optimized layout path which is root cause of | |
| 52 // http://crbug.com/417345 | |
| 53 var nonFast = document.getElementById('nonFastRegion'); | |
| 54 nonFast.classList.add('animate'); | |
| 55 shouldBe('internals.needsLayoutCount()', '0'); | |
| 56 | |
| 57 nonFast.addEventListener("transitionend", function() { | |
| 58 shouldBe('internals.needsLayoutCount()', '0'); | |
|
Rick Byers
2015/08/06 03:19:47
I don't think this verifies that no layout occurre
| |
| 59 runAfterLayoutAndPaint(function() { | |
| 60 shouldBe('internals.needsLayoutCount()', '0'); | |
| 61 nonFastScrollableRects = internals.nonFastScrollableRects(document); | |
| 62 shouldBe('nonFastScrollableRects.length', '1'); | |
| 63 shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[100, 100, 222, 222]'); | |
| 64 | |
| 65 runAfterLayoutAndPaint(function() { | |
| 66 // Add green overlays to help visualize the test | |
| 67 drawNonFastScrollableRegionOverlays(); | |
| 68 finishJSTest(); | |
| 69 }); | |
| 70 }); | |
| 71 }, false); | |
| 72 } | |
| 73 </script> | |
| OLD | NEW |