OLD | NEW |
---|---|
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 Loading... | |
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 || !columnCount) | |
Timothy Loh
2016/03/31 00:22:46
Might be able to ASSERT(columnCount) below this ch
| |
3237 return nullptr; | |
3238 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ; | |
3239 } | |
3240 | |
3221 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) | 3241 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) |
3222 { | 3242 { |
3223 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 3243 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
3224 if (CSSParserFastPaths::isKeywordPropertyID(property)) { | 3244 if (CSSParserFastPaths::isKeywordPropertyID(property)) { |
3225 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) | 3245 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) |
3226 return nullptr; | 3246 return nullptr; |
3227 return consumeIdent(m_range); | 3247 return consumeIdent(m_range); |
3228 } | 3248 } |
3229 switch (property) { | 3249 switch (property) { |
3230 case CSSPropertyWillChange: | 3250 case CSSPropertyWillChange: |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3587 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3607 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3588 return consumeGridLine(m_range); | 3608 return consumeGridLine(m_range); |
3589 case CSSPropertyGridAutoColumns: | 3609 case CSSPropertyGridAutoColumns: |
3590 case CSSPropertyGridAutoRows: | 3610 case CSSPropertyGridAutoRows: |
3591 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3611 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3592 return consumeGridTrackSize(m_range, m_context.mode()); | 3612 return consumeGridTrackSize(m_range, m_context.mode()); |
3593 case CSSPropertyGridTemplateColumns: | 3613 case CSSPropertyGridTemplateColumns: |
3594 case CSSPropertyGridTemplateRows: | 3614 case CSSPropertyGridTemplateRows: |
3595 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3615 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3596 return consumeGridTemplatesRowsOrColumns(m_range, m_context.mode()); | 3616 return consumeGridTemplatesRowsOrColumns(m_range, m_context.mode()); |
3617 case CSSPropertyGridTemplateAreas: | |
3618 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | |
3619 return consumeGridTemplateAreas(m_range); | |
3597 default: | 3620 default: |
3598 CSSParserValueList valueList(m_range); | 3621 CSSParserValueList valueList(m_range); |
3599 if (valueList.size()) { | 3622 if (valueList.size()) { |
3600 m_valueList = &valueList; | 3623 m_valueList = &valueList; |
3601 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { | 3624 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { |
3602 while (!m_range.atEnd()) | 3625 while (!m_range.atEnd()) |
3603 m_range.consume(); | 3626 m_range.consume(); |
3604 return result.release(); | 3627 return result.release(); |
3605 } | 3628 } |
3606 } | 3629 } |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4600 m_currentShorthand = oldShorthand; | 4623 m_currentShorthand = oldShorthand; |
4601 CSSParserValueList valueList(m_range); | 4624 CSSParserValueList valueList(m_range); |
4602 if (!valueList.size()) | 4625 if (!valueList.size()) |
4603 return false; | 4626 return false; |
4604 m_valueList = &valueList; | 4627 m_valueList = &valueList; |
4605 return legacyParseShorthand(unresolvedProperty, important); | 4628 return legacyParseShorthand(unresolvedProperty, important); |
4606 } | 4629 } |
4607 } | 4630 } |
4608 | 4631 |
4609 } // namespace blink | 4632 } // namespace blink |
OLD | NEW |