Skip to content

Commit c8418c0

Browse files
dholbertmoz-wptsync-bot
authored andcommitted
Treat 'height:stretch' (and aliases) as able to resolve against quirks-mode body height.
This patch lets 'stretch' block-sizes get opted in so they can resolve against the result of `CalcQuirkContainingBlockHeight()`. That's where we handle the "html element fills the viewport" and "body element fills the html element" quirks-mode behaviors explained here: https://quirks.spec.whatwg.org/#the-html-element-fills-the-viewport-quirk https://quirks.spec.whatwg.org/#the-body-element-fills-the-html-element-quirk This makes us match the behavior that other browsers have been shipping (with 'stretch' in Chrome as well as its '-webkit-fill-available' alias in Chrome and Safari), and we're aware of at least one site that depends on this behavior (tracked in bug 1886566). Differential Revision: https://phabricator.services.mozilla.com/D273323 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1989365 gecko-commit: 2cb11aff2f457ec44347183a1d116c8fbd9c45c9 gecko-reviewers: TYLin, layout-reviewers
1 parent 07b3286 commit c8418c0

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- no doctype, to trigger quirks mode -->
2+
<meta charset="utf-8">
3+
<link rel="author" title="Daniel Holbert" href="mailto:[email protected]">
4+
<title>CSS Reference Case</title>
5+
<style>
6+
body {
7+
margin: 0;
8+
}
9+
body > * {
10+
box-sizing: border-box;
11+
height: 100vh;
12+
13+
/* The rest of these styles are just for cosmetics & consistency: */
14+
width: 40px;
15+
border: 5px solid blue;
16+
vertical-align: top;
17+
margin: 0 10px 0 0;
18+
background: cyan;
19+
}
20+
</style>
21+
<body>
22+
<div style="display: inline-block">IB</div>
23+
<canvas></canvas>
24+
<iframe></iframe>
25+
<button>B</button>
26+
<input value="i">
27+
<textarea></textarea>
28+
</body>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!-- no doctype, to trigger quirks mode -->
2+
<meta charset="utf-8">
3+
<title>
4+
CSS Test: 'stretch' heights can resolve against body height, with
5+
quirks-mode body-fills-html-which-fills-viewport behavior
6+
</title>
7+
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#sizing-values">
8+
<link rel="help" href="https://quirks.spec.whatwg.org/#the-html-element-fills-the-viewport-quirk">
9+
<link rel="help" href="https://quirks.spec.whatwg.org/#the-body-element-fills-the-html-element-quirk">
10+
<link rel="author" title="Daniel Holbert" href="mailto:[email protected]">
11+
<link rel="match" href="stretch-quirk-001-ref.html">
12+
<meta name="assert"
13+
content="In quirks mode, the body's automatic height should be considered definite for the purposes of 'stretch' resolution on its children">
14+
<style>
15+
body {
16+
margin: 0;
17+
}
18+
body > * {
19+
box-sizing: border-box;
20+
height: -webkit-fill-available;
21+
height: stretch;
22+
23+
/* The rest of these styles are just for cosmetics & consistency: */
24+
width: 40px;
25+
border: 5px solid blue;
26+
vertical-align: top;
27+
margin: 0 10px 0 0;
28+
background: cyan;
29+
}
30+
</style>
31+
<body>
32+
<div style="display: inline-block">IB</div>
33+
<canvas></canvas>
34+
<iframe></iframe>
35+
<button>B</button>
36+
<input value="i">
37+
<textarea></textarea>
38+
</body>

0 commit comments

Comments
 (0)