diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/plugins/test/mochitest/test_painting.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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 'dom/plugins/test/mochitest/test_painting.html')
-rw-r--r-- | dom/plugins/test/mochitest/test_painting.html | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/dom/plugins/test/mochitest/test_painting.html b/dom/plugins/test/mochitest/test_painting.html new file mode 100644 index 000000000..08ebd4675 --- /dev/null +++ b/dom/plugins/test/mochitest/test_painting.html @@ -0,0 +1,121 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>Test for windowless plugin invalidation and expose events in clips</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> + <style> + div#container { + position: relative; + height: 30px; + background: blue; + } + div#clip { + overflow:hidden; + position:absolute; + left: 10.3px; + top: 9.7px; + width: 10px; + height: 0px; + background: red; + } + embed { + position:absolute; + } + embed#paint-waiter { + top: 0px; + left: 0px; + width: 1px; + height: 0px; + } + embed#clipped { + left: -5.3px; + top: -4.7px; + width: 20px; + height: 20px; + } + </style> +</head> +<body onload="initialize()"> + +<script type="application/javascript" src="plugin-utils.js"></script> +<script type="application/javascript"> +SimpleTest.waitForExplicitFinish(); +SimpleTest.requestFlakyTimeout("untriaged"); +setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); + +var paint_waiter; +var clip; +var clipped; + +function initialize() { + paint_waiter = document.getElementById("paint-waiter"); + clip = document.getElementById("clip"); + clipped = document.getElementById("clipped"); + + waitForPaint(show); +} + +function show() { + paintCountIs(clipped, 0, "fully clipped plugin not painted"); + + clip.style.height = "10px"; + + // Capturing an image (as in a reftest) would force a repaint and use + // different paths for the image surface, so instead check the plugin's + // paint count. + waitForPaint(invalidate); +} + +function invalidate() { + paintCountIs(clipped, 1, "partially clipped plugin painted once"); + + clipped.setColor("FF00FF00"); // plugin invalidates + + waitForPaint(done); +} + +function done() { + paintCountIs(clipped, 2, "painted after invalidate"); + + SimpleTest.finish(); +} + +function waitForPaint(func) { + paint_waiter.last_paint_count = paint_waiter.getPaintCount(); + // Ensure the waiter has had a style change, so that this will + // change its size and cause a paint. + paint_waiter.style.backgroundColor = paint_waiter.style.backgroundColor == "blue" ? "yellow" : "blue"; + var flush = paint_waiter.offsetHeight; + paint_waiter.style.height = "1px"; + waitForPaintHelper(func); +} + +function waitForPaintHelper(func) { + if (paint_waiter.getPaintCount() != paint_waiter.last_paint_count) { + // hide the paint waiter + paint_waiter.style.height = "0px"; + setTimeout(func, 0); + return; + } + setTimeout(function() { waitForPaintHelper(func); }, 1000); +} + +</script> + +<p id="display"></p> +<div id="container"> + <embed id="paint-waiter" type="application/x-test"/> + <div id="clip"> + <embed id="clipped" type="application/x-test" + drawmode="solid" color="FF808080"/> + </div> +</div> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +</pre> + +</body> +</html> |