https://github.com/mozilla/gecko-dev
Raw File
Tip revision: 6c9ce83bf002cce2799ffa270c6eeb4c1227d972 authored by ffxbld on 07 February 2013, 02:23:21 UTC
Added FENNEC_19_0b5_RELEASE FENNEC_19_0b5_BUILD2 tag(s) for changeset 20d099b63e84. DONTBUILD CLOSED TREE a=release
Tip revision: 6c9ce83
test_transformed_scrolling_repaints.html
<!DOCTYPE HTML>
<html>
<head>
  <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</title>
  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="text/javascript" src="paint_listener.js"></script>
  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
</head>
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)">
<div id="t" style="-moz-transform: scale(1.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
  <div style="height:40px;">Hello</div>
  <div id="e" style="height:30px; background:lime">Kitty</div>
  <div style="height:300px; background:yellow">Kitty</div>
</div>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();

var t = document.getElementById("t");
var e = document.getElementById("e");
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
               getInterface(Components.interfaces.nsIDOMWindowUtils);
const isLinux = navigator.platform.indexOf("Linux") >= 0;
const is64 = navigator.platform.indexOf("x86_64") >= 0;
var winLowerThanVista = navigator.platform.indexOf("Win") == 0;
if (winLowerThanVista) {
  var version = Components.classes["@mozilla.org/system-info;1"]
                          .getService(Components.interfaces.nsIPropertyBag2)
                          .getProperty("version");
  winLowerThanVista = parseFloat(version) < 6.0;
}

function startTest() {
  // Do a couple of scrolls to ensure we've triggered activity heuristics.
  waitForAllPaintsFlushed(function () {
    t.scrollTop = 5;
    waitForAllPaintsFlushed(function () {
      t.scrollTop = 10;
      waitForAllPaintsFlushed(function () {
        // Clear paint state now and scroll again.
        utils.checkAndClearPaintedState(e);
        t.scrollTop = 15;
        waitForAllPaintsFlushed(function () {
          var painted = utils.checkAndClearPaintedState(e);
          if ((isLinux && !is64) || winLowerThanVista) {
            todo(false, "Fully-visible scrolled element should not have been painted (random on Linux-32)");
          } else {
            is(painted, false, "Fully-visible scrolled element should not have been painted");
          }
          SimpleTest.finish();
        });
      });
    });
  });
}
</script>
</pre>
</body>
</html>
back to top