layout/generic/test/plugin_clipping_helper2.xhtml

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/test/plugin_clipping_helper2.xhtml	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,102 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
     1.6 +<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Dynamic Tests">
     1.7 +<head>
     1.8 +  <style>
     1.9 +  embed { width:300px; height:200px; display:block; }
    1.10 +  </style>
    1.11 +</head>
    1.12 +<body>
    1.13 +
    1.14 +<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
    1.15 +<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
    1.16 +      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    1.17 +  <hbox style="width:100px;"></hbox><hbox id="h2"/>
    1.18 +</hbox>
    1.19 +
    1.20 +<div id="d1" style="width:200px; overflow:hidden; position:absolute; top:0; left:0;">
    1.21 +  <embed id="p1" type="application/x-test" wmode="window" style="position:relative"></embed>
    1.22 +</div>
    1.23 +<div id="d2" style="width:200px; height:200px; overflow:hidden; position:absolute; top:100px; left:0;">
    1.24 +  <embed id="p2" type="application/x-test" wmode="window"></embed>
    1.25 +  <div id="zbox" style="position:absolute; left:50px; top:50px; width:100px; height:100px; background:yellow;">
    1.26 +  </div>
    1.27 +</div>
    1.28 +
    1.29 +<div id="scroll"
    1.30 +     style="position:absolute; top:0; left:0; width:300px; height:400px; overflow:scroll;">
    1.31 +  <div id="sbox"
    1.32 +       style="margin-top:350px; margin-left:50px; margin-bottom:1000px; width:100px; height:100px; background:blue;"></div>
    1.33 +</div>
    1.34 +
    1.35 +<script src="plugin_clipping_lib.js"></script>
    1.36 +<script class="testbody" type="application/javascript">
    1.37 +<![CDATA[
    1.38 +var scroll = document.getElementById("scroll");
    1.39 +var zbox = document.getElementById("zbox");
    1.40 +var sbox = document.getElementById("sbox");
    1.41 +var p1 = document.getElementById("p1");
    1.42 +var d2 = document.getElementById("d2");
    1.43 +
    1.44 +function runTests() {
    1.45 +
    1.46 +  checkClipRegion("p1", [[0, 0, 200, 100]]);
    1.47 +  checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
    1.48 +
    1.49 +  scroll.scrollTop = 150;
    1.50 +
    1.51 +  // A non-zero timeout is needed on X11 (unless an XSync could be performed)
    1.52 +  // to delay an OOP plugin's X requests enough so that the X server processes
    1.53 +  // them after the parent processes requests (for the changes above).
    1.54 +  setTimeout(part2, 1000);
    1.55 +}
    1.56 +
    1.57 +function part2() {
    1.58 +  checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 200], [150, 50, 200, 200]]);
    1.59 +
    1.60 +  zbox.style.zIndex = -1;
    1.61 +
    1.62 +  setTimeout(part3, 1000);
    1.63 +}
    1.64 +
    1.65 +function part3() {
    1.66 +  checkClipRegion("p2", [[0, 0, 200, 100], [0, 100, 50, 200], [150, 100, 200, 200]]);
    1.67 +
    1.68 +  sbox.style.background = "";
    1.69 +
    1.70 +  setTimeout(part4, 1000);
    1.71 +}
    1.72 +
    1.73 +function part4() {
    1.74 +  checkClipRegion("p2", [[0, 0, 200, 200]]);
    1.75 +  
    1.76 +  p1.style.zIndex = 1;
    1.77 +
    1.78 +  setTimeout(part5, 1000);
    1.79 +}
    1.80 +
    1.81 +function part5() {
    1.82 +  checkClipRegion("p1", [[0, 0, 200, 200]]);
    1.83 +  checkClipRegion("p2", [[0, 100, 200, 200]]);
    1.84 +
    1.85 +  // Test subpixel stuff
    1.86 +  p1.style.zIndex = -1;
    1.87 +  zbox.style.zIndex = 1;
    1.88 +  zbox.style.top = "50.3px;"
    1.89 +  d2.style.top = "100.3px";
    1.90 +
    1.91 +  setTimeout(done, 1000);
    1.92 +}
    1.93 +
    1.94 +function done() {
    1.95 +  checkClipRegionNoBounds("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
    1.96 +
    1.97 +  window.opener.SimpleTest.finish();
    1.98 +  window.close();
    1.99 +}
   1.100 +
   1.101 +]]>
   1.102 +</script>
   1.103 +
   1.104 +</body>
   1.105 +</html>

mercurial