layout/generic/test/plugin_clipping_helper2.xhtml

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

mercurial