File: intrinsic-percent-replaced-019.html

package info (click to toggle)
thunderbird 1%3A140.4.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,609,432 kB
  • sloc: cpp: 7,672,442; javascript: 5,901,613; ansic: 3,898,954; python: 1,413,343; xml: 653,997; asm: 462,286; java: 180,927; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (72 lines) | stat: -rw-r--r-- 2,070 bytes parent folder | download | duplicates (11)
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
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1748339">
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">

<style>
.outer {
  /* This is just to make the percent values resolve to something
     predictable, and not browser-viewport-size-dependent. */
  width: 500px;
}

.abspos-cb {
  position: relative;
  height: 0;
  width: 0;

  /* This element's padding-box ends up 90px-by-90px, calculated as 9% of the
     .outer elements's 500px width (9% * 500px = 45px) on all four sides (top,
     left, right, and bottom). This padding-box serves as the containing block
     for the abspos flex container, and its size should be considered definite,
     since the percentage-based padding has a definite percentage basis to
     resolve against. So, all the percentage heights down the descendant-chain
     (all the way down to the canvas) should be considered definite as well, and
     that should contribute to canvas's intrinsic width contribution
     (transferring via its aspect-ratio) when the flex item resolves its
     'flex-basis:content'. */
  padding: 9%;
  border: 5px solid green;
}

.flex-container {
  height: 100%;
  width: 100%;
  position: absolute;
  display: flex;
  border: 5px solid green;
  box-sizing: border-box;
  top: 0;
  left: 0;
}

.item {
  border: 5px solid green;
  height: 100%;
  /* width unset */
  flex-basis: content;
  box-sizing: border-box;
}

canvas {
  width: 100%;
  height: 100%;
  border: 5px solid green;
  background: green;
  box-sizing: border-box;
}
</style>

<p>Test passes if there is a filled green square.</p>
<div class="outer">
  <div class="abspos-cb">
    <div class="flex-container">
      <div class="item">
        <canvas width="10" height="10"></canvas>
      </div>
    </div>
  </div>
</div>