[css-grid] Remove the x2 computation of row sizes with indefinite heights
authorsvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 07:57:32 +0000 (07:57 +0000)
committersvillar@igalia.com <svillar@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Sep 2016 07:57:32 +0000 (07:57 +0000)
commit4f45684947b2144f8701669f93222de8994dadf2
treea144df40afc79e807d0a6a065d25946c815a3630
parent7f3c0b333193232573defc28b562b15dee849363
[css-grid] Remove the x2 computation of row sizes with indefinite heights
https://bugs.webkit.org/show_bug.cgi?id=162150

Reviewed by Darin Adler.

PerformanceTests:

Added a new test case which checks the layout performance of grids inside other grids, i.e,
grids acting both as grid container and grid item.

* Layout/nested-grid.html: Added.

Source/WebCore:

On r192154, among other things, we added a second pass of the track sizing algorithm for
rows in order to properly compute row sizes when the height was indefinite. We did that in
order to have a symmetrical implementation for columns and rows, but unfortunatelly that was
not correct.

Apart from issuing incorrect results in some cases it created a huge performance issue in
the case of having nested grids because we were exponentially increasing the amount of
executions of the track sizing algorithm. The attached performance test shows a 200%
improvement with the patch (26 vs 80 runs/s).

Test: fast/css-grid-layout/nested-grid.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutBlock):
(WebCore::RenderGrid::computeIntrinsicLogicalHeight):
(WebCore::RenderGrid::layoutGridItems):

LayoutTests:

Added a new reftest to check the behavior of grids acting also as grid items and how the
track sizing of rows depend on that. It includes tests for grids which stretch their
children and grids which do not.

Apart from that some expected results were updated so that they no longer fail.

* fast/css-grid-layout/maximize-tracks-definite-indefinite-height.html: Updated expectations.
* fast/css-grid-layout/nested-grid-expected.html: Added.
* fast/css-grid-layout/nested-grid.html: Added.
* fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: Removed FIXME.
* fast/css-grid-layout/percent-track-breadths-regarding-container-size-expected.txt: Fixed 2
failing tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/css-grid-layout/maximize-tracks-definite-indefinite-height.html
LayoutTests/fast/css-grid-layout/nested-grid-expected.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/nested-grid.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/percent-track-breadths-regarding-container-size-expected.txt
LayoutTests/fast/css-grid-layout/percent-track-breadths-regarding-container-size.html
PerformanceTests/ChangeLog
PerformanceTests/Layout/nested-grid.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderGrid.cpp