[CSS Grid Layout] Layout is wrong for flex factor sum between 0 and 1
https://bugs.webkit.org/show_bug.cgi?id=148645
Reviewed by Darin Adler.
Source/WebCore:
This patch ensures that we don't normalize the individual tracks
to fill the space. More precisely, when we sum up the flexes, that
tells us how many "units" of flex need to fit into the free
space. We then figure out what size to assign to the flex unit
based on that, and send that back to the individual items, sizing
them appropriately to their flex value.
This way we get flex fraction values applied correctly so they fill
the available space in the indicated proportion. This approach has
an additional advantage of dealing with division by 0 when reducing
automatically the flex value.
Test: fast/css-grid-layout/flex-factor-sum-less-than-1.html
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeNormalizedFractionBreadth):
LayoutTests:
Ensure we don't normalize individual tracks to fill the space, so
at least, the sum of flex values must be 1. We also needed to
modify the grid-element-shrink-to-fit to adapt it to the new
behavior of flex fraction units.
* fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt: Added.
* fast/css-grid-layout/flex-factor-sum-less-than-1.html: Added.
* fast/css-grid-layout/grid-element-shrink-to-fit.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189208
268f45cc-cd09-0410-ab3c-
d52691b4dbfc