[css-grid] Isolate instrinsic size computation from layout
https://bugs.webkit.org/show_bug.cgi?id=166530

Reviewed by Darin Adler.

Source/WebCore:

This is the last patch of the items placement data refactoring. By using a different Grid
instance in computeIntrinsicLogicalWidths we effectively isolate the intrinsic size
computation from the layout. They are now using different data structures so they don't
interfere each other.

This also means that we no longer reuse the placement of items done in the intrinsic size
computation. That shouldn't be a big issue once we make m_grid persistent on RenderGrid.

Last but not least, this patch finally removes the ugly const_cast's we had in
computeIntrinsicLogicalWidths() as we no longer modify the internal state of RenderGrid.

Tests: fast/css-grid-layout/grid-auto-repeat-intrinsic.html
       fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use a new instance of Grid.
(WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): Fixed a missing m_grid -> grid
rename.
(WebCore::RenderGrid::placeItemsOnGrid): Constify it. It nows repositions the items if the
number of auto repeat tracks has changed.
* rendering/RenderGrid.h:

LayoutTests:

* fast/css-grid-layout/grid-auto-repeat-intrinsic-expected.txt: Added.
* fast/css-grid-layout/grid-auto-repeat-intrinsic.html: Added.
* fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt: Added.
* fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@210211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt b/LayoutTests/fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt
new file mode 100644
index 0000000..fbba5d0
--- /dev/null
+++ b/LayoutTests/fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks-expected.txt
@@ -0,0 +1,9 @@
+This test checks that changing the min|max-content contributions of grid items properly recomputes both track sizes and grid positions in grids with auto repeat tracks.
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS
+PASS