Chromium Code Reviews| Index: Source/core/css/resolver/StyleBuilderCustom.cpp |
| diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp |
| index d859c5ef4b42b8ecc27482eac5f08725642f02ec..a70e7be3d856b20d92b6d55aee21780e5d93809c 100644 |
| --- a/Source/core/css/resolver/StyleBuilderCustom.cpp |
| +++ b/Source/core/css/resolver/StyleBuilderCustom.cpp |
| @@ -1049,6 +1049,22 @@ if (isInitial) { \ |
| return; \ |
| } |
| +static void createImplicitNamedGridLinesFromGridArea(const NamedGridAreaMap& namedGridAreas, NamedGridLinesMap& namedGridLines, GridTrackSizingDirection direction) |
| +{ |
| + NamedGridAreaMap::const_iterator end = namedGridAreas.end(); |
| + for (NamedGridAreaMap::const_iterator it = namedGridAreas.begin(); it != end; ++it) { |
| + GridSpan areaSpan = direction == ForRows ? it->value.rows : it->value.columns; |
| + |
| + NamedGridLinesMap::AddResult startResult = namedGridLines.add(it->key + "-start", Vector<size_t>()); |
| + startResult.storedValue->value.append(areaSpan.resolvedInitialPosition.toInt()); |
| + std::sort(startResult.storedValue->value.begin(), startResult.storedValue->value.end()); |
| + |
| + NamedGridLinesMap::AddResult endResult = namedGridLines.add(it->key + "-end", Vector<size_t>()); |
| + endResult.storedValue->value.append(areaSpan.resolvedFinalPosition.toInt() + 1); |
| + std::sort(endResult.storedValue->value.begin(), endResult.storedValue->value.end()); |
| + } |
| +} |
| + |
| static GridLength createGridTrackBreadth(CSSPrimitiveValue* primitiveValue, const StyleResolverState& state) |
| { |
| if (primitiveValue->getValueID() == CSSValueMinContent) |
| @@ -1738,6 +1754,11 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state, |
| OrderedNamedGridLines orderedNamedGridLines; |
| if (!createGridTrackList(value, trackSizes, namedGridLines, orderedNamedGridLines, state)) |
| return; |
| + |
| + const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); |
| + if (!namedGridAreas.isEmpty()) |
| + createImplicitNamedGridLinesFromGridArea(namedGridAreas, namedGridLines, ForColumns); |
| + |
| state.style()->setGridTemplateColumns(trackSizes); |
| state.style()->setNamedGridColumnLines(namedGridLines); |
| state.style()->setOrderedNamedGridColumnLines(orderedNamedGridLines); |
| @@ -1762,6 +1783,11 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state, |
| OrderedNamedGridLines orderedNamedGridLines; |
| if (!createGridTrackList(value, trackSizes, namedGridLines, orderedNamedGridLines, state)) |
| return; |
| + |
| + const NamedGridAreaMap& namedGridAreas = state.style()->namedGridArea(); |
| + if (!namedGridAreas.isEmpty()) |
| + createImplicitNamedGridLinesFromGridArea(namedGridAreas, namedGridLines, ForRows); |
| + |
| state.style()->setGridTemplateRows(trackSizes); |
| state.style()->setNamedGridRowLines(namedGridLines); |
| state.style()->setOrderedNamedGridRowLines(orderedNamedGridLines); |
| @@ -1822,7 +1848,16 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state, |
| } |
| CSSGridTemplateAreasValue* gridTemplateAreasValue = toCSSGridTemplateAreasValue(value); |
| - state.style()->setNamedGridArea(gridTemplateAreasValue->gridAreaMap()); |
| + const NamedGridAreaMap& newNamedGridAreas = gridTemplateAreasValue->gridAreaMap(); |
| + |
| + NamedGridLinesMap namedGridColumnLines = state.style()->namedGridColumnLines(); |
| + NamedGridLinesMap namedGridRowLines = state.style()->namedGridRowLines(); |
|
Julien - ping for review
2014/05/09 17:37:54
If you used NamedGridLinesMap& for both lines abov
svillar
2014/05/12 10:36:03
Hmm but the style returns a constant reference so
|
| + createImplicitNamedGridLinesFromGridArea(newNamedGridAreas, namedGridColumnLines, ForColumns); |
| + createImplicitNamedGridLinesFromGridArea(newNamedGridAreas, namedGridRowLines, ForRows); |
| + state.style()->setNamedGridColumnLines(namedGridColumnLines); |
| + state.style()->setNamedGridRowLines(namedGridRowLines); |
| + |
| + state.style()->setNamedGridArea(newNamedGridAreas); |
| state.style()->setNamedGridAreaRowCount(gridTemplateAreasValue->rowCount()); |
| state.style()->setNamedGridAreaColumnCount(gridTemplateAreasValue->columnCount()); |
| return; |