[CSS Grid Layout] Columns set in percentages collapse to auto width
https://bugs.webkit.org/show_bug.cgi?id=141435
Reviewed by David Hyatt.
Source/WebCore:
Based on a patch by Sergio Villar Senin <svillar@igalia.com>.
This patch adds 2 new new methods in RenderBox to determine if the grid
has a definite size or not.
RenderGrid::gridTrackSize() was not checking properly if the grid has or
not an indefinite size.
The condition was including auto which is not indefinite per se. For
example, auto is definite if the containing block is definite.
As the new method is more expensive, we just call it when it's really
needed to avoid performance regressions.
Finally we were setting the override logical width/height to -1 (no
possible resolution) for all the items regardless if they've a relative
width/height or a fixed one.
Added the condition, including not only items with percentage logical
width/height but also relative, to avoid overriding the value for items
with fixed width/height as it's not needed.
Tests: fast/css-grid-layout/grid-item-with-percent-height-in-auto-height-grid-resolution.html
fast/css-grid-layout/percent-intrinsic-track-breadth.html
fast/css-grid-layout/percent-track-breadths-regarding-container-size.html
(WebCore::logicalWidthIsResolvable):
(WebCore::RenderBox::hasDefiniteLogicalWidth):
(WebCore::RenderBox::percentageLogicalHeightIsResolvableFromBlock):
(WebCore::RenderBox::hasRelativeLogicalWidth):
- rendering/RenderBox.h:
- rendering/RenderGrid.cpp:
(WebCore::RenderGrid::hasDefiniteLogicalSize):
(WebCore::RenderGrid::gridTrackSize):
(WebCore::RenderGrid::logicalContentHeightForChild):
(WebCore::RenderGrid::minContentForChild):
(WebCore::RenderGrid::maxContentForChild):
LayoutTests:
Added new tests to check that percentage track breadths are properly
calculated under different sizing conditions.
Modified one test to include relative sizes too.
- fast/css-grid-layout/grid-item-with-percent-height-in-auto-height-grid-resolution-expected.txt:
- fast/css-grid-layout/grid-item-with-percent-height-in-auto-height-grid-resolution.html:
- fast/css-grid-layout/percent-intrinsic-track-breadth-expected.txt: Added.
- fast/css-grid-layout/percent-intrinsic-track-breadth.html: Added.
- fast/css-grid-layout/percent-track-breadths-regarding-container-size-expected.txt: Added.
- fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: Added.