[CSS Grid Layout] Flex tracks sizing alg must handle 0fr values
authorjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2015 12:32:48 +0000 (12:32 +0000)
committerjfernandez@igalia.com <jfernandez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2015 12:32:48 +0000 (12:32 +0000)
commit7feb11e1e59b1e0723f0cd96f8c97369f934c653
treeb14af1df290f7cc5c157b826cb8fce995efb21e6
parent9208fe869dcd1a6a1136d9ebc70609ed98ad0d68
[CSS Grid Layout] Flex tracks sizing alg must handle 0fr values
https://bugs.webkit.org/show_bug.cgi?id=148944

Reviewed by Darin Adler.

Source/WebCore:

We don't allow 0 as flexible size value, which is not following current
specs; it just states that it must be a positive value. This patch
adds such change in the parser but some additional logic must be added
as well to handle 0 values during the flex tracks sizing algorithm.

The old algorithm didn't take 0 values into account, so there is the risk
of division by zero. Additionally, it was not handling fraction values
in the best way. The last versions of the spec changed this algorithm in
order to handle fraction values so that they don't cause exponential
grow of tracks using values bigger than 1.

This patch implements also such new algorithm, so we can deal not only
with 0 values, but managing fraction values properly.

No new tests, just some additional test cases and some of them rebaselined.

* rendering/RenderGrid.cpp:
(WebCore::normalizedFlexFraction):
(WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
(WebCore::RenderGrid::computeFlexFactorUnitSize): Added.
(WebCore::RenderGrid::findFlexFactorUnitSize): Added.
(WebCore::RenderGrid::GridTrackForNormalization): Deleted.
(WebCore::RenderGrid::computeNormalizedFractionBreadth): Deleted.
* rendering/RenderGrid.h:

LayoutTests:

Allow 0 as flex factor value and implement the new flex track sizing algorithm.

* fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html: Updated some cases.
* fast/css-grid-layout/flex-content-resolution-columns-expected.txt:
* fast/css-grid-layout/flex-content-resolution-columns.html: Added some new cases.
* fast/css-grid-layout/flex-content-resolution-rows-expected.txt:
* fast/css-grid-layout/flex-content-resolution-rows.html: Added some new cases.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190308 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/flex-and-minmax-content-resolution-rows.html
LayoutTests/fast/css-grid-layout/flex-content-resolution-columns-expected.txt
LayoutTests/fast/css-grid-layout/flex-content-resolution-columns.html
LayoutTests/fast/css-grid-layout/flex-content-resolution-rows-expected.txt
LayoutTests/fast/css-grid-layout/flex-content-resolution-rows.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderGrid.h