1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/base/tests/chrome/chrome_over_plugin_window.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet type="text/css" href="chrome://global/skin"?> 1.6 +<window title="Content/chrome integration subwindow" 1.7 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 1.8 + onload="runTests()">\ 1.9 + <!-- We're mainly testing that a) translucent chrome elements cause the plugin to be clipped away and 1.10 + b) translucent content elements do NOT cause the plugin to be clipped away --> 1.11 + <stack style="height:100px; width:150px;"> 1.12 + <iframe type="content" style="border:none;" id="f" 1.13 + src="data:text/html,<embed id='e' type='application/x-test' wmode='window' 1.14 + style='position:absolute;left:0;top:0;width:100px;height:100px'></embed> 1.15 + <div style='position:absolute;left:0;top:80px;width:100px;height:10px;background:rgba(0,0,128,0.5)'></div> 1.16 + <div style='position:absolute;left:0;top:90px;width:100px;height:10px;background:blue'></div> 1.17 + "/> 1.18 + <vbox> 1.19 + <vbox style="height:25px; background:yellow;"/> <!-- plugin should be covered here --> 1.20 + <vbox style="height:25px; background:rgba(0,128,0,0.5);"/> <!-- plugin should be covered here --> 1.21 + <vbox style="height:50px;"/> <!-- plugin should be visible here --> 1.22 + </vbox> 1.23 + </stack> 1.24 + 1.25 + <script type="application/javascript"> 1.26 + <![CDATA[ 1.27 + var imports = [ "SimpleTest", "is", "isnot", "ok", "todo" ]; 1.28 + for each (var name in imports) { 1.29 + window[name] = window.opener.wrappedJSObject[name]; 1.30 + } 1.31 + 1.32 + var plugin; 1.33 + function waitForPaint() { 1.34 + if (plugin.getPaintCount() < 1) { 1.35 + setTimeout(waitForPaint, 0); 1.36 + return; 1.37 + } 1.38 + 1.39 + if (plugin.hasWidget()) { 1.40 + is(plugin.getClipRegionRectCount(), 1, "plugin clip rect count"); 1.41 + var left = plugin.getEdge(0); 1.42 + var top = plugin.getEdge(1); 1.43 + is(plugin.getClipRegionRectEdge(0,0) - left, 0, "plugin clip rect left"); 1.44 + // our two vboxes with backgrounds should cause the top of the plugin to be clipped 1.45 + is(plugin.getClipRegionRectEdge(0,1) - top, 50, "plugin clip rect top"); 1.46 + is(plugin.getClipRegionRectEdge(0,2) - left, 100, "plugin clip rect right"); 1.47 + // of the two content DIVs, the first one should not cause the plugin to be clipped because 1.48 + // it's transparent. The second one should cause the plugin to be clipped. 1.49 + is(plugin.getClipRegionRectEdge(0,3) - top, 90, "plugin clip rect bottom"); 1.50 + } else { 1.51 + todo(false, "Test only tests windowed plugins"); 1.52 + } 1.53 + 1.54 + var tester = window.SimpleTest; 1.55 + window.close(); 1.56 + tester.finish(); 1.57 + } 1.58 + 1.59 + function runTests() { 1.60 + plugin = document.getElementById("f").contentDocument.getElementById("e").wrappedJSObject; 1.61 + waitForPaint(); 1.62 + } 1.63 + ]]> 1.64 + </script> 1.65 +</window>