layout/generic/test/test_overflow_event.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial