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

Side by Side 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, 1 month 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 body {
4 height: 800px;
5 width: 800px;
6 }
7 #box {
8 background-color: black;
9 top: 700px;
10 left: 100px;
11 height: 40px;
12 width: 40px;
13 position: absolute;
14 }
15 </style>
16 <script src="../../resources/js-test.js"></script>
17 <script>
18 if (window.testRunner && window.internals) {
19 window.jsTestIsAsync = true;
20 testRunner.dumpAsText();
21 testRunner.waitUntilDone();
22 setPrintTestResultsLazily();
23 }
24
25 description("Test that element.scrollIntoView() only scrolls the layout\
26 viewport when the intertVisualViewport is set.");
27
28 function runTest() {
29 if (!window.testRunner || !window.internals) {
30 testFailed("This test requires test runner and internals");
31 finishJSTest();
32 return;
33 }
34 internals.setPageScaleFactor(2.0);
35 var target = document.getElementById("box");
36
37 internals.settings.setInertVisualViewport(true);
38 window.scrollTo(0, 0);
39 internals.setVisualViewportOffset(0, 0);
40 target.scrollIntoView();
41 shouldBe('internals.visualViewportScrollX()', 'window.scrollX');
42 shouldBe('internals.visualViewportScrollY()', 'window.scrollY');
43 shouldBe('window.scrollX', '0');
44 shouldBeGreaterThan('window.scrollY', '0');
45 window.scrollTo(0, 0);
46 internals.setVisualViewportOffset(0, 0);
47 target.scrollIntoViewIfNeeded();
48 shouldBe('internals.visualViewportScrollX()', 'window.scrollX');
49 shouldBe('internals.visualViewportScrollY()', 'window.scrollY');
50 shouldBe('window.scrollX', '0');
51 shouldBeGreaterThan('window.scrollY', '0');
52
53 finishJSTest();
54 }
55
56 onload = runTest;
57 </script>
58
59 <div id="box"></div>
OLDNEW
« 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