Re: [csswg-drafts] [css-grid] Do all percentages behave as auto when computing minimum contribution? (#3612)

> I also had the impression that "behaves as auto" was contextual, but I was told that the definition of "behaves as auto" is that the behavior of the value is completely indistinguishable from `auto`, and for grid items percentages are only treated like auto at some points, so they don't behave as auto. IIRC, @FremyCompany was strongly convinced about this, and @fantasai agreed.

No, no, no, that has never been the definition of the term "behaves as auto". It was always contextual, i.e. if the percentage basis was indefinite in the particular place you resolve it.

> I had the impression that percentages being treated as auto at some points and different than auto at other points is a relatively new thing of grid and flex layout.

It's always been like that as far as I know.  This isn't specific to Grid/Flex layout, a simple float will do:
```html
<div style="float:left; border:solid">
  <div style="width:200%; background:lime">abc</div>
</div>
```
Here, `200%` _behaves as auto_ (using the old definition) when computing the float's intrinsic size, resulting in the float getting the size of "abc". When you flow the child though, the container's inline-size is now known so `200%` does **not** _behave as auto_ there - it's simply resolved against that definite inline-size.

> Can you clarify why you think this definition is incompatible?

To be clear, I said that the new definition of "behaves as auto" is incompatible with the old definition of "behaves as auto" (not that the whole new term is necessarily incompatible, although that's also true). The old definition of "behaves as auto" includes percentages resolved against an indefinite percentage basis whereas the new definition of "behaves as auto" does not. From the top of my head, I can't think of a single case where a percentage size does not have a definite percentage basis at least at some point, so percentages never "behaves as auto" with the new definition AFAICT. Thus these two definitions of "behaves as auto" are clearly incompatible.

I assume this is why "or depends on the size of its containing block in the relevant axis" was added - to capture percentages.  However, that term captures too much since **all** percentages _depend on_ their percentage basis (i.e. "size of its containing block"). (also `100%` of `100px`)

If you change the new term to "the size _behaves as auto_ or is a percentage with an indefinite percentage basis" then that  would be compatible with the old definition of "behaves as auto".

This new definition is more cognitively complex though, because now you have one part that is non-contextual ("behaves as auto") and one part that is contextual ("percentage with an indefinite percentage basis"). It's simpler to say that "a percentage with an indefinite percentage basis" behaves as auto.

> Yes, that's why we used "depends on the size of its containing block", we wanted to include percentages. 

OK, but you also need to avoid including `100%` of `100px` there because we clearly don't want to treat that as `auto`.

> Just checking "behaves as auto" wasn't including percentages.

Right, the new definition of "behaves as auto" never includes percentages AFAICT.

-- 
GitHub Notification of comment by MatsPalmgren
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3612#issuecomment-549326683 using your GitHub account

Received on Monday, 4 November 2019 12:11:09 UTC