12012-11-30 Julien Chaffraix <jchaffraix@webkit.org>
2
3 [CSS Grid Layout] Implement CSS parsing and handling for <track-minmax>
4 https://bugs.webkit.org/show_bug.cgi?id=103799
5
6 Reviewed by NOBODY (OOPS!).
7
8 This change adds support for:
9 <track-minmax> => minmax( <track-breadth> , <track-breadth> ) | auto | <track-breadth>
10 (note that we already supported auto | <track-breadth>).
11
12 The change is mostly mechanical, the only newness is that GridTrackSize was updated to
13 hold 2 Lengths internally and we map the single Length case to 2 by duplicating the value
14 as this matches the rendering algorithm in the spec.
15
16 Tests: fast/css-grid-layout/grid-columns-rows-get-set-multiple.html
17 fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js
18
19 * css/CSSComputedStyleDeclaration.cpp:
20 (WebCore::valueForGridTrackBreadth):
21 Changed the function to do the conversion of one track breadth (one Length).
22 This was forgotten in the preparatory change in bug 103703.
23
24 (WebCore::valueForGridTrackMinMax):
25 Convert the value back using valueForGridTrackBreadth.
26
27 * css/CSSFunctionValue.cpp:
28 (WebCore::CSSFunctionValue::CSSFunctionValue):
29 * css/CSSFunctionValue.h:
30 (WebCore::CSSFunctionValue::create):
31 (CSSFunctionValue):
32 Added a new constructor. This enables us to return minmax(..., ...) when queried
33 from JavaScript. I couldn't find a better way to serialize inside CSSComputedStyleDeclaration
34 so that it properly match the function output.
35
36 * css/CSSParser.cpp:
37 (WebCore::CSSParser::parseGridTrackMinMax):
38 Added parsing for the new syntax. We convert the 2 values into a Pair if we manage to
39 parse both values correctly.
40
41 * css/StyleResolver.cpp:
42 (WebCore::createGridTrackMinMax):
43 Updated to handle a Pair - for minmax - and set the 2 values on GridTrackSize.
44
45 * rendering/RenderGrid.cpp:
46 (WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
47 Updated to check the style. For now, we don't handle minmax values.
48
49 * rendering/style/GridTrackSize.h:
50 (WebCore::GridTrackSize::GridTrackSize):
51 (WebCore::GridTrackSize::length):
52 (WebCore::GridTrackSize::setLength):
53 (WebCore::GridTrackSize::minTrackBreadth):
54 (WebCore::GridTrackSize::maxTrackBreadth):
55 (WebCore::GridTrackSize::setMinMax):
56 (WebCore::GridTrackSize::operator==):
57 Updated the class to handle minmax values. This means that we now always store
58 2 values (the <length> case being a subset of minmax, however we kept the distinction
59 to be able to reconstruct a <length> for getComputedStyle).
60