1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/generic/test/test_overflow_event.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <meta charset="utf-8"> 1.8 + <title>Test for overflow events</title> 1.9 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.11 + <script type="application/javascript"> 1.12 + 1.13 + SimpleTest.waitForExplicitFinish(); 1.14 + 1.15 + window.addEventListener("load", function(event) { 1.16 + if (event.target == document) { 1.17 + test_bug981637(); 1.18 + } 1.19 + }, false); 1.20 + 1.21 + /** Test for Bug 981637: correct overflow event firing in updateOverflow **/ 1.22 + 1.23 + var overflow_fired = false; 1.24 + function overflow_listener(event) { 1.25 + overflow_fired = true; 1.26 + } 1.27 + 1.28 + function test_bug981637() { 1.29 + var outerDiv = document.getElementById("bug981637"); 1.30 + var innerDiv = outerDiv.firstChild; 1.31 + innerDiv.offsetWidth; // flush layout 1.32 + is(overflow_fired, false, "correct setup"); 1.33 + outerDiv.addEventListener("overflow", overflow_listener, false); 1.34 + innerDiv.style.transform = "scale(1.2)"; 1.35 + innerDiv.offsetWidth; // flush layout 1.36 + // run finish step after the overflow event fires (off the event loop) 1.37 + setTimeout(test_bug981637_step2, 0); 1.38 + } 1.39 + 1.40 + function test_bug981637_step2() { 1.41 + is(overflow_fired, true, "overflow event should have fired after updating transform"); 1.42 + SimpleTest.finish(); 1.43 + } 1.44 + 1.45 + </script> 1.46 +</head> 1.47 +<body> 1.48 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=981637">Mozilla Bug 981637</a> 1.49 +<div id="bug981637" style="overflow: hidden; width: 100px; height: 100px;"><div style="transform: scale(0.8); width: 100px; height: 100px"></div></div> 1.50 +<pre id="test"> 1.51 +</pre> 1.52 +</body> 1.53 +</html>