[CSS Grid Layout] Layout is wrong for flex factor sum between 0 and 1
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 15:04:08 +0000 (15:04 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Sep 2015 15:04:08 +0000 (15:04 +0000)
commit66f2c1c3a1edcc8caeb8ba23e8057d837bc8424a
treef274ef2bda278292bb88237ca88672f850da6f91
parent068ff16b5b405b17d66d9144c08fed147beca262
[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
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/flex-factor-sum-less-than-1.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-element-shrink-to-fit.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp