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

Unified Diff: third_party/WebKit/LayoutTests/fast/scrolling/same-page-navigate.html

Issue 2320303002: Reset VisualViewport position after same page navigation (Closed)
Patch Set: update comments and test Created 4 years, 3 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: third_party/WebKit/LayoutTests/fast/scrolling/same-page-navigate.html
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/same-page-navigate.html b/third_party/WebKit/LayoutTests/fast/scrolling/same-page-navigate.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e8a094d5cef9988817b61d343352139e6dff794
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/same-page-navigate.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+
+<a href="./same-page-navigate.html" id="same-page" style="position: absolute; top: 2000px">link to self</a>
+
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<script>
+
+// Ensure that the scroll position is correct when we navigate to same page after scale(zoom-in/zoom-out)
+// crbug.com/642279
+test(function() {
+
+ if(testRunner) {
+ testRunner.waitUntilDone();
+ }
+
+ // exit in second load, using scale to detect
+ if (internals.pageScaleFactor() == 2) {
+ assert_equals(scrollX, 0);
+ assert_equals(scrollY, 0);
+
+ if(testRunner) {
+ testRunner.notifyDone();
+ }
+ return;
+ }
+
+ window.internals.setPageScaleFactor(2);
+ scrollTo(0, 10000);
+
+ var atag = document.getElementById('same-page');
+
+ var x = (atag.offsetLeft - scrollX + 1) * 2;
+ var y = (atag.offsetTop - scrollY + 1) * 2;
+
+ // this clicks on the link which causes a reload of this page.
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}, 'Ensure that the scroll position is correct when we navigate to same page after scale(zoom-in/zoom-out)');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698