gecko/layout/generic/test/plugin_clipping_helper2.xhtml

74 lines
2.6 KiB
HTML

<?xml version="1.0"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<html xmlns="http://www.w3.org/1999/xhtml" title="Test Plugin Clipping: Dynamic Tests">
<head>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<style>
embed { width:300px; height:200px; display:block; }
</style>
</head>
<body>
<!-- Use a XUL element here so we can get its boxObject.screenX/Y -->
<hbox style="height:10px; position:absolute; left:0; top:0; z-index:-100;" id="h1"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<hbox style="width:100px;"></hbox><hbox id="h2"/>
</hbox>
<div id="d1" style="width:200px; overflow:hidden; position:absolute; top:0; left:0;">
<embed id="p1" type="application/x-test" wmode="window" style="position:relative"></embed>
</div>
<div id="d2" style="width:200px; height:200px; overflow:hidden; position:absolute; top:100px; left:0;">
<embed id="p2" type="application/x-test" wmode="window"></embed>
<div id="zbox" style="position:absolute; left:50px; top:50px; width:100px; height:100px; background:yellow;">
</div>
</div>
<div id="scroll"
style="position:absolute; top:0; left:0; width:300px; height:400px; overflow:scroll;">
<div id="sbox"
style="margin-top:350px; margin-left:50px; margin-bottom:1000px; width:100px; height:100px; background:blue;"></div>
</div>
<script src="plugin_clipping_lib.js"></script>
<script class="testbody" type="application/javascript">
<![CDATA[
function runTests() {
var scroll = document.getElementById("scroll");
var zbox = document.getElementById("zbox");
var sbox = document.getElementById("sbox");
var p1 = document.getElementById("p1");
var d2 = document.getElementById("d2");
checkClipRegion("p1", [[0, 0, 200, 100]]);
checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
scroll.scrollTop = 150;
checkClipRegion("p2", [[0, 0, 200, 50], [0, 50, 50, 200], [150, 50, 200, 200]]);
zbox.style.zIndex = -1;
checkClipRegion("p2", [[0, 0, 200, 100], [0, 100, 50, 200], [150, 100, 200, 200]]);
sbox.style.background = "";
checkClipRegion("p2", [[0, 0, 200, 200]]);
p1.style.zIndex = 1;
checkClipRegion("p1", [[0, 0, 200, 200]]);
checkClipRegion("p2", [[0, 100, 200, 200]]);
// Test subpixel stuff
p1.style.zIndex = -1;
zbox.style.zIndex = 1;
zbox.style.top = "50.3px;"
d2.style.top = "100.3px";
checkClipRegionNoBounds("p2", [[0, 0, 200, 50], [0, 50, 50, 150], [150, 50, 200, 150], [0, 150, 200, 200]]);
}
]]>
</script>
</body>
</html>