[css-contain][css-grid] Support size containment on grid containers #14302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were always sizing grid containers with "contain: size" as 0x0.
However this is wrong as discussed on the following GitHub issue:
w3c/csswg-drafts#2804
To do this we add a new method to GridTrackSizingAlgorithmStrategy
called IsComputingSizeContainment() to determine the cases
in which we're computing the size containment dimensions.
That way we can run only the initialization step instead
of the full algorithm to get the expected track sizes
for size containment.
For widths the change is pretty simple
in LayoutGrid::ComputeIntrinsicLogicalWidths().
For heights we don't have a phase to compute the intrinsic size
so apart from the changes in LayoutGrid::UpdateBlockLayout()
we need some extra checks in LayoutBox too.
There is a minor change in test contain-size-grid-002.html,
because after this patch it was not passing yet due to some overflow
that is unrelated to the purpose of the test.
BUG=855261
TEST=external/wpt/css/css-contain/contain-size-grid-002.html
TEST=external/wpt/css/css-contain/contain-size-grid-003.html
Change-Id: I4d0fd417183068518070721afde84efdbfe1fcb4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1355923
Commit-Queue: Manuel Rego <rego@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#657678}