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

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: Rebaselined patch for try job / landing Created 7 years, 7 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
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | Source/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « Source/core/css/CSSParser.cpp ('k') | Source/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698