layout/base/tests/chrome/chrome_over_plugin_window.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial