Chromium Code Reviews| Index: Source/core/css/CSSComputedStyleDeclaration.cpp |
| diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp |
| index 3fbd395ee8a7f9e450c1ca6ea67d86980fc8eb6d..17eae6a8e40366f04efc9cbcd3608ab0c1d52294 100644 |
| --- a/Source/core/css/CSSComputedStyleDeclaration.cpp |
| +++ b/Source/core/css/CSSComputedStyleDeclaration.cpp |
| @@ -1035,15 +1035,37 @@ static PassRefPtr<CSSValue> valueForGridTrackSize(const GridTrackSize& trackSize |
| return 0; |
| } |
| -static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const RenderStyle* style, RenderView *renderView) |
| +static void addValuesForNamedGridLinesAtIndex(const NamedGridLinesMapping& namedGridLines, size_t i, CSSValueList& list) |
| +{ |
| + // Note that this won't return the results in the order specified in the style sheet, |
| + // which is probably fine as we stil *do* return all the expected values. |
| + NamedGridLinesMapping::const_iterator it = namedGridLines.begin(); |
| + NamedGridLinesMapping::const_iterator end = namedGridLines.end(); |
| + for (; it != end; ++it) { |
| + Vector<size_t> linesIndexes = it->value; |
|
esprehn
2013/05/03 21:45:58
const Vector<size_t>& ? I don't think you want to
Julien - ping for review
2013/05/06 16:22:33
Good catch (though we don't do a deep copy as Vect
|
| + for (size_t j = 0; j < linesIndexes.size(); ++j) { |
| + if (linesIndexes[j] != i) |
| + continue; |
| + |
| + list.append(cssValuePool().createValue(it->key, CSSPrimitiveValue::CSS_STRING)); |
| + break; |
| + } |
| + } |
| +} |
| + |
| +static PassRefPtr<CSSValue> valueForGridTrackList(const Vector<GridTrackSize>& trackSizes, const NamedGridLinesMapping& namedGridLines, const RenderStyle* style, RenderView* renderView) |
| { |
| // Handle the 'none' case here. |
| if (!trackSizes.size()) |
| return cssValuePool().createIdentifierValue(CSSValueNone); |
| RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); |
| - for (size_t i = 0; i < trackSizes.size(); ++i) |
| + for (size_t i = 0; i < trackSizes.size(); ++i) { |
| + addValuesForNamedGridLinesAtIndex(namedGridLines, i, *list); |
| list->append(valueForGridTrackSize(trackSizes[i], style, renderView)); |
| + } |
| + // Those are the trailing <string>* allowed in the syntax. |
| + addValuesForNamedGridLinesAtIndex(namedGridLines, trackSizes.size(), *list); |
| return list.release(); |
| } |
| @@ -1916,9 +1938,9 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert |
| case CSSPropertyWebkitGridAutoRows: |
| return valueForGridTrackSize(style->gridAutoRows(), style.get(), m_node->document()->renderView()); |
| case CSSPropertyWebkitGridColumns: |
| - return valueForGridTrackList(style->gridColumns(), style.get(), m_node->document()->renderView()); |
| + return valueForGridTrackList(style->gridColumns(), style->namedGridColumnLines(), style.get(), m_node->document()->renderView()); |
| case CSSPropertyWebkitGridRows: |
| - return valueForGridTrackList(style->gridRows(), style.get(), m_node->document()->renderView()); |
| + return valueForGridTrackList(style->gridRows(), style->namedGridRowLines(), style.get(), m_node->document()->renderView()); |
| case CSSPropertyWebkitGridStart: |
| return valueForGridPosition(style->gridStart()); |