test_transformed_scrolling_repaints_2.html (1869B)
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 (1.1 scale)</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <script src="/tests/SimpleTest/paint_listener.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 8 </head> 9 <body onload="setPrefAndStartTest()"> 10 <div id="t" style="transform: scale(1.1, 1.1); transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden"> 11 <div style="height:40px;"></div> 12 <div id="e" style="height:30px; background:lime"></div> 13 <div style="height:300px; background:yellow"></div> 14 </div> 15 <pre id="test"> 16 <script type="application/javascript"> 17 SimpleTest.waitForExplicitFinish(); 18 19 var t = document.getElementById("t"); 20 var e = document.getElementById("e"); 21 var utils = SpecialPowers.getDOMWindowUtils(window); 22 23 function startTest() { 24 // Do a couple of scrolls to ensure we've triggered activity heuristics 25 waitForAllPaintsFlushed(function () { 26 t.scrollTop = 5; 27 waitForAllPaintsFlushed(function () { 28 t.scrollTop = 10; 29 waitForAllPaintsFlushed(function () { 30 // Clear paint state now and scroll again. 31 utils.checkAndClearPaintedState(e); 32 t.scrollTop = 20; 33 waitForAllPaintsFlushed(function () { 34 var painted = utils.checkAndClearPaintedState(e); 35 is(painted, false, "Fully-visible scrolled element should not have been painted"); 36 SimpleTest.finish(); 37 }); 38 }); 39 }); 40 }); 41 } 42 function setPrefAndStartTest() { 43 SpecialPowers.pushPrefEnv( 44 {"set": [["layers.single-tile.enabled", false]]}, 45 // Need a timeout here to allow paint unsuppression before we start the test 46 function() { 47 setTimeout(startTest, 0); 48 } 49 ); 50 } 51 </script> 52 </pre> 53 </body> 54 </html>