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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html

Issue 1814013002: Visual viewport API initial implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/Viewport.idl/VisualViewport.idl Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <style>
4 body {
5 height: 2000px;
6 width: 2000px;
7 }
8 </style>
9
10 <script>
11 window.jsTestIsAsync = true;
12
13 description("This test verifies the dimensions of the visual viewport \
14 returned by the JS visual viewport API.");
15
16 function runTest() {
17 if (!window.eventSender || !window.internals) {
18 finishJSTest();
19 return;
20 }
21
22 // Turn off smooth scrolling.
23 internals.settings.setScrollAnimatorEnabled(false);
24
25 // Scroll both viewports.
26 eventSender.mouseMoveTo(100, 100);
27 eventSender.continuousMouseScrollBy(100, 100);
28
29 debug(" **** Initial visual viewport dimensions *****");
30 shouldBe("document.visualViewport.scrollTop", "0");
31 shouldBe("document.visualViewport.scrollLeft", "0");
32 shouldBe("document.visualViewport.clientWidth", "800");
33 shouldBe("document.visualViewport.clientHeight", "600");
34 shouldBe("document.visualViewport.pageScale", "1");
35
36 // Scale and scroll visual viewport.
37 internals.setPageScaleFactor(2);
38 internals.setVisualViewportOffset(10, 10);
39
40 debug(" **** Viewport dimensions after scale and scroll *****");
41 shouldBe("document.visualViewport.scrollTop", "10");
42 shouldBe("document.visualViewport.scrollLeft", "10");
43 shouldBe("document.visualViewport.clientWidth", "400");
44 shouldBe("document.visualViewport.clientHeight", "300");
45 shouldBe("document.visualViewport.pageScale", "2");
46
47 document.visualViewport.scrollTop = 20;
48 document.visualViewport.scrollLeft = 0;
49 debug(" **** Writable viewport dimensions *****");
50 shouldBe("document.visualViewport.scrollTop", "20");
51 shouldBe("document.visualViewport.scrollLeft", "0");
52 document.visualViewport.scrollTop = -20;
53 shouldBe("document.visualViewport.scrollTop", "0");
bokan 2016/03/22 18:30:29 It might be worth adding a case here with some fra
ymalik 2016/03/22 21:28:19 Done.
54
55 finishJSTest();
56 }
57 </script>
58
59 <body onload="runTest()"></body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698