layout/base/tests/chrome/test_transformed_scrolling_repaints.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   <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
     5   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     6   <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
     7   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
     8 </head>
     9 <!-- Need a timeout here to allow paint unsuppression before we start the test -->
    10 <body onload="setTimeout(startTest,0)">
    11 <div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
    12   <div style="height:40px;">Hello</div>
    13   <div id="e" style="height:30px; background:lime">Kitty</div>
    14   <div style="height:300px; background:yellow">Kitty</div>
    15 </div>
    16 <pre id="test">
    17 <script type="application/javascript">
    18 SimpleTest.waitForExplicitFinish();
    20 var t = document.getElementById("t");
    21 var e = document.getElementById("e");
    22 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
    23                getInterface(Components.interfaces.nsIDOMWindowUtils);
    24 const isLinux = navigator.platform.indexOf("Linux") >= 0;
    25 const is64 = navigator.platform.indexOf("x86_64") >= 0;
    26 var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
    27 if (winLowerThanVista) {
    28   var version = Components.classes["@mozilla.org/system-info;1"]
    29                           .getService(Components.interfaces.nsIPropertyBag2)
    30                           .getProperty("version");
    31   winLowerThanVista = parseFloat(version) < 6.0;
    32 }
    34 function startTest() {
    35   // Do a couple of scrolls to ensure we've triggered activity heuristics.
    36   waitForAllPaintsFlushed(function () {
    37     t.scrollTop = 5;
    38     waitForAllPaintsFlushed(function () {
    39       t.scrollTop = 10;
    40       waitForAllPaintsFlushed(function () {
    41         // Clear paint state now and scroll again.
    42         utils.checkAndClearPaintedState(e);
    43         t.scrollTop = 15;
    44         waitForAllPaintsFlushed(function () {
    45           var painted = utils.checkAndClearPaintedState(e);
    46           if ((isLinux && !is64) || winLowerThanVista) {
    47             todo(false, "Fully-visible scrolled element should not have been painted (random on Linux-32)");
    48           } else {
    49             is(painted, false, "Fully-visible scrolled element should not have been painted");
    50           }
    51           SimpleTest.finish();
    52         });
    53       });
    54     });
    55   });
    56 }
    57 </script>
    58 </pre>
    59 </body>
    60 </html>

mercurial