Chromium Code Reviews| Index: LayoutTests/scrollingcoordinator/non-fast-scrollable-animation.html |
| diff --git a/LayoutTests/scrollingcoordinator/non-fast-scrollable-animation.html b/LayoutTests/scrollingcoordinator/non-fast-scrollable-animation.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..45e4ec7387dbfa99ae0a97809e21c6677d43bb26 |
| --- /dev/null |
| +++ b/LayoutTests/scrollingcoordinator/non-fast-scrollable-animation.html |
| @@ -0,0 +1,73 @@ |
| +<!DOCTYPE html> |
| +<style> |
| + body { |
| + margin: 0; |
| + } |
| + |
| + .container { |
| + height: 250px; |
| + width: 250px; |
| + display: block; |
| + } |
| + |
| + #nonFastRegion { |
| + height: 222px; |
| + width: 222px; |
| + display: block; |
| + border: none; |
| + } |
| + |
| + #nonFastRegion.animate { |
| + transform: translateX(100px) translateY(100px); |
| + transition: transform 5ms; |
| + } |
| +</style> |
| + |
| +<div class="container"> |
| + <iframe id='nonFastRegion' onload='runAfterLayoutAndPaint(window.runTests)' |
| + srcdoc="<div style='height:1000px; width:1000px; background: linear-gradient(to bottom, red, white);'>This should be covered.</div>"> |
| + </iframe> |
| +</div> |
| + |
| +<p>A single square should be visible covered by a green overlay.</p> |
| +<div id="console"></div> |
| + |
| +<script src="../resources/js-test.js"></script> |
| +<script src="../resources/run-after-layout-and-paint.js"></script> |
| +<script src="resources/non-fast-scrollable-region-testing.js"></script> |
| +<script> |
| + jsTestIsAsync = true; |
| + // print result lazily to avoid layouts during the test |
| + setPrintTestResultsLazily(); |
| + description('This test ensures that animating a non-fast scrollable area ' + |
| + 'correctly updates list of non-fast scrollable rects ' + |
| + '(See http://crbug.com/417345).'); |
| + |
| + runTests = function() { |
| + nonFastScrollableRects = internals.nonFastScrollableRects(document); |
| + shouldBe('nonFastScrollableRects.length', '1'); |
| + shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[0, 0, 222, 222]'); |
| + |
| + // animating transforms hits an optimized layout path which is root cause of |
| + // http://crbug.com/417345 |
| + var nonFast = document.getElementById('nonFastRegion'); |
| + nonFast.classList.add('animate'); |
| + shouldBe('internals.needsLayoutCount()', '0'); |
| + |
| + nonFast.addEventListener("transitionend", function() { |
| + shouldBe('internals.needsLayoutCount()', '0'); |
|
Rick Byers
2015/08/06 03:19:47
I don't think this verifies that no layout occurre
|
| + runAfterLayoutAndPaint(function() { |
| + shouldBe('internals.needsLayoutCount()', '0'); |
| + nonFastScrollableRects = internals.nonFastScrollableRects(document); |
| + shouldBe('nonFastScrollableRects.length', '1'); |
| + shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[100, 100, 222, 222]'); |
| + |
| + runAfterLayoutAndPaint(function() { |
| + // Add green overlays to help visualize the test |
| + drawNonFastScrollableRegionOverlays(); |
| + finishJSTest(); |
| + }); |
| + }); |
| + }, false); |
| + } |
| +</script> |