tenfourfox/layout/base/tests/chrome/test_transformed_scrolling_repaints.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

61 lines
2.5 KiB
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="chrome://mochikit/content/tests/SimpleTest/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>