layout/base/tests/chrome/transformed_scrolling_repaints_3_window.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/chrome/transformed_scrolling_repaints_3_window.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     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</title>
     1.8 +  <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
     1.9 +</head>
    1.10 +<!-- Need a timeout here to allow paint unsuppression before we start the test -->
    1.11 +<body onload="setTimeout(startTest,0)" style="background:white;">
    1.12 +<iframe id="t" style="-moz-transform: scale(0.48979); -moz-transform-origin:top left; width:500px; height:300px;"
    1.13 +        src="data:text/html,
    1.14 +<body style='background:yellow;'>
    1.15 +<p>My graduate adviser was the most patient, understanding, and helpful
    1.16 +person I've ever had the joy of dealing with. That doesn't change that 
    1.17 +there are some real dicks out there, and some of them happen to be 
    1.18 +scientists.
    1.19 +<p id='e'>My graduate adviser was the most patient, understanding, and helpful
    1.20 +person I've ever had the joy of dealing with. That doesn't change that 
    1.21 +there are some real dicks out there, and some of them happen to be 
    1.22 +scientists.
    1.23 +<p>My graduate adviser was the most patient, understanding, and helpful
    1.24 +person I've ever had the joy of dealing with. That doesn't change that 
    1.25 +there are some real dicks out there, and some of them happen to be 
    1.26 +scientists.
    1.27 +<p>My graduate adviser was the most patient, understanding, and helpful
    1.28 +person I've ever had the joy of dealing with. That doesn't change that 
    1.29 +there are some real dicks out there, and some of them happen to be 
    1.30 +scientists.
    1.31 +<p>My graduate adviser was the most patient, understanding, and helpful
    1.32 +person I've ever had the joy of dealing with. That doesn't change that 
    1.33 +there are some real dicks out there, and some of them happen to be 
    1.34 +scientists.
    1.35 +<p>My graduate adviser was the most patient, understanding, and helpful
    1.36 +person I've ever had the joy of dealing with. That doesn't change that 
    1.37 +there are some real dicks out there, and some of them happen to be 
    1.38 +scientists.
    1.39 +</body>"></iframe>
    1.40 +<pre id="test">
    1.41 +<script type="application/javascript">
    1.42 +var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
    1.43 +var SpecialPowers = window.opener.wrappedJSObject.SpecialPowers;
    1.44 +var is = window.opener.wrappedJSObject.is;
    1.45 +
    1.46 +var smoothScrollPref = "general.smoothScroll";
    1.47 +SpecialPowers.setBoolPref(smoothScrollPref, false);
    1.48 +
    1.49 +function startTest() {
    1.50 +  var t = document.getElementById("t");
    1.51 +  var e = t.contentDocument.getElementById("e");
    1.52 +  t.contentWindow.scrollTo(0,0);
    1.53 +  var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
    1.54 +                 getInterface(Components.interfaces.nsIDOMWindowUtils);
    1.55 +  var iterations = 0;
    1.56 +
    1.57 +  function nextIteration() {
    1.58 +    var painted = utils.checkAndClearPaintedState(e);
    1.59 +    is(painted, false, "Fully-visible scrolled element should not have been painted");
    1.60 +    if (++iterations == 10) {
    1.61 +      SpecialPowers.clearUserPref(smoothScrollPref);
    1.62 +      SimpleTest.finish();
    1.63 +      window.close();
    1.64 +    } else {
    1.65 +      t.contentWindow.scrollByLines(1);
    1.66 +      waitForAllPaintsFlushed(nextIteration);
    1.67 +    }
    1.68 +  }
    1.69 +  
    1.70 +  // Do a couple of scrolls to ensure we've triggered activity heuristics.
    1.71 +  waitForAllPaintsFlushed(function () {
    1.72 +    t.contentWindow.scrollByLines(1);
    1.73 +    waitForAllPaintsFlushed(function () {
    1.74 +      t.contentWindow.scrollByLines(1);
    1.75 +      waitForAllPaintsFlushed(function () {
    1.76 +        // Clear paint state now and scroll again.
    1.77 +        utils.checkAndClearPaintedState(e);
    1.78 +        t.contentWindow.scrollByLines(1);
    1.79 +        waitForAllPaintsFlushed(nextIteration);
    1.80 +      });
    1.81 +    });
    1.82 +  });
    1.83 +}
    1.84 +</script>
    1.85 +</pre>
    1.86 +</body>
    1.87 +</html>

mercurial