| 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>
|
|
|