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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/viewport/scroll-resize-events-fired.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 </style> 7 </style>
8 8
9 <script src="../../../resources/testharness.js"></script> 9 <script src="../../../resources/testharness.js"></script>
10 <script src="../../../resources/testharnessreport.js"></script> 10 <script src="../../../resources/testharnessreport.js"></script>
11 <script> 11 <script>
12 var numCallsScroll = 0; 12 var numCallsScroll = 0;
13 var numCallsResize = 0; 13 var numCallsResize = 0;
14 var pageScaleFactor = 2; 14 var pageScaleFactor = 2;
15 15
16 function viewport() { 16 function viewport() {
17 return window.visualViewport; 17 return window.visualViewport;
18 } 18 }
19 19
20 var t = async_test('verify that the scroll and resize events get fired on wind ow.visualViewport'); 20 var t = async_test('verify that the scroll and resize events get fired on wind ow.visualViewport');
21 21
22 function verifySetViewportOffsets() {
23 // Set viewport offset.
24 window.visualViewport.scrollTop = 20;
25 requestAnimationFrame(function() {
26 t.step(function() {
27 assert_equals(numCallsScroll, 2, "scroll listener called for scrollTop") ;
28 assert_equals(numCallsResize, 1, "resize listener not called for scrollT op");
29 });
30 window.visualViewport.scrollLeft = 0;
31 requestAnimationFrame(function() {
32 t.step(function() {
33 assert_equals(numCallsScroll, 3, "scroll listener called for scrollLef t");
34 assert_equals(numCallsResize, 1, "resize listener not called for scrol lLeft");
35 });
36 t.done();
37 });
38 });
39 }
40
41 window.onload = t.step_func(function() { 22 window.onload = t.step_func(function() {
42 // Turn off smooth scrolling. 23 // Turn off smooth scrolling.
43 internals.settings.setScrollAnimatorEnabled(false); 24 internals.settings.setScrollAnimatorEnabled(false);
44 25
45 window.visualViewport.addEventListener('scroll', function(e) { 26 window.visualViewport.addEventListener('scroll', function(e) {
46 numCallsScroll++; 27 numCallsScroll++;
47 }); 28 });
48 29
49 window.visualViewport.addEventListener('resize', function(e) { 30 window.visualViewport.addEventListener('resize', function(e) {
50 numCallsResize++; 31 numCallsResize++;
(...skipping 14 matching lines...) Expand all
65 t.step(function() { 46 t.step(function() {
66 assert_equals(numCallsScroll, 0, "scroll listener not called for scale") ; 47 assert_equals(numCallsScroll, 0, "scroll listener not called for scale") ;
67 assert_equals(numCallsResize, 1, "resize listener called for scale"); 48 assert_equals(numCallsResize, 1, "resize listener called for scale");
68 }); 49 });
69 internals.setVisualViewportOffset(10, 10); 50 internals.setVisualViewportOffset(10, 10);
70 requestAnimationFrame(function() { 51 requestAnimationFrame(function() {
71 t.step(function() { 52 t.step(function() {
72 assert_equals(numCallsScroll, 1, "scroll listener called for offset ch ange"); 53 assert_equals(numCallsScroll, 1, "scroll listener called for offset ch ange");
73 assert_equals(numCallsResize, 1, "resize listener not called for offse t change"); 54 assert_equals(numCallsResize, 1, "resize listener not called for offse t change");
74 }); 55 });
75 verifySetViewportOffsets(); 56 t.done();
76 }); 57 });
77 }); 58 });
78 }); 59 });
79 </script> 60 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/viewport/verify-viewport-dimensions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698