Title: [136150] trunk/Source/WebCore
Revision
136150
Author
jchaffr...@webkit.org
Date
2012-11-29 12:26:29 -0800 (Thu, 29 Nov 2012)

Log Message

[CSS Grid Layout] track sizing functions should have their own type
https://bugs.webkit.org/show_bug.cgi?id=103343

Reviewed by Tony Chang.

The current code uses a Length to represent the track sizing function. This is
fine as we only parse <length> | <percentage> but in order to support minmax
sizing, we have to store 2 Lengths. We could go with a pair but that would make
the code not very readable so this change introduces GridTrackSize.

Refactoring, covered by existing tests.

* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
Added GridTrackSize.h to all our build systems.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::valueForGridTrackBreadth):
(WebCore::valueForGridTrackList):
* css/StyleResolver.cpp:
(WebCore::createGridTrackBreadth):
(WebCore::createGridTrackList):
(WebCore::StyleResolver::applyProperty):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computePreferredLogicalWidths):
(WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
* rendering/style/RenderStyle.h:
Updated the above call sites to use GridTrackSize. While
touching them, changed the code to use an empty Vector to represent
'none' instead of Length(Undefined).

* rendering/style/StyleGridData.h:
Updated #include, removed a comment as it would have gone stale after
adding more grammar support and added a FIXME to rename some variables.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::layoutGridItems):
Implemented a work-around to avoid crashing due to implicit columns / rows.

* rendering/style/GridTrackSize.h: Added.
(WebCore::GridTrackSize::GridTrackSize):
(WebCore::GridTrackSize::length):
(WebCore::GridTrackSize::setLength):
(WebCore::GridTrackSize::type):
(WebCore::GridTrackSize::operator==):
New class, it now only wraps a single Length.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136149 => 136150)


--- trunk/Source/WebCore/ChangeLog	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 20:26:29 UTC (rev 136150)
@@ -1,3 +1,55 @@
+2012-11-29  Julien Chaffraix  <jchaffr...@webkit.org>
+
+        [CSS Grid Layout] track sizing functions should have their own type
+        https://bugs.webkit.org/show_bug.cgi?id=103343
+
+        Reviewed by Tony Chang.
+
+        The current code uses a Length to represent the track sizing function. This is
+        fine as we only parse <length> | <percentage> but in order to support minmax
+        sizing, we have to store 2 Lengths. We could go with a pair but that would make
+        the code not very readable so this change introduces GridTrackSize.
+
+        Refactoring, covered by existing tests.
+
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        Added GridTrackSize.h to all our build systems.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForGridTrackBreadth):
+        (WebCore::valueForGridTrackList):
+        * css/StyleResolver.cpp:
+        (WebCore::createGridTrackBreadth):
+        (WebCore::createGridTrackList):
+        (WebCore::StyleResolver::applyProperty):
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computePreferredLogicalWidths):
+        (WebCore::RenderGrid::computedUsedBreadthOfGridTracks):
+        * rendering/style/RenderStyle.h:
+        Updated the above call sites to use GridTrackSize. While
+        touching them, changed the code to use an empty Vector to represent
+        'none' instead of Length(Undefined).
+
+        * rendering/style/StyleGridData.h:
+        Updated #include, removed a comment as it would have gone stale after
+        adding more grammar support and added a FIXME to rename some variables.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::layoutGridItems):
+        Implemented a work-around to avoid crashing due to implicit columns / rows.
+
+        * rendering/style/GridTrackSize.h: Added.
+        (WebCore::GridTrackSize::GridTrackSize):
+        (WebCore::GridTrackSize::length):
+        (WebCore::GridTrackSize::setLength):
+        (WebCore::GridTrackSize::type):
+        (WebCore::GridTrackSize::operator==):
+        New class, it now only wraps a single Length.
+
 2012-11-29  Helder Correia  <helder.corr...@nokia.com>
 
         Typo in Color creation function name

Modified: trunk/Source/WebCore/GNUmakefile.list.am (136149 => 136150)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-11-29 20:26:29 UTC (rev 136150)
@@ -4504,6 +4504,7 @@
 	Source/WebCore/rendering/style/StyleVariableData.h \
 	Source/WebCore/rendering/style/StyleVisualData.cpp \
 	Source/WebCore/rendering/style/StyleVisualData.h \
+	Source/WebCore/rendering/style/GridTrackSize.h \
 	Source/WebCore/rendering/TableLayout.h \
 	Source/WebCore/rendering/TrailingFloatsRootInlineBox.h \
 	Source/WebCore/storage/StorageTask.cpp \

Modified: trunk/Source/WebCore/Target.pri (136149 => 136150)


--- trunk/Source/WebCore/Target.pri	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/Target.pri	2012-11-29 20:26:29 UTC (rev 136150)
@@ -2476,6 +2476,7 @@
     rendering/style/StyleTransformData.h \
     rendering/style/StyleVariableData.h \
     rendering/style/StyleVisualData.h \
+    rendering/style/GridTrackSize.h \
     rendering/style/SVGRenderStyleDefs.h \
     rendering/style/SVGRenderStyle.h \
     rendering/svg/RenderSVGBlock.h \

Modified: trunk/Source/WebCore/WebCore.gypi (136149 => 136150)


--- trunk/Source/WebCore/WebCore.gypi	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/WebCore.gypi	2012-11-29 20:26:29 UTC (rev 136150)
@@ -628,6 +628,7 @@
             'rendering/style/StyleTransformData.h',
             'rendering/style/StyleVariableData.h',
             'rendering/style/StyleVisualData.h',
+            'rendering/style/GridTrackSizes.h',
             'rendering/svg/SVGResourcesCache.h',
             'workers/SharedWorkerStrategy.h',
             'workers/WorkerRunLoop.h',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (136149 => 136150)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-11-29 20:26:29 UTC (rev 136150)
@@ -46851,6 +46851,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\rendering\style\GridTrackSize.h"
+					>
+				</File>
+				<File
 					RelativePath="..\rendering\style\SVGRenderStyle.cpp"
 					>
 					<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (136149 => 136150)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-11-29 20:26:29 UTC (rev 136150)
@@ -3821,6 +3821,7 @@
 		A120ACA413F998CA00FE4AC7 /* LayoutRepainter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */; };
 		A12538D413F9B60A00024754 /* LayoutRepainter.h in Headers */ = {isa = PBXBuildFile; fileRef = A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A12705C31656BD6500C2E27C /* GridPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = A12705C21656BD6500C2E27C /* GridPosition.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */ = {isa = PBXBuildFile; fileRef = A12A104E166444DC008FA311 /* GridTrackSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A136A00C1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */; };
 		A136A00D1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h in Headers */ = {isa = PBXBuildFile; fileRef = A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */; };
 		A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
@@ -11136,6 +11137,7 @@
 		A120ACA013F9983700FE4AC7 /* LayoutRepainter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutRepainter.h; sourceTree = "<group>"; };
 		A120ACA113F9984600FE4AC7 /* LayoutRepainter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutRepainter.cpp; sourceTree = "<group>"; };
 		A12705C21656BD6500C2E27C /* GridPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridPosition.h; path = style/GridPosition.h; sourceTree = "<group>"; };
+		A12A104E166444DC008FA311 /* GridTrackSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GridTrackSize.h; path = style/GridTrackSize.h; sourceTree = "<group>"; };
 		A136A00A1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLHttpRequestProgressEventThrottle.cpp; sourceTree = "<group>"; };
 		A136A00B1134DBD200CC8D50 /* XMLHttpRequestProgressEventThrottle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEventThrottle.h; sourceTree = "<group>"; };
 		A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
@@ -20742,6 +20744,7 @@
 				BC2274750E8366E200E7F975 /* SVGRenderStyle.h */,
 				BC2274760E8366E200E7F975 /* SVGRenderStyleDefs.cpp */,
 				BC2274770E8366E200E7F975 /* SVGRenderStyleDefs.h */,
+				A12A104E166444DC008FA311 /* GridTrackSize.h */,
 			);
 			name = style;
 			sourceTree = "<group>";
@@ -25604,6 +25607,7 @@
 				E44613B00CD6331000FADA75 /* TimeRanges.h in Headers */,
 				49E912AE0EFAC906009D0CAF /* TimingFunction.h in Headers */,
 				070334D71459FFD5008D8D45 /* TrackBase.h in Headers */,
+				A12A1050166444FD008FA311 /* GridTrackSize.h in Headers */,
 				49E911C40EF86D47009D0CAF /* TransformationMatrix.h in Headers */,
 				49E911CE0EF86D47009D0CAF /* TransformOperation.h in Headers */,
 				49E911D00EF86D47009D0CAF /* TransformOperations.h in Headers */,

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (136149 => 136150)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-11-29 20:26:29 UTC (rev 136150)
@@ -983,27 +983,24 @@
 }
 #endif
 
-static PassRefPtr<CSSValue> valueForGridTrackBreadth(const Length& trackLength, const RenderStyle* style)
+static PassRefPtr<CSSValue> valueForGridTrackBreadth(const GridTrackSize& trackSize, const RenderStyle* style)
 {
-    if (trackLength.isPercent())
-        return cssValuePool().createValue(trackLength);
-    if (trackLength.isAuto())
+    if (trackSize.length().isPercent())
+        return cssValuePool().createValue(trackSize.length());
+    if (trackSize.length().isAuto())
         return cssValuePool().createIdentifierValue(CSSValueAuto);
-    return zoomAdjustedPixelValue(trackLength.value(), style);
+    return zoomAdjustedPixelValue(trackSize.length().value(), style);
 }
 
-static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<Length>& trackLengths, const RenderStyle* style)
+static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style)
 {
-    // We should have at least an element!
-    ASSERT(trackLengths.size());
-
     // Handle the 'none' case here.
-    if (trackLengths.size() == 1 && trackLengths[0].isUndefined())
+    if (!trackSizes.size())
         return cssValuePool().createIdentifierValue(CSSValueNone);
 
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-    for (size_t i = 0; i < trackLengths.size(); ++i)
-        list->append(valueForGridTrackBreadth(trackLengths[i], style));
+    for (size_t i = 0; i < trackSizes.size(); ++i)
+        list->append(valueForGridTrackBreadth(trackSizes[i], style));
     return list.release();
 }
 

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (136149 => 136150)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 20:26:29 UTC (rev 136150)
@@ -2659,7 +2659,7 @@
     return m_element && m_element->isSVGElement();
 }
 
-static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, Length& length)
+static bool createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, StyleResolver* selector, GridTrackSize& trackSize)
 {
     Length workingLength = primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | ViewportPercentageConversion | AutoConversion>(selector->style(), selector->rootElementStyle(), selector->style()->effectiveZoom());
     if (workingLength.isUndefined())
@@ -2668,20 +2668,16 @@
     if (primitiveValue->isLength())
         workingLength.setQuirk(primitiveValue->isQuirkValue());
 
-    length = workingLength;
+    trackSize.setLength(workingLength);
     return true;
 }
 
-static bool createGridTrackList(CSSValue* value, Vector<Length>& lengths, StyleResolver* selector)
+static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, StyleResolver* selector)
 {
     // Handle 'none'.
     if (value->isPrimitiveValue()) {
         CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
-        if (primitiveValue->getIdent() == CSSValueNone) {
-            lengths.append(Length(Undefined));
-            return true;
-        }
-        return false;
+        return primitiveValue->getIdent() == CSSValueNone;
     }
 
     if (value->isValueList()) {
@@ -2690,11 +2686,11 @@
             if (!currValue->isPrimitiveValue())
                 return false;
 
-            Length length;
-            if (!createGridTrackBreadth(static_cast<CSSPrimitiveValue*>(currValue), selector, length))
+            GridTrackSize trackSize;
+            if (!createGridTrackBreadth(static_cast<CSSPrimitiveValue*>(currValue), selector, trackSize))
                 return false;
 
-            lengths.append(length);
+            trackSizes.append(trackSize);
         }
         return true;
     }
@@ -3544,17 +3540,17 @@
     }
 #endif
     case CSSPropertyWebkitGridColumns: {
-        Vector<Length> lengths;
-        if (!createGridTrackList(value, lengths, this))
+        Vector<GridTrackSize> trackSizes;
+        if (!createGridTrackList(value, trackSizes, this))
             return;
-        m_style->setGridColumns(lengths);
+        m_style->setGridColumns(trackSizes);
         return;
     }
     case CSSPropertyWebkitGridRows: {
-        Vector<Length> lengths;
-        if (!createGridTrackList(value, lengths, this))
+        Vector<GridTrackSize> trackSizes;
+        if (!createGridTrackList(value, trackSizes, this))
             return;
-        m_style->setGridRows(lengths);
+        m_style->setGridRows(trackSizes);
         return;
     }
 

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (136149 => 136150)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2012-11-29 20:26:29 UTC (rev 136150)
@@ -116,10 +116,10 @@
 
     // FIXME: We don't take our own logical width into account.
 
-    const Vector<Length>& trackStyles = style()->gridColumns();
+    const Vector<GridTrackSize>& trackStyles = style()->gridColumns();
 
     for (size_t i = 0; i < trackStyles.size(); ++i) {
-        Length trackLength = trackStyles[i];
+        Length trackLength = trackStyles[i].length();
         if (!trackLength.isFixed()) {
             notImplemented();
             continue;
@@ -138,11 +138,11 @@
 
 void RenderGrid::computedUsedBreadthOfGridTracks(TrackSizingDirection direction, Vector<GridTrack>& tracks)
 {
-    const Vector<Length>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
+    const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style()->gridColumns() : style()->gridRows();
     for (size_t i = 0; i < trackStyles.size(); ++i) {
         GridTrack track;
-        if (trackStyles[i].isFixed())
-            track.m_usedBreadth = trackStyles[i].getFloatValue();
+        if (trackStyles[i].length().isFixed())
+            track.m_usedBreadth = trackStyles[i].length().getFloatValue();
         else
             notImplemented();
 
@@ -165,10 +165,13 @@
         size_t columnTrack = resolveGridPosition(child->style()->gridItemColumn());
         size_t rowTrack = resolveGridPosition(child->style()->gridItemRow());
 
-        // Because the grid area cannot be styled, we don't need to adjust
-        // the grid breadth to account for 'box-sizing'.
-        child->setOverrideContainingBlockContentLogicalWidth(columnTracks[columnTrack].m_usedBreadth);
-        child->setOverrideContainingBlockContentLogicalHeight(rowTracks[rowTrack].m_usedBreadth);
+        // FIXME: Properly support implicit rows and columns (bug 103573).
+        if (columnTrack < columnTracks.size() && rowTrack < rowTracks.size()) {
+            // Because the grid area cannot be styled, we don't need to adjust
+            // the grid breadth to account for 'box-sizing'.
+            child->setOverrideContainingBlockContentLogicalWidth(columnTracks[columnTrack].m_usedBreadth);
+            child->setOverrideContainingBlockContentLogicalHeight(rowTracks[rowTrack].m_usedBreadth);
+        }
 
         // FIXME: Grid items should stretch to fill their cells. Once we
         // implement grid-{column,row}-align, we can also shrink to fit. For

Added: trunk/Source/WebCore/rendering/style/GridTrackSize.h (0 => 136150)


--- trunk/Source/WebCore/rendering/style/GridTrackSize.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/style/GridTrackSize.h	2012-11-29 20:26:29 UTC (rev 136150)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GridTrackSize_h
+#define GridTrackSize_h
+
+#include "Length.h"
+
+namespace WebCore {
+
+enum GridTrackSizeType {
+    LengthTrackSizing
+};
+
+class GridTrackSize {
+public:
+    GridTrackSize()
+        : m_type(LengthTrackSizing)
+        , m_length(Undefined)
+    {
+    }
+
+    const Length& length() const
+    {
+        ASSERT(m_type == LengthTrackSizing);
+        ASSERT(!m_length.isUndefined());
+        return m_length;
+    }
+
+    void setLength(const Length& length)
+    {
+        m_type = LengthTrackSizing;
+        m_length = length;
+    }
+
+    GridTrackSizeType type() const { return m_type; }
+
+    bool operator==(const GridTrackSize& other) const
+    {
+        return m_type == other.m_type && m_length == other.m_length;
+    }
+
+private:
+    GridTrackSizeType m_type;
+    Length m_length;
+};
+
+} // namespace WebCore
+
+#endif // GridTrackSize_h

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (136149 => 136150)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-11-29 20:26:29 UTC (rev 136150)
@@ -758,8 +758,8 @@
     EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
     EJustifyContent justifyContent() const { return static_cast<EJustifyContent>(rareNonInheritedData->m_justifyContent); }
 
-    const Vector<Length>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
-    const Vector<Length>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
+    const Vector<GridTrackSize>& gridColumns() const { return rareNonInheritedData->m_grid->m_gridColumns; }
+    const Vector<GridTrackSize>& gridRows() const { return rareNonInheritedData->m_grid->m_gridRows; }
 
     const GridPosition& gridItemColumn() const { return rareNonInheritedData->m_gridItem->m_gridColumn; }
     const GridPosition& gridItemRow() const { return rareNonInheritedData->m_gridItem->m_gridRow; }
@@ -1240,8 +1240,8 @@
     void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
     void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
     void setJustifyContent(EJustifyContent p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
-    void setGridColumns(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
-    void setGridRows(const Vector<Length>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); }
+    void setGridColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridColumns, lengths); }
+    void setGridRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridRows, lengths); }
     void setGridItemColumn(const GridPosition& columnPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumn, columnPosition); }
     void setGridItemRow(const GridPosition& rowPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRow, rowPosition); }
 
@@ -1632,16 +1632,8 @@
     static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
 
     // The initial value is 'none' for grid tracks.
-    static Vector<Length> initialGridTrackValue()
-    {
-        DEFINE_STATIC_LOCAL(Vector<Length>, defaultLength, ());
-        // We need to manually add the Length here as the Length(0) is 'auto'.
-        if (!defaultLength.size())
-            defaultLength.append(Length(Undefined));
-        return defaultLength;
-    }
-    static Vector<Length> initialGridColumns() { return initialGridTrackValue(); }
-    static Vector<Length> initialGridRows() { return initialGridTrackValue(); }
+    static Vector<GridTrackSize> initialGridColumns() { return Vector<GridTrackSize>(); }
+    static Vector<GridTrackSize> initialGridRows() { return Vector<GridTrackSize>(); }
 
     // 'auto' is the default.
     static GridPosition initialGridItemColumn() { return GridPosition(); }

Modified: trunk/Source/WebCore/rendering/style/StyleGridData.h (136149 => 136150)


--- trunk/Source/WebCore/rendering/style/StyleGridData.h	2012-11-29 20:23:57 UTC (rev 136149)
+++ trunk/Source/WebCore/rendering/style/StyleGridData.h	2012-11-29 20:26:29 UTC (rev 136150)
@@ -26,7 +26,7 @@
 #ifndef StyleGridData_h
 #define StyleGridData_h
 
-#include "Length.h"
+#include "GridTrackSize.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
@@ -48,10 +48,9 @@
         return !(*this == o);
     }
 
-    // FIXME: For the moment, we only support a subset of the grammar which correspond to:
-    // 'auto' | <length> | <percentage> | 'none'
-    Vector<Length> m_gridColumns;
-    Vector<Length> m_gridRows;
+    // FIXME: Update the naming of the following variables.
+    Vector<GridTrackSize> m_gridColumns;
+    Vector<GridTrackSize> m_gridRows;
 
 private:
     StyleGridData();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to