Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-shapes/shape-outside/shape-image/shape-image-027.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>CSS Test: left float, url(png), real negative offset image + shape-margin (px)</title>
<link rel="author" title="Brad Werth" href="mailto:bwerth@mozilla.com"/>
<link rel="match" href="reference/shape-image-006-ref.html"/>
<meta name="flags" content="ahem"/>
<meta name="assert" content="This test verifies that content wraps around all the image pixels
+ the shape-margin when shape-outside is given a png file.
Additionally, the shape-outside: image element is given a negative
left offset relative to its containing block."/>
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
<style type="text/css">
body {
margin: 0;
}
.container {
left: 10px;
font: 50px/1 Ahem;
}
#test {
width: 200px;
color: rgb(0,100,0);
}
#image {
float: left;
shape-outside: url("support/left-half-rectangle.png");
shape-margin: 20px;
margin-left: -10px;
width: 100px;
height: 100px;
}
.blue {
width: 2px;
height: 100px;
background-color: blue;
}
.left-line { left: 65px; }
.right-line { left: 125px; }
.failure {
left: 70px;
width: 50px;
height: 100px;
background-color: red;
z-index: -1;
}
.container, .blue, .failure {
position: absolute;
top: 70px;
}
</style>
</head>
<body>
<p>
The test passes if the green rectangle on the right is completely between the two blue lines.
There should be no red.
</p>
<div id="test" class="container">
<div id="image"><img src="support/left-half-rectangle.png" style="margin-left: 10px"/></div>
X<br/>X
</div>
<div class="blue left-line"></div>
<div class="blue right-line"></div>
<div class="failure"></div>
<script>
// A workaround of an issue of Chromium content_shell. It finishes a test
// without waiting layout with images linked from url(). crbug.com/372756068
window.addEventListener('load', () => {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.classList.remove('reftest-wait');
});
});
});
</script>
</body>
</html>