Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f54a2f0

Browse files
committed
Bug 1640916 [wpt PR 23772] - [css-grid] Consider 'auto' height items for grid area estimation, a=testonly
Automatic update from web-platform-tests [css-grid] Consider 'auto' height items for grid area estimation We perform a pre-layout, based on a estimation of the grid area, of the grid items in two different situations: orthogonal and baseline aligned items. In the case of baseline aligned items, we were doing this pre-layout only in the case of items with relative inline and block sizes. However, items with 'auto' block-size also depend on this estimated grid area size to properly compute the baseline offset. It was discarded in the past due to performance concerns, since the 'auto' height is a very common case. However, this codepath is only executed for baseline aligned items. Since we already applied several optimization to the baseline alignment logic, I think we can try this approach to solve the bug and evaluate potential perf regressions when they appear. Bug: 1086132 Change-Id: I73c39e6c3ad6cd74aa50fe33106e25cd63b7625f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215054 Reviewed-by: Manuel Rego <rego@igalia.com> Reviewed-by: Oriol Brufau <obrufau@igalia.com> Commit-Queue: Javier Fernandez <jfernandez@igalia.com> Cr-Commit-Position: refs/heads/master@{#774139} -- wpt-commits: b4205f9f8b440e56da7fb2bd6cc26643296b02e1 wpt-pr: 23772 Differential Revision: https://phabricator.services.mozilla.com/D78782
1 parent 975d990 commit f54a2f0

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Grid Layout Test: Self-Baseline alignment along column-axis on fixed sized grids and synthesized baselines</title>
4+
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
5+
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#alignment">
6+
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#column-align">
7+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-align-items">
8+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-alignment">
9+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-baseline">
10+
<link rel="help" href="https://drafts.csswg.org/css-align/#synthesize-baseline">
11+
<link rel="stylesheet" href="/css/support/grid.css">
12+
<link rel="stylesheet" href="../../support/alignment.css">
13+
<meta name="assert" content="Grid items orthogonal to the Baseline Alignment Context should use their border-box 'under' edge as synthesized baseline.">
14+
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
15+
<style>
16+
body { overflow: scroll; }
17+
.container { position: relative; }
18+
.grid {
19+
position: relative;
20+
grid-template-rows: 150px;
21+
text-orientation: sideways;
22+
font: 20px/1 Ahem;
23+
}
24+
.width100 { width: 100px; }
25+
.width200 { width: 200px; }
26+
.width300 { width: 300px; }
27+
.bigFont { font-size: 50px; }
28+
</style>
29+
<script src="/resources/testharness.js"></script>
30+
<script src="/resources/testharnessreport.js"></script>
31+
<script src="/resources/check-layout-th.js"></script>
32+
<script type="text/javascript">
33+
setup({ explicit_done: true });
34+
</script>
35+
<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">
36+
37+
<pre>verticalLR grid and parallel items</pre>
38+
39+
<div class="grid width100 alignItemsBaseline">
40+
<div class="firstRowFirstColumn verticalLR" data-offset-x="0" data-offset-y="0" data-expected-width="35" data-expected-height="120">É É ÉÉ</div>
41+
<div class="firstRowSecondColumn verticalLR bigFont" data-offset-x="35" data-offset-y="70" data-expected-width="65" data-expected-height="50">É</div>
42+
</div>
43+
44+
<pre>verticalRL grid and parallel items</pre>
45+
46+
<div class="grid width100 alignItemsBaseline">
47+
<div class="firstRowFirstColumn verticalRL" data-offset-x="0" data-offset-y="0" data-expected-width="35" data-expected-height="120">É É ÉÉ</div>
48+
<div class="firstRowSecondColumn verticalRL bigFont" data-offset-x="35" data-offset-y="70" data-expected-width="65" data-expected-height="50">É</div>
49+
</div>
50+
51+
</body>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Grid Layout Test: Self-Baseline alignment along row-axis on content-sized grids and synthesized baselines</title>
4+
<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
5+
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#alignment">
6+
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#row-align">
7+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-justify-items">
8+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#baseline-alignment">
9+
<link rel="help" href="https://drafts.csswg.org/css-align-3/#valdef-justify-self-baseline">
10+
<link rel="help" href="https://drafts.csswg.org/css-align/#synthesize-baseline">
11+
<link rel="stylesheet" href="/css/support/grid.css">
12+
<link rel="stylesheet" href="../../support/alignment.css">
13+
<meta name="assert" content="Grid items orthogonal to the Baseline Alignment Context should use their border-box 'under' edge as synthesized baseline.">
14+
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
15+
<style>
16+
body { overflow: scroll; }
17+
.container { position: relative; }
18+
.grid {
19+
position: relative;
20+
grid-template-columns: 150px;
21+
text-orientation: sideways;
22+
font: 20px/1 Ahem;
23+
}
24+
.width100 { width: 100px; }
25+
.width200 { width: 200px; }
26+
.width300 { width: 300px; }
27+
.bigFont { font-size: 50px; }
28+
</style>
29+
<script src="/resources/testharness.js"></script>
30+
<script src="/resources/testharnessreport.js"></script>
31+
<script src="/resources/check-layout-th.js"></script>
32+
<script type="text/javascript">
33+
setup({ explicit_done: true });
34+
</script>
35+
<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">
36+
37+
<pre>verticalLR grid and parallel items</pre>
38+
39+
<div class="container width100 verticalLR">
40+
<div class="grid justifyItemsBaseline">
41+
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="120">É É ÉÉ</div>
42+
<div class="secondRowFirstColumn bigFont" data-offset-x="20" data-offset-y="70" data-expected-width="50" data-expected-height="50">É</div>
43+
</div>
44+
</div>
45+
46+
<pre>verticalRL grid and parallel items</pre>
47+
48+
<div class="container width100 verticalRL">
49+
<div class="grid justifyItemsBaseline">
50+
<div class="firstRowFirstColumn" data-offset-x="50" data-offset-y="0" data-expected-width="20" data-expected-height="120">É É ÉÉ</div>
51+
<div class="secondRowFirstColumn bigFont" data-offset-x="0" data-offset-y="70" data-expected-width="50" data-expected-height="50">É</div>
52+
</div>
53+
</div>
54+
55+
</body>

0 commit comments

Comments
 (0)