-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathcorner-shape-outside-left.html
More file actions
71 lines (65 loc) · 2.19 KB
/
Copy pathcorner-shape-outside-left.html
File metadata and controls
71 lines (65 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<title>shape-outside with corner-shape: notch</title>
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#shapes-from-box-values">
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#corner-shape">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
body {
margin: 0;
}
.container {
width: 200px;
line-height: 0;
}
.shape {
float: left;
shape-outside: border-box;
border-radius: 48%;
box-sizing: content-box;
height: 40px;
width: 40px;
padding: 20px;
border: 20px solid lightgreen;
margin: 20px;
background-color: orange;
}
.box {
display: inline-block;
width: 60px;
background-color: blue;
}
.longbox {
display: inline-block;
width: 200px;
height: 20px;
background-color: blue;
}
</style>
<main class="container">
<div class="shape"></div>
<div class="longbox"></div> <!-- Saturate the margin space -->
<div class="box" style="height: 24px;"></div> <!-- Box at corner -->
<div class="box" style="height: 36px;"></div>
<div class="box" style="height: 36px;"></div>
<div class="box" style="height: 24px;"></div> <!-- Box at corner -->
<div class="longbox"></div> <!-- Saturate the margin space -->
</main>
<script>
function shape_outside_corner_shape_test(corner_shape, expected) {
test(() => {
const shape = document.querySelector(".shape");
shape.style.setProperty("corner-shape", corner_shape);
const actual = Array.from(document.querySelectorAll(".container .box")).map(b => b.getBoundingClientRect().x);
assert_array_approx_equals(actual, expected, 2);
}, `corner-shape: ${corner_shape} with shape-outside`);
}
shape_outside_corner_shape_test("notch", [82, 140, 140, 82]);
shape_outside_corner_shape_test("bevel", [106, 140, 140, 106]);
shape_outside_corner_shape_test("notch bevel", [106, 140, 140, 82]);
shape_outside_corner_shape_test("round", [130, 140, 140, 130]);
shape_outside_corner_shape_test("square", [140, 140, 140, 140]);
shape_outside_corner_shape_test("scoop", [88, 140, 140, 88]);
shape_outside_corner_shape_test("superellipse(1.5)", [135, 140, 140, 135]);
shape_outside_corner_shape_test("superellipse(-.8)", [88, 140, 140, 88]);
</script>