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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/viewport/visualviewportchanged-event-fired.html

Issue 2034313002: Fire visualviewportchanged event on window rather than document (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/visualviewportchanged-event-fired-window-resized.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 <script src="../../../resources/js-test.js"></script> 2 <script src="../../../resources/js-test.js"></script>
3 <style> 3 <style>
4 body { 4 body {
5 height: 2000px; 5 height: 2000px;
6 width: 2000px; 6 width: 2000px;
7 } 7 }
8 </style> 8 </style>
9 9
10 <script> 10 <script>
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 function runTest() { 30 function runTest() {
31 if (!window.eventSender || !window.internals) { 31 if (!window.eventSender || !window.internals) {
32 finishJSTest(); 32 finishJSTest();
33 return; 33 return;
34 } 34 }
35 // Turn off smooth scrolling. 35 // Turn off smooth scrolling.
36 internals.settings.setScrollAnimatorEnabled(false); 36 internals.settings.setScrollAnimatorEnabled(false);
37 37
38 document.addEventListener('visualviewportchanged', function(e) { 38 window.addEventListener('visualviewportchanged', function(e) {
39 numCalls++; 39 numCalls++;
40 }); 40 });
41 41
42 // Scroll both viewports. Listner not called. 42 // Scroll both viewports. Listner not called.
43 eventSender.mouseMoveTo(100, 100); 43 eventSender.mouseMoveTo(100, 100);
44 eventSender.continuousMouseScrollBy(100, 100); 44 eventSender.continuousMouseScrollBy(100, 100);
45 shouldBe("numCalls", "0"); 45 shouldBe("numCalls", "0");
46 46
47 // Scale and scroll visual viewport. Listener called twice. 47 // Scale and scroll visual viewport. Listener called twice.
48 internals.setPageScaleFactor(2); 48 internals.setPageScaleFactor(2);
49 requestAnimationFrame(function() { 49 requestAnimationFrame(function() {
50 shouldBe("numCalls", "1"); 50 shouldBe("numCalls", "1");
51 internals.setVisualViewportOffset(10, 10); 51 internals.setVisualViewportOffset(10, 10);
52 requestAnimationFrame(function() { 52 requestAnimationFrame(function() {
53 shouldBe("numCalls", "2"); 53 shouldBe("numCalls", "2");
54 verifySetViewportOffsets(); 54 verifySetViewportOffsets();
55 }); 55 });
56 }); 56 });
57 } 57 }
58 </script> 58 </script>
59 59
60 <body onload="runTest()"></body> 60 <body onload="runTest()"></body>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/viewport/visualviewportchanged-event-fired-window-resized.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698