Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html

Issue 1071983002: Don't force layout for scrollTo(0,0). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698