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

Side by Side Diff: LayoutTests/fast/events/resize-events.html

Issue 14766010: Clarify the size of a document view (a.k.a layout size) that causes FrameView to emit the resize ev… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Apply aellas's review Created 7 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
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <style> 3 <style>
4 div.block { height: 400px; border: 1px solid black; margin:10px; } 4 div.block { height: 400px; border: 1px solid black; margin:10px; }
5 </style> 5 </style>
6 <script> 6 <script>
7 var resizecount = 0; 7 var resizecount = 0;
8 var loaded = false; 8 var loaded = false;
9 window.onresize = function() { 9 window.onresize = function() {
10 resizecount++; 10 resizecount++;
11 document.getElementById('count1').innerHTML = resizecount; 11 document.getElementById('count1').innerHTML = resizecount;
12 } 12 }
13 </script> 13 </script>
14 </head> 14 </head>
15 <body> 15 <body>
16 <div> 16 <div>
17 Test how many resize events are emitted during page load and dynamic con tent generation. 17 Following actions must not emit resize events: page load, dynamic conten t generation, page scaling and changing fixed layout size.<br/>
18
19 The spec DOM Level 2 Events states that the resize event occurs when doc ument view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DO M-Level-2-Events/events.html<br/>
20 However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/>
18 21
19 Do not resize the page. It invalidates the test. 22 Do not resize the page. It invalidates the test.
20 <p style="text-indent: 10px" id=result1> 23 <p style="text-indent: 10px" id=result1>
21 Resize events (should be 0): <span id=count1>0</span> 24 Resize events (should be 0): <span id=count1>0</span>
22 </div> 25 </div>
23 <div id=expandingblock> 26 <div id=expandingblock>
24 </div> 27 </div>
25 <script> 28 <script>
26 if (window.testRunner) { 29 if (window.testRunner) {
27 testRunner.dumpAsText(); 30 testRunner.dumpAsText();
28 testRunner.waitUntilDone(); 31 testRunner.waitUntilDone();
29 } 32 }
30 function test() { 33 function test() {
31 setTimeout(addBlock, 20); 34 setTimeout(showScrollbar, 20);
32 } 35 }
33 function addBlock() { 36 // Add many div blocks to increase document height more than view height .
37 function showScrollbar() {
34 for (var i = 0; i < 10; i++) { 38 for (var i = 0; i < 10; i++) {
35 var el = document.createElement('div'); 39 var el = document.createElement('div');
36 el.setAttribute('class','block'); 40 el.setAttribute('class','block');
37 document.getElementById('expandingblock').appendChild(el); 41 document.getElementById('expandingblock').appendChild(el);
38 } 42 }
43 setTimeout(scalePage, 20);
44 }
45 function scalePage() {
46 if (window.internals)
47 window.internals.setPageScaleFactor(3, 0, 0);
48 setTimeout(changeFixedLayoutSize, 20);
49 }
50 function changeFixedLayoutSize() {
51 if (window.testRunner)
52 testRunner.setFixedLayoutSize(1600, 1600);
39 setTimeout(finish, 20); 53 setTimeout(finish, 20);
40 } 54 }
41 function finish() { 55 function finish() {
42 var result; 56 var result;
43 // No resize events are acceptable. 57 // No resize events are acceptable.
44 if (resizecount < 1) 58 if (resizecount < 1)
45 result = '<p style="color: green">PASS'; 59 result = '<p style="color: green">PASS';
46 else 60 else
47 result = '<p style="color: red">FAIL'; 61 result = '<p style="color: red">FAIL';
48 var resultElement = document.getElementById('result1') 62 var resultElement = document.getElementById('result1')
49 resultElement.innerHTML += result; 63 resultElement.innerHTML += result;
50 if (window.testRunner) 64 if (window.testRunner)
51 testRunner.notifyDone(); 65 testRunner.notifyDone();
52 } 66 }
53 onload = test; 67 onload = test;
54 </script> 68 </script>
55 </body> 69 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/resize-events-count.html » ('j') | LayoutTests/fast/events/resize-events-count.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698