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

Unified Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport.html

Issue 1424313003: element.scrollIntoView only scrolls the layout viewport (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 5 years, 2 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 | third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport.html
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport.html
new file mode 100644
index 0000000000000000000000000000000000000000..b20e79efff37fe3ec22febc51fc222c75194b5bb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<style>
+ body {
+ height: 800px;
+ width: 800px;
+ }
+ #box {
+ background-color: black;
+ top: 700px;
+ left: 100px;
+ height: 40px;
+ width: 40px;
+ position: absolute;
+ }
+</style>
+<script src="../../resources/js-test.js"></script>
+<script>
+ if (window.testRunner && window.internals) {
+ window.jsTestIsAsync = true;
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ setPrintTestResultsLazily();
+ }
+
+ description("Test that element.scrollIntoView() only scrolls the layout\
+ viewport when the intertVisualViewport is set.");
+
+ function runTest() {
+ if (!window.testRunner || !window.internals) {
+ testFailed("This test requires test runner and internals");
+ finishJSTest();
+ return;
+ }
+ internals.setPageScaleFactor(2.0);
+ var target = document.getElementById("box");
+
+ internals.settings.setInertVisualViewport(true);
+ window.scrollTo(0, 0);
+ internals.setVisualViewportOffset(0, 0);
+ target.scrollIntoView();
+ shouldBe('internals.visualViewportScrollX()', 'window.scrollX');
+ shouldBe('internals.visualViewportScrollY()', 'window.scrollY');
+ shouldBe('window.scrollX', '0');
+ shouldBeGreaterThan('window.scrollY', '0');
+ window.scrollTo(0, 0);
+ internals.setVisualViewportOffset(0, 0);
+ target.scrollIntoViewIfNeeded();
+ shouldBe('internals.visualViewportScrollX()', 'window.scrollX');
+ shouldBe('internals.visualViewportScrollY()', 'window.scrollY');
+ shouldBe('window.scrollX', '0');
+ shouldBeGreaterThan('window.scrollY', '0');
+
+ finishJSTest();
+ }
+
+ onload = runTest;
+</script>
+
+<div id="box"></div>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/scroll-behavior/scroll-into-view-scrolls-layout-viewport-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698