layout/base/tests/chrome/test_transformed_scrolling_repaints_2.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test that scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them (1.1 scale)</title>
michael@0 5 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
michael@0 8 </head>
michael@0 9 <!-- Need a timeout here to allow paint unsuppression before we start the test -->
michael@0 10 <body onload="setTimeout(startTest,0)">
michael@0 11 <div id="t" style="-moz-transform: scale(1.1, 1.1); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden">
michael@0 12 <div style="height:40px;"></div>
michael@0 13 <div id="e" style="height:30px; background:lime"></div>
michael@0 14 <div style="height:300px; background:yellow"></div>
michael@0 15 </div>
michael@0 16 <pre id="test">
michael@0 17 <script type="application/javascript">
michael@0 18 SimpleTest.waitForExplicitFinish();
michael@0 19
michael@0 20 var t = document.getElementById("t");
michael@0 21 var e = document.getElementById("e");
michael@0 22 var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
michael@0 23 getInterface(Components.interfaces.nsIDOMWindowUtils);
michael@0 24
michael@0 25 function startTest() {
michael@0 26 // Do a couple of scrolls to ensure we've triggered activity heuristics
michael@0 27 waitForAllPaintsFlushed(function () {
michael@0 28 t.scrollTop = 5;
michael@0 29 waitForAllPaintsFlushed(function () {
michael@0 30 t.scrollTop = 10;
michael@0 31 waitForAllPaintsFlushed(function () {
michael@0 32 // Clear paint state now and scroll again.
michael@0 33 utils.checkAndClearPaintedState(e);
michael@0 34 t.scrollTop = 20;
michael@0 35 waitForAllPaintsFlushed(function () {
michael@0 36 var painted = utils.checkAndClearPaintedState(e);
michael@0 37 is(painted, false, "Fully-visible scrolled element should not have been painted");
michael@0 38 SimpleTest.finish();
michael@0 39 });
michael@0 40 });
michael@0 41 });
michael@0 42 });
michael@0 43 }
michael@0 44 </script>
michael@0 45 </pre>
michael@0 46 </body>
michael@0 47 </html>

mercurial