<!DOCTYPE html>
<html>
<head>
<script>
window.onload = function() {
// fetch offsetTop to force a layout
document.body.offsetTop;
var el = document.querySelector('#add-shape-margin .shape');
el.className = 'shape margin50';
el = document.querySelector('#change-shape-margin .shape');
el.className = 'shape margin25';
el = document.querySelector('#remove-shape-margin .shape');
el.className = 'shape';
}
</script>
<style>
.container {
width: 200px;
height: 200px;
overflow-wrap: break-word;
border: 2px solid blue;
font: 50px/1 Ahem, sans-serif;
color: green;
overflow: hidden;
}
.shape {
float: left;
position: relative;
width: 100px;
height: 100px;
-webkit-shape-outside: inset(0 100% 100% 0);
}
.shape::before {
position: absolute;
display: block;
top: 0px; left: 0px;
width: 0;
height: 0;
background-color: blue;
content: ' ';
}
.margin25 {
-webkit-shape-margin: 25px;
}
.margin25::before {
width: 25px;
height: 25px;
}
.margin50 {
-webkit-shape-margin: 50px;
}
.margin50::before {
width: 50px;
height: 50px;
}
</style>
</head>
<body>
<p>When shape-margin is modified dynamically, content affected by the shape's contour should relayout. For each test, you should see green blocks separated by white space, wrapping around a blue square in the upper left. This test requires the Ahem font.</p>
<p>Setting shape-margin with no prior entry</p>
<div id='add-shape-margin' class='container'><div class='shape'></div>x x x x x x x x x x</div>
<p>Setting shape-margin with a prior entry</p>
<div id='change-shape-margin' class='container'><div class='shape margin50'></div>x x x x x x x x x x</div>
<p>Removing shape-margin with a prior entry</p>
<div id='remove-shape-margin' class='container'><div class='shape margin50'></div>x x x x x x x x x x</div>
</body>
</html>