Visitar URL original
[css-grid] Dimensions unclear when clamping content-based minimum size · Issue #3573 · w3c/csswg-drafts · GitHub
Skip to content

[css-grid] Dimensions unclear when clamping content-based minimum size #3573

Closed

Description

@Loirooriol

From https://drafts.csswg.org/css-grid/#content-based-minimum-size,

if the grid item spans only grid tracks that have a fixed max track sizing function, its specified size suggestion and content size suggestion in that dimension (and the input to the transferred size suggestion in the other dimension) are further clamped to less than or equal to the stretch fit the grid area’s size

The other dimension is mixed in between, so it's not much clear

  • whether "the grid item spans only grid tracks that have a fixed max track sizing function" refers to both dimensions, the given dimension, or the given dimension when clamping the specified and content size suggestions but the other dimension for the transferred size suggestion.
  • to which dimension the "stretch fit the grid area’s size" refers.
  • whether the limit should be converted through the aspect ratio when it's in the other dimension.

I would just keep it simple and check track sizing functions only in the given dimension, clamp in the given dimension, to the size in the given dimension.

Activity

  1. fantasai commented on Jan 31, 2019

    @fantasai
    Collaborator

    I would just keep it simple and check track sizing functions only in the given dimension, clamp in the given dimension, to the size in the given dimension.

    Yes, that's the intention.

  2. fantasai commented on Jan 31, 2019

    @fantasai
    Collaborator

    Oops. forgot the --amend, I guess the second commit should have been "update DoC".

    Anyway. I added some words, lmk if it's acceptable. :)

  3. Loirooriol commented on Feb 1, 2019

    @Loirooriol
    ContributorAuthor

    I don't think it's clear either.

    The content-based minimum size for a grid item in a given dimension is [...]. if in a given dimension

    Are these dimensions the same, or independent?

    and its input to the transferred size suggestion in the opposite dimension

    So if I have an item with min-width: auto in a column sized with 100px, it has an aspect ratio of 3:1 and height: 50px, then this seems to mean it should clamp the input (i.e. the height 50px) by the max column size 100px, which is still 50px, then convert it through the aspect ratio, which is 150px, and this overflows the column.

    So I don't get why bother with opposite dimensions, if this is trying to prevent overflow why not just calculate (without clamping the input) the transferred size suggestion, i.e. 150px, and then clamp by 100px? Like

    However, to prevent the content-based minimum size from forcing overflow of its fixed-size grid area, if in the given dimension the grid item spans only grid tracks that have a fixed max track sizing function, then the content-based minimum size is clamped to less than or equal to the stretch fit into the grid area’s maximum size in that dimension

  4. fantasai commented on Feb 1, 2019

    @fantasai
    Collaborator

    Are these dimensions the same, or independent?

    It doesn't matter? Afaict whichever way you want to interpret it, the paragraph means the same thing...

    So if I have an item with min-width: auto in a column sized with 100px, it has an aspect ratio of 3:1 and height: 50px, then this seems to mean it should clamp the input (i.e. the height 50px) by the max column size 100px, which is still 50px, then convert it through the aspect ratio, which is 150px, and this overflows the column.

    No, it would clamp the input from the current dimension into the transferred size of the opposite dimension. See #767

  5. Loirooriol commented on Feb 2, 2019

    @Loirooriol
    ContributorAuthor

    OK, I get it now, thanks. In

    its input to the transferred size suggestion in the opposite dimension

    my understanding was that the thing "in the opposite dimension" was the "input", not the "transferred size suggestion", which didn't make much sense.

    It would be clearer if the spec used the wording from your comment, i.e.

    its input from the current dimension to the transferred size suggestion of the opposite dimension

    Or even better refactor the whole thing like

    The foobar of a grid item in a given dimension is, if it spans only grid tracks that have a fixed max track sizing function, the stretch fit into the sum of those grid tracks’ max track sizing functions plus any intervening fixed gutters. Otherwise, it's infinite.

    • specified size suggestion
      If the item’s computed preferred size property in the relevant axis is definite, then the specified size suggestion is that size, clamped by the relevant max size property if it’s definite, and further clamped by the foobar of the grid item in that axis.
    • transferred size suggestion
      If the item has an intrinsic aspect ratio and its computed preferred size property in the opposite axis is definite, then the transferred size suggestion is that size, clamped by the opposite-axis min and max size properties if they are definite, further clamped by the foobar of the grid item in the opposite axis, converted through the aspect ratio and finally clamped by the same-axis max size property if it’s definite.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions