[CSS Grid Layout] Support grid-definition-{rows|columns} repeat() syntax
https://bugs.webkit.org/show_bug.cgi?id=103312

Reviewed by Andreas Kling.

PerformanceTests:

Use the repeat() syntax to build the huge grids used by the
performance tests.

* Layout/auto-grid-lots-of-data.html:
* Layout/fixed-grid-lots-of-data.html:

Source/WebCore:

Added support for the repeat() syntax inside
grid-definition-{rows|columns} by just adding the repeated values
to our list of column|row definitions.

The parsing of <track-name> was refactored in a new function as
it's used now in three different places. The <track-size> parsing
was also refactored to share it with the repeat() parsing.

Test: fast/css-grid-layout/grid-element-repeat-get-set.html

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseGridTrackNames):
(WebCore::CSSParser::parseGridTrackList):
(WebCore::CSSParser::parseGridTrackRepeatFunction):
(WebCore::CSSParser::parseGridTrackSize):
* css/CSSParser.h:

LayoutTests:

Based on Blink r153155 by <jchaffraix@chromium.org>. Some code was
refactored in a helper function to have a more compact test.

* fast/css-grid-layout/grid-element-repeat-get-set-expected.txt: Added.
* fast/css-grid-layout/grid-element-repeat-get-set.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSS Grid Layout] Fix positioning of grid items with margins
https://bugs.webkit.org/show_bug.cgi?id=124345

Reviewed by David Hyatt.

From Blink r157925 and r158041 by <jchaffraix@chromium.org>

Source/WebCore:

Test: fast/css-grid-layout/grid-item-margin-resolution.html

Adds margin start/before to the positions of grid items (removing
several FIXME's in the current code). This means calling
findChildLogicalPosition() after the layout in order to have the
right values for the margins.

In order to match flexbox and author's intents we're also
including the margins of grid items in the intrinsic size of the
grid. That's why flexbox's marginLogicalPositionForChild() is
moved up to RenderBlock in order to share it with RenderGrid.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::marginIntrinsicLogicalWidthForChild): Moved
from RenderFlexibleBox::marginLogicalWidthForChild().
* rendering/RenderBlock.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computePreferredTrackWidth):
(WebCore::RenderGrid::layoutGridItems):
(WebCore::RenderGrid::findChildLogicalPosition):

LayoutTests:

New test case for grid items margin resolution. Extended the
preferred logical widths checks with grid items with margins.

* fast/css-grid-layout/grid-item-margin-resolution-expected.txt: Added.
* fast/css-grid-layout/grid-item-margin-resolution.html: Added.
* fast/css-grid-layout/grid-preferred-logical-widths-expected.txt:
* fast/css-grid-layout/grid-preferred-logical-widths.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159809 268f45cc-cd09-0410-ab3c-d52691b4dbfc