summaryrefslogtreecommitdiffstats
path: root/layout/base/tests/chrome/test_will_change.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/base/tests/chrome/test_will_change.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/base/tests/chrome/test_will_change.html')
-rw-r--r--layout/base/tests/chrome/test_will_change.html99
1 files changed, 99 insertions, 0 deletions
diff --git a/layout/base/tests/chrome/test_will_change.html b/layout/base/tests/chrome/test_will_change.html
new file mode 100644
index 000000000..fb8122b0b
--- /dev/null
+++ b/layout/base/tests/chrome/test_will_change.html
@@ -0,0 +1,99 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Tests for MozAfterPaint</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>
+ <style>
+ #checkOpacityRepaint {
+ will-change: opacity;
+ }
+ #checkTransformRepaint {
+ will-change: transform;
+ }
+ div {
+ width: 100px;
+ height: 100px;
+ background: radial-gradient(ellipse at center, #87e0fd 0%,#53cbf1 40%,#05abe0 100%);
+ }
+ </style>
+</head>
+<body>
+ <div id="checkRepaint">
+ Check repaint without will-change
+ </div>
+ <div id="checkOpacityRepaint">
+ Check repaint with will-change
+ </div>
+ <div id="checkTransformRepaint">
+ Check repaint with will-change
+ </div>
+</body>
+<script>
+
+var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIDOMWindowUtils);
+
+var initialPaintCount = 0;
+
+function test_checkRepaint(next) {
+ var element = document.getElementById("checkRepaint");
+ waitForAllPaintsFlushed(function () {
+ utils.checkAndClearPaintedState(element);
+ element.style.opacity = "0.5";
+ waitForAllPaintsFlushed(function () {
+ var painted = utils.checkAndClearPaintedState(element);
+ // *** We check that this repaints because the test is relying
+ // on this property. If this is broken then this test wont
+ // be reliable check for will-change.
+ is(painted, true, "element should have been painted");
+ next();
+ });
+ });
+}
+
+function test_checkOpacityRepaint(next) {
+ var element = document.getElementById("checkOpacityRepaint");
+ waitForAllPaintsFlushed(function () {
+ utils.checkAndClearPaintedState(element);
+ element.style.opacity = "0.5";
+ waitForAllPaintsFlushed(function () {
+ var painted = utils.checkAndClearPaintedState(element);
+ // BasicLayers' heuristics are so that even with will-change:opacity,
+ // we can still have repaints.
+ if (utils.layerManagerType != "Basic") {
+ is(painted, false, "will-change checkOpacityRepaint element should not have been painted");
+ }
+ next();
+ });
+ });
+}
+
+function test_checkTransformRepaint(next) {
+ var element = document.getElementById("checkTransformRepaint");
+ waitForAllPaintsFlushed(function () {
+ utils.checkAndClearPaintedState(element);
+ element.style.transform = "translateY(-5px)";
+ waitForAllPaintsFlushed(function () {
+ var painted = utils.checkAndClearPaintedState(element);
+ // BasicLayers' heuristics are so that even with will-change:transform,
+ // we can still have repaints.
+ if (utils.layerManagerType != "Basic") {
+ is(painted, false, "will-change checkTransformRepaint element should not have been painted");
+ }
+ next();
+ });
+ });
+}
+
+SimpleTest.waitForExplicitFinish();
+test_checkRepaint(function(){
+ test_checkOpacityRepaint(function(){
+ test_checkTransformRepaint(function(){
+ SimpleTest.finish();
+ });
+ });
+});
+
+</script>
+</html>