| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 value = cssValuePool().createExplicitInitialValue(); | 298 value = cssValuePool().createExplicitInitialValue(); |
| 299 else if (id == CSSValueInherit) | 299 else if (id == CSSValueInherit) |
| 300 value = cssValuePool().createInheritedValue(); | 300 value = cssValuePool().createInheritedValue(); |
| 301 else if (id == CSSValueUnset) | 301 else if (id == CSSValueUnset) |
| 302 value = cssValuePool().createUnsetValue(); | 302 value = cssValuePool().createUnsetValue(); |
| 303 else | 303 else |
| 304 return false; | 304 return false; |
| 305 | 305 |
| 306 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 306 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
| 307 const StylePropertyShorthand& shorthand = shorthandForProperty(property); | 307 const StylePropertyShorthand& shorthand = shorthandForProperty(property); |
| 308 if (!shorthand.length()) | 308 if (!shorthand.length()) { |
| 309 if (CSSPropertyMetadata::isDescriptorOnly(unresolvedProperty)) |
| 310 return false; |
| 309 addProperty(property, CSSPropertyInvalid, value, important); | 311 addProperty(property, CSSPropertyInvalid, value, important); |
| 310 else | 312 } else { |
| 311 addExpandedPropertyForValue(property, value, important); | 313 addExpandedPropertyForValue(property, value, important); |
| 314 } |
| 312 m_range = rangeCopy; | 315 m_range = rangeCopy; |
| 313 return true; | 316 return true; |
| 314 } | 317 } |
| 315 | 318 |
| 316 static CSSValueList* consumeTransformOrigin(CSSParserTokenRange& range, CSSParse
rMode cssParserMode, UnitlessQuirk unitless) | 319 static CSSValueList* consumeTransformOrigin(CSSParserTokenRange& range, CSSParse
rMode cssParserMode, UnitlessQuirk unitless) |
| 317 { | 320 { |
| 318 CSSValue* resultX = nullptr; | 321 CSSValue* resultX = nullptr; |
| 319 CSSValue* resultY = nullptr; | 322 CSSValue* resultY = nullptr; |
| 320 if (consumeOneOrTwoValuedPosition(range, cssParserMode, unitless, resultX, r
esultY)) { | 323 if (consumeOneOrTwoValuedPosition(range, cssParserMode, unitless, resultX, r
esultY)) { |
| 321 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 324 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
| (...skipping 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3963 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3966 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3964 return consumeGridTemplateAreas(m_range); | 3967 return consumeGridTemplateAreas(m_range); |
| 3965 case CSSPropertyGridAutoFlow: | 3968 case CSSPropertyGridAutoFlow: |
| 3966 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3969 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 3967 return consumeGridAutoFlow(m_range); | 3970 return consumeGridAutoFlow(m_range); |
| 3968 default: | 3971 default: |
| 3969 return nullptr; | 3972 return nullptr; |
| 3970 } | 3973 } |
| 3971 } | 3974 } |
| 3972 | 3975 |
| 3976 static CSSPrimitiveValue* consumeFontDisplay(CSSParserTokenRange& range) |
| 3977 { |
| 3978 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, CSSValueFallb
ack, CSSValueOptional>(range); |
| 3979 } |
| 3980 |
| 3973 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) | 3981 static CSSValueList* consumeFontFaceUnicodeRange(CSSParserTokenRange& range) |
| 3974 { | 3982 { |
| 3975 CSSValueList* values = CSSValueList::createCommaSeparated(); | 3983 CSSValueList* values = CSSValueList::createCommaSeparated(); |
| 3976 | 3984 |
| 3977 do { | 3985 do { |
| 3978 const CSSParserToken& token = range.consumeIncludingWhitespace(); | 3986 const CSSParserToken& token = range.consumeIncludingWhitespace(); |
| 3979 if (token.type() != UnicodeRangeToken) | 3987 if (token.type() != UnicodeRangeToken) |
| 3980 return nullptr; | 3988 return nullptr; |
| 3981 | 3989 |
| 3982 UChar32 start = token.unicodeRangeStart(); | 3990 UChar32 start = token.unicodeRangeStart(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4056 return false; | 4064 return false; |
| 4057 parsedValue = consumeFamilyName(m_range); | 4065 parsedValue = consumeFamilyName(m_range); |
| 4058 break; | 4066 break; |
| 4059 case CSSPropertySrc: // This is a list of urls or local references. | 4067 case CSSPropertySrc: // This is a list of urls or local references. |
| 4060 parsedValue = consumeFontFaceSrc(m_range, m_context); | 4068 parsedValue = consumeFontFaceSrc(m_range, m_context); |
| 4061 break; | 4069 break; |
| 4062 case CSSPropertyUnicodeRange: | 4070 case CSSPropertyUnicodeRange: |
| 4063 parsedValue = consumeFontFaceUnicodeRange(m_range); | 4071 parsedValue = consumeFontFaceUnicodeRange(m_range); |
| 4064 break; | 4072 break; |
| 4065 case CSSPropertyFontDisplay: | 4073 case CSSPropertyFontDisplay: |
| 4074 parsedValue = consumeFontDisplay(m_range); |
| 4075 break; |
| 4066 case CSSPropertyFontStretch: | 4076 case CSSPropertyFontStretch: |
| 4067 case CSSPropertyFontStyle: { | 4077 case CSSPropertyFontStyle: { |
| 4068 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4078 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
| 4069 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co
ntext.mode())) | 4079 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id, m_co
ntext.mode())) |
| 4070 return false; | 4080 return false; |
| 4071 parsedValue = cssValuePool().createIdentifierValue(id); | 4081 parsedValue = cssValuePool().createIdentifierValue(id); |
| 4072 break; | 4082 break; |
| 4073 } | 4083 } |
| 4074 case CSSPropertyFontVariant: | 4084 case CSSPropertyFontVariant: |
| 4075 parsedValue = consumeFontVariantList(m_range); | 4085 parsedValue = consumeFontVariantList(m_range); |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5168 case CSSPropertyGridTemplate: | 5178 case CSSPropertyGridTemplate: |
| 5169 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5179 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
| 5170 case CSSPropertyGrid: | 5180 case CSSPropertyGrid: |
| 5171 return consumeGridShorthand(important); | 5181 return consumeGridShorthand(important); |
| 5172 default: | 5182 default: |
| 5173 return false; | 5183 return false; |
| 5174 } | 5184 } |
| 5175 } | 5185 } |
| 5176 | 5186 |
| 5177 } // namespace blink | 5187 } // namespace blink |
| OLD | NEW |