layout/base/tests/chrome/chrome_over_plugin_window.xul

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 <?xml version="1.0"?>
michael@0 2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
michael@0 3 <window title="Content/chrome integration subwindow"
michael@0 4 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
michael@0 5 onload="runTests()">\
michael@0 6 <!-- We're mainly testing that a) translucent chrome elements cause the plugin to be clipped away and
michael@0 7 b) translucent content elements do NOT cause the plugin to be clipped away -->
michael@0 8 <stack style="height:100px; width:150px;">
michael@0 9 <iframe type="content" style="border:none;" id="f"
michael@0 10 src="data:text/html,&lt;embed id='e' type='application/x-test' wmode='window'
michael@0 11 style='position:absolute;left:0;top:0;width:100px;height:100px'&gt;&lt;/embed&gt;
michael@0 12 &lt;div style='position:absolute;left:0;top:80px;width:100px;height:10px;background:rgba(0,0,128,0.5)'&gt;&lt;/div&gt;
michael@0 13 &lt;div style='position:absolute;left:0;top:90px;width:100px;height:10px;background:blue'&gt;&lt;/div&gt;
michael@0 14 "/>
michael@0 15 <vbox>
michael@0 16 <vbox style="height:25px; background:yellow;"/> <!-- plugin should be covered here -->
michael@0 17 <vbox style="height:25px; background:rgba(0,128,0,0.5);"/> <!-- plugin should be covered here -->
michael@0 18 <vbox style="height:50px;"/> <!-- plugin should be visible here -->
michael@0 19 </vbox>
michael@0 20 </stack>
michael@0 21
michael@0 22 <script type="application/javascript">
michael@0 23 <![CDATA[
michael@0 24 var imports = [ "SimpleTest", "is", "isnot", "ok", "todo" ];
michael@0 25 for each (var name in imports) {
michael@0 26 window[name] = window.opener.wrappedJSObject[name];
michael@0 27 }
michael@0 28
michael@0 29 var plugin;
michael@0 30 function waitForPaint() {
michael@0 31 if (plugin.getPaintCount() < 1) {
michael@0 32 setTimeout(waitForPaint, 0);
michael@0 33 return;
michael@0 34 }
michael@0 35
michael@0 36 if (plugin.hasWidget()) {
michael@0 37 is(plugin.getClipRegionRectCount(), 1, "plugin clip rect count");
michael@0 38 var left = plugin.getEdge(0);
michael@0 39 var top = plugin.getEdge(1);
michael@0 40 is(plugin.getClipRegionRectEdge(0,0) - left, 0, "plugin clip rect left");
michael@0 41 // our two vboxes with backgrounds should cause the top of the plugin to be clipped
michael@0 42 is(plugin.getClipRegionRectEdge(0,1) - top, 50, "plugin clip rect top");
michael@0 43 is(plugin.getClipRegionRectEdge(0,2) - left, 100, "plugin clip rect right");
michael@0 44 // of the two content DIVs, the first one should not cause the plugin to be clipped because
michael@0 45 // it's transparent. The second one should cause the plugin to be clipped.
michael@0 46 is(plugin.getClipRegionRectEdge(0,3) - top, 90, "plugin clip rect bottom");
michael@0 47 } else {
michael@0 48 todo(false, "Test only tests windowed plugins");
michael@0 49 }
michael@0 50
michael@0 51 var tester = window.SimpleTest;
michael@0 52 window.close();
michael@0 53 tester.finish();
michael@0 54 }
michael@0 55
michael@0 56 function runTests() {
michael@0 57 plugin = document.getElementById("f").contentDocument.getElementById("e").wrappedJSObject;
michael@0 58 waitForPaint();
michael@0 59 }
michael@0 60 ]]>
michael@0 61 </script>
michael@0 62 </window>

mercurial