File: anchored-fallback-position-area-wm.html

package info (click to toggle)
firefox 145.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,653,528 kB
  • sloc: cpp: 7,594,999; javascript: 6,459,658; ansic: 3,752,909; python: 1,403,455; xml: 629,809; asm: 438,679; java: 186,421; sh: 67,287; makefile: 19,169; objc: 13,086; perl: 12,982; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (64 lines) | stat: -rw-r--r-- 2,544 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE html>
<title>CSS Conditional Test: @container anchored(fallback) matching &lt;position-area&gt; - orthogonal writing modes</title>
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-2/#anchored-container-queries">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<style>
  #abs-container {
    writing-mode: vertical-lr;
    position: absolute;
    width: 400px;
    height: 400px;
  }
  #anchor {
    direction: rtl;
    anchor-name: --a;
    width: 100px;
    height: 100px;
  }
  .anchored {
    container-type: anchored;
    position: absolute;
    writing-mode: horizontal-tb;
    direction: rtl;
    position-anchor: --a;
    position-area: left;
    /* Does not fit left of the anchor, triggers fallback */
    width: 100px;
    height: 100px;
  }
  #a1 { position-try-fallbacks: self-block-end self-inline-start; }
  #a2 { position-try-fallbacks: block-end inline-end; }
  #t1, #t2 {
    /* Logical values are resolved against anchored / anchor container elements. */
    @container anchored(fallback: bottom right) { --physical: yes; }
    @container anchored(fallback: self-inline-start self-block-end) { --anchor: yes; }
    @container anchored(fallback: inline-end block-end) { --abs-container: yes; }
  }
</style>
<div id="abs-container">
  <div id="anchor"></div>
  <div id="a1" class="anchored">
    <div id="t1"></div>
  </div>
  <div id="a2" class="anchored">
    <div id="t2"></div>
  </div>
</div>
<script>
  test(() => {
    const t1_style = getComputedStyle(t1);
    assert_equals(t1_style.getPropertyValue("--physical"), "yes", "queried physical position-area");
    assert_equals(t1_style.getPropertyValue("--anchor"), "yes", "queried logical self position-area");
    assert_equals(t1_style.getPropertyValue("--abs-container"), "yes", "queried logical container position-area");
  }, "@container anchored(fallback) with 'self-block-end self-inline-start' fallback applied");

  test(() => {
    const t2_style = getComputedStyle(t2);
    assert_equals(t2_style.getPropertyValue("--physical"), "yes", "queried physical position-area");
    assert_equals(t2_style.getPropertyValue("--anchor"), "yes", "queried logical self position-area");
    assert_equals(t2_style.getPropertyValue("--abs-container"), "yes", "queried logical container position-area");
  }, "@container anchored(fallback) with 'block-end inline-end' fallback applied");

</script>