Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / resize-events.html
blob6b05a3b8efb4ba683663d58aac1c0d742f9b0e14
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 div.block { height: 400px; border: 1px solid black; margin:10px; }
6 </style>
7 </head>
8 <body>
9 <div>
10 Following actions must not emit resize events: page load, dynamic content generation, and page scaling.<br/>
12 The spec DOM Level 2 Events states that the resize event occurs when document view size (a.k.a layout size) is changed. Refer to http://www.w3.org/TR/DOM-Level-2-Events/events.html<br/>
13 However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/>
14 </div>
15 <div id=expandingblock>
16 </div>
17 <pre id="console"></pre>
18 <script src="../../resources/js-test.js"></script>
19 <script>
20 var resizeEventCount = 0;
21 window.onresize = function() {
22 resizeEventCount++;
25 if (window.testRunner) {
26 testRunner.dumpAsText();
27 testRunner.waitUntilDone();
29 function test() {
30 setTimeout(showScrollbar, 20);
32 // Add many div blocks to increase document height more than view height.
33 function showScrollbar() {
34 for (var i = 0; i < 10; i++) {
35 var el = document.createElement('div');
36 el.setAttribute('class','block');
37 document.getElementById('expandingblock').appendChild(el);
39 setTimeout(scalePage, 20);
41 function scalePage() {
42 if (window.internals)
43 window.internals.setPageScaleFactor(3);
44 setTimeout(finish, 20);
46 function finish() {
47 // No resize events are acceptable.
48 shouldBe("resizeEventCount", "0");
49 if (window.testRunner)
50 testRunner.notifyDone();
52 window.onload = test;
53 </script>
54 </body>
55 </html>