layout/base/tests/chrome/test_transformed_scrolling_repaints_2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/chrome/test_transformed_scrolling_repaints_2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them (1.1 scale)</title>
     1.8 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
    1.11 +</head>
    1.12 +<!-- Need a timeout here to allow paint unsuppression before we start the test -->
    1.13 +<body onload="setTimeout(startTest,0)">
    1.14 +<div id="t" style="-moz-transform: scale(1.1, 1.1); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
    1.15 +  <div style="height:40px;"></div>
    1.16 +  <div id="e" style="height:30px; background:lime"></div>
    1.17 +  <div style="height:300px; background:yellow"></div>
    1.18 +</div>
    1.19 +<pre id="test">
    1.20 +<script type="application/javascript">
    1.21 +SimpleTest.waitForExplicitFinish();
    1.22 +
    1.23 +var t = document.getElementById("t");
    1.24 +var e = document.getElementById("e");
    1.25 +var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
    1.26 +               getInterface(Components.interfaces.nsIDOMWindowUtils);
    1.27 +
    1.28 +function startTest() {
    1.29 +  // Do a couple of scrolls to ensure we've triggered activity heuristics
    1.30 +  waitForAllPaintsFlushed(function () {
    1.31 +    t.scrollTop = 5;
    1.32 +    waitForAllPaintsFlushed(function () {
    1.33 +      t.scrollTop = 10;
    1.34 +      waitForAllPaintsFlushed(function () {
    1.35 +        // Clear paint state now and scroll again.
    1.36 +        utils.checkAndClearPaintedState(e);
    1.37 +        t.scrollTop = 20;
    1.38 +        waitForAllPaintsFlushed(function () {
    1.39 +          var painted = utils.checkAndClearPaintedState(e);
    1.40 +          is(painted, false, "Fully-visible scrolled element should not have been painted");
    1.41 +          SimpleTest.finish();
    1.42 +        });
    1.43 +      });
    1.44 +    });
    1.45 +  });
    1.46 +}
    1.47 +</script>
    1.48 +</pre>
    1.49 +</body>
    1.50 +</html>

mercurial