Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-grid] Is baseline shim used in the minimum contribution? #3660

Closed
Loirooriol opened this issue Feb 19, 2019 · 3 comments
Closed

[css-grid] Is baseline shim used in the minimum contribution? #3660

Loirooriol opened this issue Feb 19, 2019 · 3 comments
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-grid-1 Target Revision: Current Remove when done.

Comments

@Loirooriol
Copy link
Contributor

From https://drafts.csswg.org/css-grid/#algo-baseline-shims

Shim baseline-aligned items so their intrinsic size contributions reflect their baseline alignment. For the items in each baseline-sharing group, add a “shim” (effectively, additional margin) on the start/end side (for first/last-baseline alignment) of each item so that, when start/end-aligned together their baselines align as specified.
Consider these “shims” as part of the items’ intrinsic size contribution for the purpose of track sizing, below.

The "intrinsic size contribution" term is not linked but I guess it refers exclusively to https://drafts.csswg.org/css-sizing-3/#contributions, i.e. the min-content contribution and the max-content contribution.

However, tracks with an auto minimum are sized using the minimum contribution, which may not be an intrinsic size contribution:

The minimum contribution of an item is the outer size that would result from assuming the item’s used minimum size (min-width or min-height, whichever matches the relevant axis) as its preferred size (width or height, whichever matches the relevant axis) if its computed preferred size behaves as auto, or else the item’s min-content contribution otherwise.

If the preferred size behaves as auto, does the hypothetical outer size include the shim?

For example, https://jsfiddle.net/wkv4trq2/

<div id="grid">
  <div id="item1" class="item"></div>
  <div id="item2" class="item"></div>
</div>
#grid {
  display: grid;
  position: relative;
  grid-template-columns: 100px 100px;
  grid-template-rows: auto;
  align-items: baseline;
  height: 100px;
  width: 200px;
  border: solid;
  line-height: 0;
}
#grid::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 0; right: 0; top: 0; bottom: 0;
  background: cyan;
  grid-row: 1 / 2;
  grid-column: 1 / 3;
}
#item1 {
  padding-bottom: 100px;
  background: yellow;
}
#item2 {
  background: magenta;
  padding-top: 100px;
}
.item {
  min-height: 0;
}
.item::before {
  content: ' ';
  display: inline-block;
  vertical-align: top;
}

If I understand correctly, if the outer size doesn't include the shim, then it will be 100px for both items, so the base size of the row will be 100px. The available grid space is also 100px, so the free space is 0, and the row shouldn't grow beyond this.

However, the row is 200px tall in all Chromium, Firefox and Edge (as you can see with the cyan abspos). So I guess the outer size should include the shim. This is not clear from the spec.

@Loirooriol
Copy link
Contributor Author

In fact Chromium and Edge don't include the shim if the row is sized with minmax(auto, 0) and the 1st item has min-height: auto instead of 0, then the row is 100px tall. Still 200px in Firefox. https://jsfiddle.net/kqgvzd5j/

@Loirooriol
Copy link
Contributor Author

Related with the previous comment, https://drafts.csswg.org/css-grid/#content-based-minimum-size says

are further clamped to less than or equal to the stretch fit into the grid area

Is the shim taken into consideration when subtracting the margins in order to calculate the stretch fit?

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Feb 22, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 4, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 4, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
aarongable pushed a commit to chromium/chromium that referenced this issue Mar 4, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 4, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}
servo-wpt-sync pushed a commit to servo-wpt-sync/web-platform-tests that referenced this issue Mar 4, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}
dinfuehr pushed a commit to dinfuehr/WebKit that referenced this issue Mar 21, 2019
https://bugs.webkit.org/show_bug.cgi?id=195964

Patch by Oriol Brufau <obrufau@igalia.com> on 2019-03-20
Reviewed by Javier Fernandez.

LayoutTests/imported/w3c:

Import WPT tests.

* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-expected.txt: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-lr-expected.txt: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-lr.html: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-rl-expected.txt: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-rl.html: Added.
* web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html: Added.
* web-platform-tests/css/css-grid/layout-algorithm/w3c-import.log:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-lr.html
       imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim-vertical-rl.html
       imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

* rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@243218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 1, 2019
… for the minimum contribution, a=testonly

Automatic update from web-platform-tests
[css-grid] Always consider baseline shim for the minimum contribution

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}

--

wpt-commits: c00bf09575cac952e206c2a7025ee7c84971180f
wpt-pr: 15511
mykmelez pushed a commit to mykmelez/gecko that referenced this issue Apr 2, 2019
… for the minimum contribution, a=testonly

Automatic update from web-platform-tests
[css-grid] Always consider baseline shim for the minimum contribution

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}

--

wpt-commits: c00bf09575cac952e206c2a7025ee7c84971180f
wpt-pr: 15511
@fantasai fantasai added Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. and removed Needs Edits labels Jun 6, 2019
@fantasai
Copy link
Collaborator

fantasai commented Jun 6, 2019

Clarified that the minimum contribution is a type of intrinsic size contribution.

@fantasai fantasai closed this as completed Jun 6, 2019
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this issue Jul 23, 2019
Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Cr-Commit-Position: refs/heads/master@{#637299}
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 4, 2019
… for the minimum contribution, a=testonly

Automatic update from web-platform-tests
[css-grid] Always consider baseline shim for the minimum contribution

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufauigalia.com>
Reviewed-by: Manuel Rego <regoigalia.com>
Reviewed-by: Javier Fernandez <jfernandezigalia.com>
Cr-Commit-Position: refs/heads/master{#637299}

--

wpt-commits: c00bf09575cac952e206c2a7025ee7c84971180f
wpt-pr: 15511

UltraBlame original commit: 78f7e0538669df28260b7c0a21a1db61e2688fe5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 4, 2019
… for the minimum contribution, a=testonly

Automatic update from web-platform-tests
[css-grid] Always consider baseline shim for the minimum contribution

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufauigalia.com>
Reviewed-by: Manuel Rego <regoigalia.com>
Reviewed-by: Javier Fernandez <jfernandezigalia.com>
Cr-Commit-Position: refs/heads/master{#637299}

--

wpt-commits: c00bf09575cac952e206c2a7025ee7c84971180f
wpt-pr: 15511

UltraBlame original commit: 78f7e0538669df28260b7c0a21a1db61e2688fe5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
… for the minimum contribution, a=testonly

Automatic update from web-platform-tests
[css-grid] Always consider baseline shim for the minimum contribution

Before this patch, the shim used for baseline alignment is not taken
into consideration when calculating the minimum contribution of a grid
item if its preferred size is auto, its minimum size is auto, and the
max track sizing function is a fixed small value. In this case, the
auto minimum size can produce a smaller track than if it was 0.

The specification needs to clarify how baseline shims interact with
minimum contributions (w3c/csswg-drafts#3660),
but the above doesn't make sense.

BUG=934535

TEST=external/wpt/css/css-grid/layout-algorithm/grid-minimum-contribution-baseline-shim.html

Change-Id: Iafd194ab7e5656b5018e0e36b915ba183bdedd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1481512
Commit-Queue: Oriol Brufau <obrufauigalia.com>
Reviewed-by: Manuel Rego <regoigalia.com>
Reviewed-by: Javier Fernandez <jfernandezigalia.com>
Cr-Commit-Position: refs/heads/master{#637299}

--

wpt-commits: c00bf09575cac952e206c2a7025ee7c84971180f
wpt-pr: 15511

UltraBlame original commit: 78f7e0538669df28260b7c0a21a1db61e2688fe5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closed Accepted as Editorial Commenter Satisfied Commenter has indicated satisfaction with the resolution / edits. css-grid-1 Target Revision: Current Remove when done.
Projects
None yet
Development

No branches or pull requests

2 participants