Index: LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html |
diff --git a/LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html b/LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c759fa445a2c5680e3f12a7f181a4bf9a95cb9d |
--- /dev/null |
+++ b/LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html |
@@ -0,0 +1,48 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/js-test.js"></script> |
+<div id="spanner"></div> |
+<script> |
+var styleCount, layoutCount; |
+ |
+function assertSyncLayout(sync) { |
+ if (window.internals) { |
+ styleCount = internals.updateStyleAndReturnAffectedElementCount(); |
+ layoutCount = internals.needsLayoutCount(); |
+ // scrollTo should have synchronously updated style and layout |
+ if (sync) { |
+ shouldBe("styleCount", "0"); |
+ shouldBe("layoutCount", "0"); |
+ } else { |
+ shouldNotBe("styleCount", "0"); |
+ shouldNotBe("layoutCount", "0"); |
+ } |
+ } |
+} |
+ |
+spanner.style.width = "3000px"; |
+spanner.style.height = "3000px"; |
+scrollTo({ left: 0, top: 1000}); |
+assertSyncLayout(true); |
+shouldBe("window.scrollY", "1000"); |
+ |
+scrollTo({ left: 1000, top: 1000}); |
+assertSyncLayout(true); |
+shouldBe("window.scrollX", "1000"); |
+ |
+spanner.style.height = "2000px"; |
+scrollTo({ left: 0, top: 0}); |
+assertSyncLayout(false); |
+shouldBe("window.scrollY", "0"); |
+ |
+spanner.style.height = "1px"; |
+scrollTo({ left: 0 }); |
+assertSyncLayout(true); |
+ |
+spanner.style.height = "2px"; |
+scrollTo({ top: 0 }); |
+assertSyncLayout(true); |
+ |
+spanner.style.height = "3px"; |
+scrollTo({ }); |
+assertSyncLayout(true); |
+</script> |