Index: Source/core/css/StyleResolver.cpp |
diff --git a/Source/core/css/StyleResolver.cpp b/Source/core/css/StyleResolver.cpp |
index bbde3de53a3bbe8b92442ca9f3c46fffa3d97d26..e05b4f32d15d97d50c7c41993c380bb407364083 100644 |
--- a/Source/core/css/StyleResolver.cpp |
+++ b/Source/core/css/StyleResolver.cpp |
@@ -2239,7 +2239,7 @@ static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const |
return true; |
} |
-static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, const StyleResolverState& state) |
+static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, NamedGridLinesMap& namedGridLines, const StyleResolverState& state) |
{ |
// Handle 'none'. |
if (value->isPrimitiveValue()) { |
@@ -2250,14 +2250,29 @@ static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz |
if (!value->isValueList()) |
return false; |
+ size_t currentNamedGridLine = 0; |
for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
CSSValue* currValue = i.value(); |
+ if (currValue->isPrimitiveValue()) { |
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(currValue); |
+ if (primitiveValue->isString()) { |
+ NamedGridLinesMap::AddResult result = namedGridLines.add(primitiveValue->getStringValue(), Vector<size_t>()); |
+ result.iterator->value.append(currentNamedGridLine); |
+ continue; |
+ } |
+ } |
+ |
+ ++currentNamedGridLine; |
GridTrackSize trackSize; |
if (!createGridTrackSize(currValue, trackSize, state)) |
return false; |
trackSizes.append(trackSize); |
} |
+ |
+ if (trackSizes.isEmpty()) |
+ return false; |
+ |
return true; |
} |
@@ -2921,16 +2936,20 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) |
} |
case CSSPropertyWebkitGridColumns: { |
Vector<GridTrackSize> trackSizes; |
- if (!createGridTrackList(value, trackSizes, state)) |
+ NamedGridLinesMap namedGridLines; |
+ if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
return; |
state.style()->setGridColumns(trackSizes); |
+ state.style()->setNamedGridColumnLines(namedGridLines); |
return; |
} |
case CSSPropertyWebkitGridRows: { |
Vector<GridTrackSize> trackSizes; |
- if (!createGridTrackList(value, trackSizes, state)) |
+ NamedGridLinesMap namedGridLines; |
+ if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
return; |
state.style()->setGridRows(trackSizes); |
+ state.style()->setNamedGridRowLines(namedGridLines); |
return; |
} |