layout/generic/test/plugin_clipping_helper2.xhtml

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 href="/tests/SimpleTest/test.css" type="text/css"?>
     3 <html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Dynamic Tests">
     4 <head>
     5   <style>
     6   embed { width:300px; height:200px; display:block; }
     7   </style>
     8 </head>
     9 <body>
    11 <!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
    12 <hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
    13       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    14   <hbox style="width:100px;"></hbox><hbox id="h2"/>
    15 </hbox>
    17 <div id="d1" style="width:200px; overflow:hidden; position:absolute; top:0; left:0;">
    18   <embed id="p1" type="application/x-test" wmode="window" style="position:relative"></embed>
    19 </div>
    20 <div id="d2" style="width:200px; height:200px; overflow:hidden; position:absolute; top:100px; left:0;">
    21   <embed id="p2" type="application/x-test" wmode="window"></embed>
    22   <div id="zbox" style="position:absolute; left:50px; top:50px; width:100px; height:100px; background:yellow;">
    23   </div>
    24 </div>
    26 <div id="scroll"
    27      style="position:absolute; top:0; left:0; width:300px; height:400px; overflow:scroll;">
    28   <div id="sbox"
    29        style="margin-top:350px; margin-left:50px; margin-bottom:1000px; width:100px; height:100px; background:blue;"></div>
    30 </div>
    32 <script src="plugin_clipping_lib.js"></script>
    33 <script class="testbody" type="application/javascript">
    34 <![CDATA[
    35 var scroll = document.getElementById("scroll");
    36 var zbox = document.getElementById("zbox");
    37 var sbox = document.getElementById("sbox");
    38 var p1 = document.getElementById("p1");
    39 var d2 = document.getElementById("d2");
    41 function runTests() {
    43   checkClipRegion("p1", [[0, 0, 200, 100]]);
    44   checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
    46   scroll.scrollTop = 150;
    48   // A non-zero timeout is needed on X11 (unless an XSync could be performed)
    49   // to delay an OOP plugin's X requests enough so that the X server processes
    50   // them after the parent processes requests (for the changes above).
    51   setTimeout(part2, 1000);
    52 }
    54 function part2() {
    55   checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 200], [150, 50, 200, 200]]);
    57   zbox.style.zIndex = -1;
    59   setTimeout(part3, 1000);
    60 }
    62 function part3() {
    63   checkClipRegion("p2", [[0, 0, 200, 100], [0, 100, 50, 200], [150, 100, 200, 200]]);
    65   sbox.style.background = "";
    67   setTimeout(part4, 1000);
    68 }
    70 function part4() {
    71   checkClipRegion("p2", [[0, 0, 200, 200]]);
    73   p1.style.zIndex = 1;
    75   setTimeout(part5, 1000);
    76 }
    78 function part5() {
    79   checkClipRegion("p1", [[0, 0, 200, 200]]);
    80   checkClipRegion("p2", [[0, 100, 200, 200]]);
    82   // Test subpixel stuff
    83   p1.style.zIndex = -1;
    84   zbox.style.zIndex = 1;
    85   zbox.style.top = "50.3px;"
    86   d2.style.top = "100.3px";
    88   setTimeout(done, 1000);
    89 }
    91 function done() {
    92   checkClipRegionNoBounds("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
    94   window.opener.SimpleTest.finish();
    95   window.close();
    96 }
    98 ]]>
    99 </script>
   101 </body>
   102 </html>

mercurial