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 scaled elements with scrolled contents don't repaint unnecessarily when we scroll inside them</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.2, 1.2); -moz-transform-origin:top left; width:200px; height:100px; background:yellow; overflow:hidden"> |
michael@0 | 12 | <div style="height:40px;">Hello</div> |
michael@0 | 13 | <div id="e" style="height:30px; background:lime">Kitty</div> |
michael@0 | 14 | <div style="height:300px; background:yellow">Kitty</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 | const isLinux = navigator.platform.indexOf("Linux") >= 0; |
michael@0 | 25 | const is64 = navigator.platform.indexOf("x86_64") >= 0; |
michael@0 | 26 | var winLowerThanVista = navigator.platform.indexOf("Win") == 0; |
michael@0 | 27 | if (winLowerThanVista) { |
michael@0 | 28 | var version = Components.classes["@mozilla.org/system-info;1"] |
michael@0 | 29 | .getService(Components.interfaces.nsIPropertyBag2) |
michael@0 | 30 | .getProperty("version"); |
michael@0 | 31 | winLowerThanVista = parseFloat(version) < 6.0; |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | function startTest() { |
michael@0 | 35 | // Do a couple of scrolls to ensure we've triggered activity heuristics. |
michael@0 | 36 | waitForAllPaintsFlushed(function () { |
michael@0 | 37 | t.scrollTop = 5; |
michael@0 | 38 | waitForAllPaintsFlushed(function () { |
michael@0 | 39 | t.scrollTop = 10; |
michael@0 | 40 | waitForAllPaintsFlushed(function () { |
michael@0 | 41 | // Clear paint state now and scroll again. |
michael@0 | 42 | utils.checkAndClearPaintedState(e); |
michael@0 | 43 | t.scrollTop = 15; |
michael@0 | 44 | waitForAllPaintsFlushed(function () { |
michael@0 | 45 | var painted = utils.checkAndClearPaintedState(e); |
michael@0 | 46 | if ((isLinux && !is64) || winLowerThanVista) { |
michael@0 | 47 | todo(false, "Fully-visible scrolled element should not have been painted (random on Linux-32)"); |
michael@0 | 48 | } else { |
michael@0 | 49 | is(painted, false, "Fully-visible scrolled element should not have been painted"); |
michael@0 | 50 | } |
michael@0 | 51 | SimpleTest.finish(); |
michael@0 | 52 | }); |
michael@0 | 53 | }); |
michael@0 | 54 | }); |
michael@0 | 55 | }); |
michael@0 | 56 | } |
michael@0 | 57 | </script> |
michael@0 | 58 | </pre> |
michael@0 | 59 | </body> |
michael@0 | 60 | </html> |