Index: LayoutTests/fast/events/resize-events.html |
diff --git a/LayoutTests/fast/events/resize-events.html b/LayoutTests/fast/events/resize-events.html |
index a4dd5d54106443bcb91c266d2e0294b1ddc24e39..197f33d3132ab28da134ec851650de6842056991 100644 |
--- a/LayoutTests/fast/events/resize-events.html |
+++ b/LayoutTests/fast/events/resize-events.html |
@@ -1,55 +1,60 @@ |
+<!DOCTYPE html> |
<html> |
<head> |
<style> |
div.block { height: 400px; border: 1px solid black; margin:10px; } |
</style> |
- <script> |
- var resizecount = 0; |
- var loaded = false; |
- window.onresize = function() { |
- resizecount++; |
- document.getElementById('count1').innerHTML = resizecount; |
- } |
- </script> |
</head> |
<body> |
<div> |
- Test how many resize events are emitted during page load and dynamic content generation. |
+ Following actions must not emit resize events: page load, dynamic content generation, page scaling and changing fixed layout size.<br/> |
- Do not resize the page. It invalidates the test. |
- <p style="text-indent: 10px" id=result1> |
- Resize events (should be 0): <span id=count1>0</span> |
+ 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/> |
+ However, showing/hiding scrollbars shouldn't be considered a layout size change. Refer to webkit.org/b/80242<br/> |
</div> |
<div id=expandingblock> |
</div> |
+ <pre id="console"></pre> |
+ <script src="../js/resources/js-test-pre.js"></script> |
<script> |
+ var resizeEventCount = 0; |
+ window.onresize = function() { |
+ resizeEventCount++; |
+ } |
+ |
if (window.testRunner) { |
testRunner.dumpAsText(); |
testRunner.waitUntilDone(); |
} |
function test() { |
- setTimeout(addBlock, 20); |
+ setTimeout(showScrollbar, 20); |
} |
- function addBlock() { |
+ // Add many div blocks to increase document height more than view height. |
+ function showScrollbar() { |
for (var i = 0; i < 10; i++) { |
var el = document.createElement('div'); |
el.setAttribute('class','block'); |
document.getElementById('expandingblock').appendChild(el); |
} |
+ setTimeout(scalePage, 20); |
+ } |
+ function scalePage() { |
+ if (window.internals) |
+ window.internals.setPageScaleFactor(3, 0, 0); |
+ setTimeout(changeFixedLayoutSize, 20); |
+ } |
+ function changeFixedLayoutSize() { |
+ if (window.testRunner) |
+ testRunner.setFixedLayoutSize(1600, 1600); |
setTimeout(finish, 20); |
} |
function finish() { |
- var result; |
// No resize events are acceptable. |
- if (resizecount < 1) |
- result = '<p style="color: green">PASS'; |
- else |
- result = '<p style="color: red">FAIL'; |
- var resultElement = document.getElementById('result1') |
- resultElement.innerHTML += result; |
+ shouldBe("resizeEventCount", "0"); |
if (window.testRunner) |
testRunner.notifyDone(); |
} |
- onload = test; |
+ window.onload = test; |
</script> |
</body> |
+</html> |