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

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

Issue 2101393002: Make visualViewport.scrollTop/Left readonly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <style> 2 <style>
3 body { 3 body {
4 height: 2000px; 4 height: 2000px;
5 width: 2000px; 5 width: 2000px;
6 } 6 }
7 ::-webkit-scrollbar { 7 ::-webkit-scrollbar {
8 width: 0px; 8 width: 0px;
9 height: 0px; 9 height: 0px;
10 } 10 }
(...skipping 26 matching lines...) Expand all
37 // Scale and scroll visual viewport. 37 // Scale and scroll visual viewport.
38 internals.setPageScaleFactor(2); 38 internals.setPageScaleFactor(2);
39 internals.setVisualViewportOffset(10, 10); 39 internals.setVisualViewportOffset(10, 10);
40 assert_equals(viewport().clientWidth, 400, "scaled width"); 40 assert_equals(viewport().clientWidth, 400, "scaled width");
41 assert_equals(viewport().clientHeight, 300, "scaled height"); 41 assert_equals(viewport().clientHeight, 300, "scaled height");
42 assert_equals(viewport().scrollLeft, 10, "scrolled left viewport"); 42 assert_equals(viewport().scrollLeft, 10, "scrolled left viewport");
43 assert_equals(viewport().scrollTop, 10, "scrolled top viewport"); 43 assert_equals(viewport().scrollTop, 10, "scrolled top viewport");
44 assert_equals(viewport().scale, 2, "scale"); 44 assert_equals(viewport().scale, 2, "scale");
45 45
46 // Set scrollTop/Left. 46 // Set scrollTop/Left.
47 window.visualViewport.scrollTop = 20; 47 internals.setVisualViewportOffset(0, 20);
48 window.visualViewport.scrollLeft = 0;
49 assert_equals(viewport().scrollTop, 20, "set scrollTop"); 48 assert_equals(viewport().scrollTop, 20, "set scrollTop");
50 assert_equals(viewport().scrollLeft, 0, "set scrollLeft"); 49 assert_equals(viewport().scrollLeft, 0, "set scrollLeft");
51 window.visualViewport.scrollTop = -20; 50 internals.setVisualViewportOffset(-20, -20);
52 assert_equals(viewport().scrollTop, 0, "negative scrollTop"); 51 assert_equals(viewport().scrollTop, 0, "negative scrollTop");
53 window.visualViewport.scrollTop = 20.5; 52 assert_equals(viewport().scrollTop, 0, "negative scrollLeft");
54 assert_equals(viewport().scrollTop, 20.5, "floating point scrollTop");
55 53
56 t.done(); 54 t.done();
57 }); 55 });
58 }, 'Verify viewport dimensions'); 56 }, 'Verify viewport dimensions');
59 </script> 57 </script>
60 58
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698