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

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: use js-test-pre.js 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/resize-events-count.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 <html> 2 <html>
2 <head> 3 <head>
3 <style> 4 <style>
4 div.block { height: 400px; border: 1px solid black; margin:10px; } 5 div.block { height: 400px; border: 1px solid black; margin:10px; }
5 </style> 6 </style>
6 <script>
7 var resizecount = 0;
8 var loaded = false;
9 window.onresize = function() {
10 resizecount++;
11 document.getElementById('count1').innerHTML = resizecount;
12 }
13 </script>
14 </head> 7 </head>
15 <body> 8 <body>
16 <div> 9 <div>
17 Test how many resize events are emitted during page load and dynamic con tent generation. 10 Following actions must not emit resize events: page load, dynamic conten t generation, page scaling and changing fixed layout size.<br/>
18 11
19 Do not resize the page. It invalidates the test. 12 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 <p style="text-indent: 10px" id=result1> 13 However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/>
21 Resize events (should be 0): <span id=count1>0</span>
22 </div> 14 </div>
23 <div id=expandingblock> 15 <div id=expandingblock>
24 </div> 16 </div>
17 <pre id="console"></pre>
18 <script src="../js/resources/js-test-pre.js"></script>
25 <script> 19 <script>
20 var resizeEventCount = 0;
21 window.onresize = function() {
22 resizeEventCount++;
23 }
24
26 if (window.testRunner) { 25 if (window.testRunner) {
27 testRunner.dumpAsText(); 26 testRunner.dumpAsText();
28 testRunner.waitUntilDone(); 27 testRunner.waitUntilDone();
29 } 28 }
30 function test() { 29 function test() {
31 setTimeout(addBlock, 20); 30 setTimeout(showScrollbar, 20);
32 } 31 }
33 function addBlock() { 32 // Add many div blocks to increase document height more than view height .
33 function showScrollbar() {
34 for (var i = 0; i < 10; i++) { 34 for (var i = 0; i < 10; i++) {
35 var el = document.createElement('div'); 35 var el = document.createElement('div');
36 el.setAttribute('class','block'); 36 el.setAttribute('class','block');
37 document.getElementById('expandingblock').appendChild(el); 37 document.getElementById('expandingblock').appendChild(el);
38 } 38 }
39 setTimeout(scalePage, 20);
40 }
41 function scalePage() {
42 if (window.internals)
43 window.internals.setPageScaleFactor(3, 0, 0);
44 setTimeout(changeFixedLayoutSize, 20);
45 }
46 function changeFixedLayoutSize() {
47 if (window.testRunner)
48 testRunner.setFixedLayoutSize(1600, 1600);
39 setTimeout(finish, 20); 49 setTimeout(finish, 20);
40 } 50 }
41 function finish() { 51 function finish() {
42 var result;
43 // No resize events are acceptable. 52 // No resize events are acceptable.
44 if (resizecount < 1) 53 shouldBe("resizeEventCount", "0");
45 result = '<p style="color: green">PASS';
46 else
47 result = '<p style="color: red">FAIL';
48 var resultElement = document.getElementById('result1')
49 resultElement.innerHTML += result;
50 if (window.testRunner) 54 if (window.testRunner)
51 testRunner.notifyDone(); 55 testRunner.notifyDone();
52 } 56 }
53 onload = test; 57 window.onload = test;
54 </script> 58 </script>
55 </body> 59 </body>
60 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/resize-events-count.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698