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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/viewport/viewport-dimensions-under-browser-zoom.html

Issue 1905693003: Update visual viewport API to take browser zoom into account. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address review comments % cleanup Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/VisualViewport.cpp » ('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: 2000px;
5 width: 2000px;
6 }
7 </style>
8 <script src="../../../resources/testharness.js"></script>
9 <script src="../../../resources/testharnessreport.js"></script>
10 <script>
11 var browserZoomFactor = 1.25;
12
13 test(function() {
14 window.scrollTo(100, 100);
15
16 // TODO(ymalik): Remove hook to internals to pinch-zoom here and browser
17 // zoom below. This will be required to upstream to w3c repo.
18 internals.setPageScaleFactor(2);
19
20 // Offset visual viewport by 10px.
21 document.visualViewport.scrollTop = 10;
22 document.visualViewport.scrollLeft = 10;
23
24 assert_equals(document.visualViewport.scrollTop, 10);
25 assert_equals(document.visualViewport.scrollLeft, 10);
26 assert_equals(document.visualViewport.clientWidth, 400);
27 assert_equals(document.visualViewport.clientHeight, 300);
28 assert_equals(document.visualViewport.pageScale, 2);
29
30 // Apply browser zoom.
31 window.internals.setZoomFactor(browserZoomFactor);
32
33 // Visual viewport dimensions should be scaled by the browser zoom factor.
34 assert_equals(document.visualViewport.scrollTop, 10 / browserZoomFactor);
35 assert_equals(document.visualViewport.scrollLeft, 10 / browserZoomFactor);
36 assert_equals(document.visualViewport.clientWidth, 400 / browserZoomFactor);
37 assert_equals(document.visualViewport.clientHeight, 300 / browserZoomFactor) ;
38 assert_equals(document.visualViewport.pageScale, 2);
39
40 // Verify setting the visual viewport offset under browser zoom.
41 document.visualViewport.scrollTop = 12.5;
42 document.visualViewport.scrollLeft = 12.5;
43 assert_equals(document.visualViewport.scrollTop, 12.5);
44 assert_equals(document.visualViewport.scrollLeft, 12.5);
45 assert_equals(document.visualViewport.clientWidth, 400 / browserZoomFactor);
46 assert_equals(document.visualViewport.clientHeight, 300 / browserZoomFactor) ;
47 assert_equals(document.visualViewport.pageScale, 2);
48 }, 'Verify viewport dimensions under bowser zoom.');
49 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/VisualViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698