layout/generic/test/test_overflow_event.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <meta charset="utf-8">
michael@0 5 <title>Test for overflow events</title>
michael@0 6 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 8 <script type="application/javascript">
michael@0 9
michael@0 10 SimpleTest.waitForExplicitFinish();
michael@0 11
michael@0 12 window.addEventListener("load", function(event) {
michael@0 13 if (event.target == document) {
michael@0 14 test_bug981637();
michael@0 15 }
michael@0 16 }, false);
michael@0 17
michael@0 18 /** Test for Bug 981637: correct overflow event firing in updateOverflow **/
michael@0 19
michael@0 20 var overflow_fired = false;
michael@0 21 function overflow_listener(event) {
michael@0 22 overflow_fired = true;
michael@0 23 }
michael@0 24
michael@0 25 function test_bug981637() {
michael@0 26 var outerDiv = document.getElementById("bug981637");
michael@0 27 var innerDiv = outerDiv.firstChild;
michael@0 28 innerDiv.offsetWidth; // flush layout
michael@0 29 is(overflow_fired, false, "correct setup");
michael@0 30 outerDiv.addEventListener("overflow", overflow_listener, false);
michael@0 31 innerDiv.style.transform = "scale(1.2)";
michael@0 32 innerDiv.offsetWidth; // flush layout
michael@0 33 // run finish step after the overflow event fires (off the event loop)
michael@0 34 setTimeout(test_bug981637_step2, 0);
michael@0 35 }
michael@0 36
michael@0 37 function test_bug981637_step2() {
michael@0 38 is(overflow_fired, true, "overflow event should have fired after updating transform");
michael@0 39 SimpleTest.finish();
michael@0 40 }
michael@0 41
michael@0 42 </script>
michael@0 43 </head>
michael@0 44 <body>
michael@0 45 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=981637">Mozilla Bug 981637</a>
michael@0 46 <div id="bug981637" style="overflow: hidden; width: 100px; height: 100px;"><div style="transform: scale(0.8); width: 100px; height: 100px"></div></div>
michael@0 47 <pre id="test">
michael@0 48 </pre>
michael@0 49 </body>
michael@0 50 </html>

mercurial