Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test that we don't get unnecessary repaints due to subpixel shifts</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="width:400px; 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:60.4px; background:pink"></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 scroll to ensure we trigger activity heuristics. |
michael@0 | 27 | waitForAllPaintsFlushed(function () { |
michael@0 | 28 | t.scrollTop = 5; |
michael@0 | 29 | // Scroll down as far as we can, to put our rendering layer at a subpixel offset within the layer |
michael@0 | 30 | waitForAllPaintsFlushed(function () { |
michael@0 | 31 | t.scrollTop = 1000; |
michael@0 | 32 | waitForAllPaintsFlushed(function () { |
michael@0 | 33 | // Clear paint state now and scroll again. |
michael@0 | 34 | utils.checkAndClearPaintedState(e); |
michael@0 | 35 | // scroll up a little bit. This should not cause anything to be repainted. |
michael@0 | 36 | t.scrollTop = t.scrollTop - 10; |
michael@0 | 37 | waitForAllPaintsFlushed(function () { |
michael@0 | 38 | var painted = utils.checkAndClearPaintedState(e); |
michael@0 | 39 | is(painted, false, "Fully-visible scrolled element should not have been painted"); |
michael@0 | 40 | SimpleTest.finish(); |
michael@0 | 41 | }); |
michael@0 | 42 | }); |
michael@0 | 43 | }); |
michael@0 | 44 | }); |
michael@0 | 45 | } |
michael@0 | 46 | </script> |
michael@0 | 47 | </pre> |
michael@0 | 48 | </body> |
michael@0 | 49 | </html> |