gecko-dev/layout/style/test/file_shape_outside_CORS.html

63 строки
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
.container {
clear: both;
width: 500px;
}
.shaper {
width: 50px;
height: 50px;
float: left;
background-color: green;
}
.shapeAllow {
shape-outside: url("support/1x1-transparent.png");
}
.shapeRefuse {
shape-outside: url("http://example.com/layout/style/test/support/1x1-transparent.png");
}
.sibling {
display: inline-block;
}
</style>
<script>
const DOMAIN = "http://mochi.test:8888";
function sendResults() {
// Disable this first part until Bug 1454694.
/*
let divAllow = document.getElementById("allow");
let divAllowSib = divAllow.nextElementSibling;
window.parent.postMessage({
"result": (divAllowSib.getBoundingClientRect().left == divAllow.getBoundingClientRect().left),
"message": "Test 1: Sibling should be at same left offset as div (shape-outside should be allowed), and onload should only fire after layout is complete.",
},
DOMAIN);
*/
let divRefuse = document.getElementById("refuse");
let divRefuseSib = divRefuse.nextElementSibling;
window.parent.postMessage({
"result": (divRefuseSib.getBoundingClientRect().left != divRefuse.getBoundingClientRect().left),
"message": "Test 2: Sibling should be at different left offset from div (shape-outside should be refused).",
},
DOMAIN);
window.parent.postMessage({"done": true}, DOMAIN);
}
</script>
</head>
<body onload="sendResults()">
<div class="container">
<div id="allow" class="shaper shapeAllow"></div><div class="sibling">allow (image is blank, so text is flush left)</div>
</div>
<div class="container">
<div id="refuse" class="shaper shapeRefuse"></div><div class="sibling">refuse (image unread, so text is moved to box edge)</div>
</div>
</body>
</html>