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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 1829723002: Move grid-template-areas into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSPropertyParser.h" 5 #include "core/css/parser/CSSPropertyParser.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h" 8 #include "core/css/CSSBasicShapeValues.h"
9 #include "core/css/CSSBorderImage.h" 9 #include "core/css/CSSBorderImage.h"
10 #include "core/css/CSSContentDistributionValue.h" 10 #include "core/css/CSSContentDistributionValue.h"
(...skipping 3200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3211 return values.release(); 3211 return values.release();
3212 } 3212 }
3213 3213
3214 static PassRefPtrWillBeRawPtr<CSSValue> consumeGridTemplatesRowsOrColumns(CSSPar serTokenRange& range, CSSParserMode cssParserMode) 3214 static PassRefPtrWillBeRawPtr<CSSValue> consumeGridTemplatesRowsOrColumns(CSSPar serTokenRange& range, CSSParserMode cssParserMode)
3215 { 3215 {
3216 if (range.peek().id() == CSSValueNone) 3216 if (range.peek().id() == CSSValueNone)
3217 return consumeIdent(range); 3217 return consumeIdent(range);
3218 return consumeGridTrackList(range, cssParserMode); 3218 return consumeGridTrackList(range, cssParserMode);
3219 } 3219 }
3220 3220
3221 static PassRefPtrWillBeRawPtr<CSSValue> consumeGridTemplateAreas(CSSParserTokenR ange& range)
3222 {
3223 if (range.peek().id() == CSSValueNone)
3224 return consumeIdent(range);
3225
3226 NamedGridAreaMap gridAreaMap;
3227 size_t rowCount = 0;
3228 size_t columnCount = 0;
3229
3230 while (range.peek().type() == StringToken) {
3231 if (!parseGridTemplateAreasRow(range.consumeIncludingWhitespace().value( ), gridAreaMap, rowCount, columnCount))
3232 return nullptr;
3233 ++rowCount;
3234 }
3235
3236 if (rowCount == 0)
3237 return nullptr;
3238 ASSERT(columnCount);
3239 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ;
3240 }
3241
3221 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) 3242 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty)
3222 { 3243 {
3223 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 3244 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
3224 if (CSSParserFastPaths::isKeywordPropertyID(property)) { 3245 if (CSSParserFastPaths::isKeywordPropertyID(property)) {
3225 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) 3246 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id()))
3226 return nullptr; 3247 return nullptr;
3227 return consumeIdent(m_range); 3248 return consumeIdent(m_range);
3228 } 3249 }
3229 switch (property) { 3250 switch (property) {
3230 case CSSPropertyWillChange: 3251 case CSSPropertyWillChange:
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3587 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3608 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3588 return consumeGridLine(m_range); 3609 return consumeGridLine(m_range);
3589 case CSSPropertyGridAutoColumns: 3610 case CSSPropertyGridAutoColumns:
3590 case CSSPropertyGridAutoRows: 3611 case CSSPropertyGridAutoRows:
3591 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3612 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3592 return consumeGridTrackSize(m_range, m_context.mode()); 3613 return consumeGridTrackSize(m_range, m_context.mode());
3593 case CSSPropertyGridTemplateColumns: 3614 case CSSPropertyGridTemplateColumns:
3594 case CSSPropertyGridTemplateRows: 3615 case CSSPropertyGridTemplateRows:
3595 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3616 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3596 return consumeGridTemplatesRowsOrColumns(m_range, m_context.mode()); 3617 return consumeGridTemplatesRowsOrColumns(m_range, m_context.mode());
3618 case CSSPropertyGridTemplateAreas:
3619 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3620 return consumeGridTemplateAreas(m_range);
3597 default: 3621 default:
3598 CSSParserValueList valueList(m_range); 3622 CSSParserValueList valueList(m_range);
3599 if (valueList.size()) { 3623 if (valueList.size()) {
3600 m_valueList = &valueList; 3624 m_valueList = &valueList;
3601 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { 3625 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) {
3602 while (!m_range.atEnd()) 3626 while (!m_range.atEnd())
3603 m_range.consume(); 3627 m_range.consume();
3604 return result.release(); 3628 return result.release();
3605 } 3629 }
3606 } 3630 }
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 m_currentShorthand = oldShorthand; 4624 m_currentShorthand = oldShorthand;
4601 CSSParserValueList valueList(m_range); 4625 CSSParserValueList valueList(m_range);
4602 if (!valueList.size()) 4626 if (!valueList.size())
4603 return false; 4627 return false;
4604 m_valueList = &valueList; 4628 m_valueList = &valueList;
4605 return legacyParseShorthand(unresolvedProperty, important); 4629 return legacyParseShorthand(unresolvedProperty, important);
4606 } 4630 }
4607 } 4631 }
4608 4632
4609 } // namespace blink 4633 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698