Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: Source/core/css/StyleResolver.cpp

Issue 14786002: Allow defining named grid lines on the grid element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/StyleResolver.cpp
diff --git a/Source/core/css/StyleResolver.cpp b/Source/core/css/StyleResolver.cpp
index 7a02f2f3b8f3ade7958df85243fb563f32c06318..844bfe05bfeb9864c9123d78c6a2263e4760a54a 100644
--- a/Source/core/css/StyleResolver.cpp
+++ b/Source/core/css/StyleResolver.cpp
@@ -2306,7 +2306,7 @@ static bool createGridTrackSize(CSSValue* value, GridTrackSize& trackSize, const
return true;
}
-static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, const StyleResolver::State& state)
+static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSizes, NamedGridLinesMapping& namedGridLines, const StyleResolver::State& state)
{
// Handle 'none'.
if (value->isPrimitiveValue()) {
@@ -2317,8 +2317,19 @@ 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()) {
+ NamedGridLinesMapping::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;
@@ -2992,16 +3003,20 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
}
case CSSPropertyWebkitGridColumns: {
Vector<GridTrackSize> trackSizes;
- if (!createGridTrackList(value, trackSizes, state))
+ NamedGridLinesMapping 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))
+ NamedGridLinesMapping namedGridLines;
+ if (!createGridTrackList(value, trackSizes, namedGridLines, state))
return;
state.style()->setGridRows(trackSizes);
+ state.style()->setNamedGridRowLines(namedGridLines);
return;
}

Powered by Google App Engine
This is Rietveld 408576698