summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-anchor-position/anchor-non-oof-inherit.html
blob: 75f98a1ebfe0e6b61008e2152bea88228829af08 (plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<title>Tests that anchor functions can be inherited from in-flow elements</title>
<link rel="help" href="https://drafts4.csswg.org/css-anchor-position-1/">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1382151">
<link rel="author" href="mailto:xiaochengh@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script src="support/test-common.js"></script>

<style>
.cb {
  width: 200px;
  height: 200px;
  transform: scale(1);
}

.anchor {
  width: 100px;
  height: 100px;
  top: 50px;
  left: 50px;
  position: relative;
  background: red;
  anchor-name: --a;
}

.target {
  position: absolute;
  background: green;
  top: inherit;
  bottom: inherit;
  left: inherit;
  right: inherit;
  width: inherit;
  min-width: inherit;
  max-width: inherit;
  height: inherit;
  min-height: inherit;
  max-height: inherit;
}

.inset-parent {
  top: anchor(--a top);
  bottom: anchor(--a bottom);
  left: anchor(--a left);
  right: anchor(--a right);
}

.size-parent {
  width: anchor-size(--a width);
  height: anchor-size(--a height);
  top: 50px;
  left: 50px;
}

.min-size-parent {
  min-width: anchor-size(--a width);
  min-height: anchor-size(--a height);
  top: 50px;
  left: 50px;
  bottom: 200px;
  right: 200px;
}

.max-size-parent {
  max-width: anchor-size(--a width);
  max-height: anchor-size(--a height);
  top: 50px;
  left: 50px;
  bottom: 0px;
  right: 0px;
}

</style>

<body onload="checkLayoutForAnchorPos('.target')">

<p>In each test case, we should see a filled green square with no red.</p>

<div class=cb>
  <div class="anchor"></div>
  <div class="inset-parent">
    <div class="target"
         data-offset-x=50 data-offset-y=50
         data-expected-width=100 data-expected-height=100></div>
  </div>
</div>

<div class=cb>
  <div class="anchor"></div>
  <div class="size-parent">
    <div class="target"
         data-offset-x=50 data-offset-y=50
         data-expected-width=100 data-expected-height=100></div>
  </div>
</div>

<div class=cb>
  <div class="anchor"></div>
  <div class="min-size-parent">
    <div class="target"
         data-offset-x=50 data-offset-y=50
         data-expected-width=100 data-expected-height=100></div>
  </div>
</div>

<div class=cb>
  <div class="anchor"></div>
  <div class="max-size-parent">
    <div class="target"
         data-offset-x=50 data-offset-y=50
         data-expected-width=100 data-expected-height=100></div>
  </div>
</div>

</body>