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

Unified Diff: LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping.html

Issue 1271143003: Fix scroll restoration clamping bug (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Notify progress tracker before trying to restore position Created 5 years, 4 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
« no previous file with comments | « no previous file | LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping.html
diff --git a/LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping.html b/LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping.html
new file mode 100644
index 0000000000000000000000000000000000000000..e0dbf937754337f43739f8cb87d4a5b5e4a8fa01
--- /dev/null
+++ b/LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<style>
+/* Body is large enough to scroll but not enough to restore the scroll
+ position without clamping. */
+body {
+ height: 2000px;
+ width: 2000px;
+}
+</style>
+
+<div id='console'></div>
+
+<script src="../../resources/js-test.js"></script>
+<script>
+jsTestIsAsync = true
+setPrintTestResultsLazily();
+description('Test ensures that frame scroll position is not prematurely ' +
+ 'clamped and restored before load event fires.');
+
+// Forcing layout causes the frame to attempt to restore scroll position if
+// possible even before page loading is complete.
+forceLayout();
+debug('Scroll position should not be clamped and restored while frame is loading');
+shouldBe('document.scrollingElement.scrollLeft', '0');
+shouldBe('document.scrollingElement.scrollTop', '0');
+
+onload = function() {
+ if (window.name == 'verification') {
+ shouldBe('document.scrollingElement.scrollLeft', '5000');
+ shouldBe('document.scrollingElement.scrollTop', '5001');
+
+ window.name = "";
+ setTimeout(function(){ window.scrollTo(0, 0); }, 0);
+ finishJSTest();
+ } else {
+ window.scrollTo(5000, 5001);
+ shouldBe('document.scrollingElement.scrollLeft', '5000');
+ shouldBe('document.scrollingElement.scrollTop', '5001');
+ setTimeout(function(){
+ window.name = "verification";
+ window.location = "data:text/html,<script>history.back();</scr" + "ipt>";
+ }, 0);
+ }
+}
+
+function forceLayout () {
+ document.body.scrollTop;
+}
+</script>
+
+<style>
+body {
+ height: 9999px;
+ width: 9999px;
+}
+</style>
« no previous file with comments | « no previous file | LayoutTests/fast/loader/scroll-position-restoration-without-premature-clamping-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698