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" |
11 #include "core/css/CSSCounterValue.h" | 11 #include "core/css/CSSCounterValue.h" |
12 #include "core/css/CSSCrossfadeValue.h" | 12 #include "core/css/CSSCrossfadeValue.h" |
13 #include "core/css/CSSCursorImageValue.h" | 13 #include "core/css/CSSCursorImageValue.h" |
14 #include "core/css/CSSCustomIdentValue.h" | 14 #include "core/css/CSSCustomIdentValue.h" |
15 #include "core/css/CSSFontFaceSrcValue.h" | 15 #include "core/css/CSSFontFaceSrcValue.h" |
16 #include "core/css/CSSFontFeatureValue.h" | 16 #include "core/css/CSSFontFeatureValue.h" |
17 #include "core/css/CSSFunctionValue.h" | 17 #include "core/css/CSSFunctionValue.h" |
18 #include "core/css/CSSGradientValue.h" | 18 #include "core/css/CSSGradientValue.h" |
19 #include "core/css/CSSGridAutoRepeatValue.h" | 19 #include "core/css/CSSGridAutoRepeatValue.h" |
20 #include "core/css/CSSGridLineNamesValue.h" | 20 #include "core/css/CSSGridLineNamesValue.h" |
| 21 #include "core/css/CSSGridTemplateAreasValue.h" |
21 #include "core/css/CSSImageSetValue.h" | 22 #include "core/css/CSSImageSetValue.h" |
22 #include "core/css/CSSPaintValue.h" | 23 #include "core/css/CSSPaintValue.h" |
23 #include "core/css/CSSPathValue.h" | 24 #include "core/css/CSSPathValue.h" |
24 #include "core/css/CSSPrimitiveValueMappings.h" | 25 #include "core/css/CSSPrimitiveValueMappings.h" |
25 #include "core/css/CSSQuadValue.h" | 26 #include "core/css/CSSQuadValue.h" |
26 #include "core/css/CSSReflectValue.h" | 27 #include "core/css/CSSReflectValue.h" |
27 #include "core/css/CSSSVGDocumentValue.h" | 28 #include "core/css/CSSSVGDocumentValue.h" |
28 #include "core/css/CSSShadowValue.h" | 29 #include "core/css/CSSShadowValue.h" |
29 #include "core/css/CSSStringValue.h" | 30 #include "core/css/CSSStringValue.h" |
30 #include "core/css/CSSTimingFunctionValue.h" | 31 #include "core/css/CSSTimingFunctionValue.h" |
(...skipping 21 matching lines...) Expand all Loading... |
52 const CSSParserContext& context, HeapVector<CSSProperty, 256>* parsedPropert
ies) | 53 const CSSParserContext& context, HeapVector<CSSProperty, 256>* parsedPropert
ies) |
53 : m_range(range) | 54 : m_range(range) |
54 , m_context(context) | 55 , m_context(context) |
55 , m_parsedProperties(parsedProperties) | 56 , m_parsedProperties(parsedProperties) |
56 , m_inParseShorthand(0) | 57 , m_inParseShorthand(0) |
57 , m_currentShorthand(CSSPropertyInvalid) | 58 , m_currentShorthand(CSSPropertyInvalid) |
58 { | 59 { |
59 m_range.consumeWhitespace(); | 60 m_range.consumeWhitespace(); |
60 } | 61 } |
61 | 62 |
| 63 void CSSPropertyParser::addProperty(CSSPropertyID property, CSSValue* value, boo
l important, bool implicit) |
| 64 { |
| 65 ASSERT(!isPropertyAlias(property)); |
| 66 |
| 67 int shorthandIndex = 0; |
| 68 bool setFromShorthand = false; |
| 69 |
| 70 if (m_currentShorthand) { |
| 71 Vector<StylePropertyShorthand, 4> shorthands; |
| 72 getMatchingShorthandsForLonghand(property, &shorthands); |
| 73 setFromShorthand = true; |
| 74 if (shorthands.size() > 1) |
| 75 shorthandIndex = indexOfShorthandForLonghand(m_currentShorthand, sho
rthands); |
| 76 } |
| 77 |
| 78 m_parsedProperties->append(CSSProperty(property, value, important, setFromSh
orthand, shorthandIndex, implicit)); |
| 79 } |
| 80 |
| 81 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, CSSV
alue* value, bool important) |
| 82 { |
| 83 const StylePropertyShorthand& shorthand = shorthandForProperty(property); |
| 84 unsigned shorthandLength = shorthand.length(); |
| 85 if (!shorthandLength) { |
| 86 addProperty(property, value, important); |
| 87 return; |
| 88 } |
| 89 |
| 90 ShorthandScope scope(this, property); |
| 91 const CSSPropertyID* longhands = shorthand.properties(); |
| 92 for (unsigned i = 0; i < shorthandLength; ++i) |
| 93 addProperty(longhands[i], value, important); |
| 94 } |
| 95 |
62 static bool hasInvalidNumericValues(const CSSParserTokenRange& range) | 96 static bool hasInvalidNumericValues(const CSSParserTokenRange& range) |
63 { | 97 { |
64 for (const CSSParserToken& token : range) { | 98 for (const CSSParserToken& token : range) { |
65 CSSParserTokenType type = token.type(); | 99 CSSParserTokenType type = token.type(); |
66 if ((type == NumberToken || type == DimensionToken || type == Percentage
Token) | 100 if ((type == NumberToken || type == DimensionToken || type == Percentage
Token) |
67 && !CSSPropertyParser::isValidNumericValue(token.numericValue())) | 101 && !CSSPropertyParser::isValidNumericValue(token.numericValue())) |
68 return true; | 102 return true; |
69 } | 103 } |
70 return false; | 104 return false; |
71 } | 105 } |
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 vertical = consumeLengthOrPercent(range, mode, ValueRangeAll, Unitle
ssQuirk::Forbid); | 2950 vertical = consumeLengthOrPercent(range, mode, ValueRangeAll, Unitle
ssQuirk::Forbid); |
2917 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { | 2951 } else if (unresolvedProperty == CSSPropertyAliasWebkitBackgroundSize) { |
2918 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back
ground-size: 10px 10px". | 2952 // Legacy syntax: "-webkit-background-size: 10px" is equivalent to "back
ground-size: 10px 10px". |
2919 vertical = horizontal; | 2953 vertical = horizontal; |
2920 } | 2954 } |
2921 if (!vertical) | 2955 if (!vertical) |
2922 return horizontal; | 2956 return horizontal; |
2923 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica
lValues); | 2957 return CSSValuePair::create(horizontal, vertical, CSSValuePair::KeepIdentica
lValues); |
2924 } | 2958 } |
2925 | 2959 |
2926 CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) | 2960 static CSSValueList* consumeGridAutoFlow(CSSParserTokenRange& range) |
2927 { | 2961 { |
2928 CSSPrimitiveValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColu
mn>(range); | 2962 CSSPrimitiveValue* rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColu
mn>(range); |
2929 CSSPrimitiveValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); | 2963 CSSPrimitiveValue* denseAlgorithm = consumeIdent<CSSValueDense>(range); |
2930 if (!rowOrColumnValue) { | 2964 if (!rowOrColumnValue) { |
2931 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); | 2965 rowOrColumnValue = consumeIdent<CSSValueRow, CSSValueColumn>(range); |
2932 if (!rowOrColumnValue && !denseAlgorithm) | 2966 if (!rowOrColumnValue && !denseAlgorithm) |
2933 return nullptr; | 2967 return nullptr; |
2934 } | 2968 } |
2935 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); | 2969 CSSValueList* parsedValues = CSSValueList::createSpaceSeparated(); |
2936 if (rowOrColumnValue) | 2970 if (rowOrColumnValue) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3095 if (spanValue) | 3129 if (spanValue) |
3096 values->append(spanValue); | 3130 values->append(spanValue); |
3097 if (numericValue) | 3131 if (numericValue) |
3098 values->append(numericValue); | 3132 values->append(numericValue); |
3099 if (gridLineName) | 3133 if (gridLineName) |
3100 values->append(gridLineName); | 3134 values->append(gridLineName); |
3101 ASSERT(values->length()); | 3135 ASSERT(values->length()); |
3102 return values; | 3136 return values; |
3103 } | 3137 } |
3104 | 3138 |
| 3139 static bool allTracksAreFixedSized(CSSValueList& valueList) |
| 3140 { |
| 3141 for (CSSValue* value : valueList) { |
| 3142 if (value->isGridLineNamesValue()) |
| 3143 continue; |
| 3144 // The auto-repeat value holds a <fixed-size> = <fixed-breadth> | minmax
( <fixed-breadth>, <track-breadth> ) |
| 3145 if (value->isGridAutoRepeatValue()) { |
| 3146 if (!allTracksAreFixedSized(toCSSValueList(*value))) |
| 3147 return false; |
| 3148 continue; |
| 3149 } |
| 3150 const CSSPrimitiveValue& primitiveValue = value->isPrimitiveValue() |
| 3151 ? toCSSPrimitiveValue(*value) |
| 3152 : toCSSPrimitiveValue(*toCSSFunctionValue(*value).item(0)); |
| 3153 CSSValueID valueID = primitiveValue.getValueID(); |
| 3154 if (valueID == CSSValueMinContent || valueID == CSSValueMaxContent || va
lueID == CSSValueAuto || primitiveValue.isFlex()) |
| 3155 return false; |
| 3156 } |
| 3157 return true; |
| 3158 } |
| 3159 |
| 3160 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam
es) |
| 3161 { |
| 3162 ASSERT(!gridRowNames.isEmpty()); |
| 3163 Vector<String> columnNames; |
| 3164 // Using StringImpl to avoid checks and indirection in every call to String:
:operator[]. |
| 3165 StringImpl& text = *gridRowNames.impl(); |
| 3166 |
| 3167 StringBuilder areaName; |
| 3168 for (unsigned i = 0; i < text.length(); ++i) { |
| 3169 // TODO(rob.buis): this whitespace check misses \n and \t. |
| 3170 // https://drafts.csswg.org/css-grid/#valdef-grid-template-areas-string |
| 3171 // https://drafts.csswg.org/css-syntax-3/#whitespace |
| 3172 if (text[i] == ' ') { |
| 3173 if (!areaName.isEmpty()) { |
| 3174 columnNames.append(areaName.toString()); |
| 3175 areaName.clear(); |
| 3176 } |
| 3177 continue; |
| 3178 } |
| 3179 if (text[i] == '.') { |
| 3180 if (areaName == ".") |
| 3181 continue; |
| 3182 if (!areaName.isEmpty()) { |
| 3183 columnNames.append(areaName.toString()); |
| 3184 areaName.clear(); |
| 3185 } |
| 3186 } else { |
| 3187 // TODO(rob.buis): only allow name code points here. |
| 3188 if (areaName == ".") { |
| 3189 columnNames.append(areaName.toString()); |
| 3190 areaName.clear(); |
| 3191 } |
| 3192 } |
| 3193 |
| 3194 areaName.append(text[i]); |
| 3195 } |
| 3196 |
| 3197 if (!areaName.isEmpty()) |
| 3198 columnNames.append(areaName.toString()); |
| 3199 |
| 3200 return columnNames; |
| 3201 } |
| 3202 |
| 3203 static bool parseGridTemplateAreasRow(const String& gridRowNames, NamedGridAreaM
ap& gridAreaMap, const size_t rowCount, size_t& columnCount) |
| 3204 { |
| 3205 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace()) |
| 3206 return false; |
| 3207 |
| 3208 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames)
; |
| 3209 if (rowCount == 0) { |
| 3210 columnCount = columnNames.size(); |
| 3211 ASSERT(columnCount); |
| 3212 } else if (columnCount != columnNames.size()) { |
| 3213 // The declaration is invalid if all the rows don't have the number of c
olumns. |
| 3214 return false; |
| 3215 } |
| 3216 |
| 3217 for (size_t currentColumn = 0; currentColumn < columnCount; ++currentColumn)
{ |
| 3218 const String& gridAreaName = columnNames[currentColumn]; |
| 3219 |
| 3220 // Unamed areas are always valid (we consider them to be 1x1). |
| 3221 if (gridAreaName == ".") |
| 3222 continue; |
| 3223 |
| 3224 size_t lookAheadColumn = currentColumn + 1; |
| 3225 while (lookAheadColumn < columnCount && columnNames[lookAheadColumn] ==
gridAreaName) |
| 3226 lookAheadColumn++; |
| 3227 |
| 3228 NamedGridAreaMap::iterator gridAreaIt = gridAreaMap.find(gridAreaName); |
| 3229 if (gridAreaIt == gridAreaMap.end()) { |
| 3230 gridAreaMap.add(gridAreaName, GridArea(GridSpan::translatedDefiniteG
ridSpan(rowCount, rowCount + 1), GridSpan::translatedDefiniteGridSpan(currentCol
umn, lookAheadColumn))); |
| 3231 } else { |
| 3232 GridArea& gridArea = gridAreaIt->value; |
| 3233 |
| 3234 // The following checks test that the grid area is a single filled-i
n rectangle. |
| 3235 // 1. The new row is adjacent to the previously parsed row. |
| 3236 if (rowCount != gridArea.rows.endLine()) |
| 3237 return false; |
| 3238 |
| 3239 // 2. The new area starts at the same position as the previously par
sed area. |
| 3240 if (currentColumn != gridArea.columns.startLine()) |
| 3241 return false; |
| 3242 |
| 3243 // 3. The new area ends at the same position as the previously parse
d area. |
| 3244 if (lookAheadColumn != gridArea.columns.endLine()) |
| 3245 return false; |
| 3246 |
| 3247 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s
tartLine(), gridArea.rows.endLine() + 1); |
| 3248 } |
| 3249 currentColumn = lookAheadColumn - 1; |
| 3250 } |
| 3251 |
| 3252 return true; |
| 3253 } |
| 3254 |
| 3255 enum TrackSizeRestriction { FixedSizeOnly, AllowAll }; |
| 3256 |
3105 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode, TrackSizeRestriction restriction = AllowAll) | 3257 static CSSPrimitiveValue* consumeGridBreadth(CSSParserTokenRange& range, CSSPars
erMode cssParserMode, TrackSizeRestriction restriction = AllowAll) |
3106 { | 3258 { |
3107 if (restriction == AllowAll) { | 3259 if (restriction == AllowAll) { |
3108 const CSSParserToken& token = range.peek(); | 3260 const CSSParserToken& token = range.peek(); |
3109 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(t
oken.id())) | 3261 if (identMatches<CSSValueMinContent, CSSValueMaxContent, CSSValueAuto>(t
oken.id())) |
3110 return consumeIdent(range); | 3262 return consumeIdent(range); |
3111 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveVa
lue::UnitType::Fraction) { | 3263 if (token.type() == DimensionToken && token.unitType() == CSSPrimitiveVa
lue::UnitType::Fraction) { |
3112 if (range.peek().numericValue() < 0) | 3264 if (range.peek().numericValue() < 0) |
3113 return nullptr; | 3265 return nullptr; |
3114 return cssValuePool().createValue(range.consumeIncludingWhitespace()
.numericValue(), CSSPrimitiveValue::UnitType::Fraction); | 3266 return cssValuePool().createValue(range.consumeIncludingWhitespace()
.numericValue(), CSSPrimitiveValue::UnitType::Fraction); |
3115 } | 3267 } |
3116 } | 3268 } |
3117 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); | 3269 return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, U
nitlessQuirk::Allow); |
3118 } | 3270 } |
3119 | 3271 |
3120 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li
st> for the grid shorthand. | 3272 // TODO(rob.buis): This needs a bool parameter so we can disallow <auto-track-li
st> for the grid shorthand. |
3121 CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode cssPars
erMode, TrackSizeRestriction restriction) | 3273 static CSSValue* consumeGridTrackSize(CSSParserTokenRange& range, CSSParserMode
cssParserMode, TrackSizeRestriction restriction = AllowAll) |
3122 { | 3274 { |
3123 const CSSParserToken& token = range.peek(); | 3275 const CSSParserToken& token = range.peek(); |
3124 if (restriction == AllowAll && identMatches<CSSValueAuto>(token.id())) | 3276 if (restriction == AllowAll && identMatches<CSSValueAuto>(token.id())) |
3125 return consumeIdent(range); | 3277 return consumeIdent(range); |
3126 | 3278 |
3127 if (token.functionId() == CSSValueMinmax) { | 3279 if (token.functionId() == CSSValueMinmax) { |
3128 CSSParserTokenRange rangeCopy = range; | 3280 CSSParserTokenRange rangeCopy = range; |
3129 CSSParserTokenRange args = consumeFunction(rangeCopy); | 3281 CSSParserTokenRange args = consumeFunction(rangeCopy); |
3130 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM
ode, restriction); | 3282 CSSPrimitiveValue* minTrackBreadth = consumeGridBreadth(args, cssParserM
ode, restriction); |
3131 if (!minTrackBreadth || !consumeCommaIncludingWhitespace(args)) | 3283 if (!minTrackBreadth || !consumeCommaIncludingWhitespace(args)) |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4556 addProperty(CSSPropertyGridTemplateColumns, columnsValue, important); | 4708 addProperty(CSSPropertyGridTemplateColumns, columnsValue, important); |
4557 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createIdentifie
rValue(CSSValueNone), important); | 4709 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createIdentifie
rValue(CSSValueNone), important); |
4558 return true; | 4710 return true; |
4559 } | 4711 } |
4560 | 4712 |
4561 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis
t> ]? | 4713 // 3- [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <track-lis
t> ]? |
4562 m_range = rangeCopy; | 4714 m_range = rangeCopy; |
4563 return consumeGridTemplateRowsAndAreasAndColumns(important); | 4715 return consumeGridTemplateRowsAndAreasAndColumns(important); |
4564 } | 4716 } |
4565 | 4717 |
| 4718 bool CSSPropertyParser::consumeGridShorthand(bool important) |
| 4719 { |
| 4720 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
| 4721 ASSERT(shorthandForProperty(CSSPropertyGrid).length() == 8); |
| 4722 |
| 4723 CSSParserTokenRange rangeCopy = m_range; |
| 4724 |
| 4725 // 1- <grid-template> |
| 4726 if (consumeGridTemplateShorthand(important)) { |
| 4727 // It can only be specified the explicit or the implicit grid properties
in a single grid declaration. |
| 4728 // The sub-properties not specified are set to their initial value, as n
ormal for shorthands. |
| 4729 addProperty(CSSPropertyGridAutoFlow, cssValuePool().createImplicitInitia
lValue(), important); |
| 4730 addProperty(CSSPropertyGridAutoColumns, cssValuePool().createImplicitIni
tialValue(), important); |
| 4731 addProperty(CSSPropertyGridAutoRows, cssValuePool().createImplicitInitia
lValue(), important); |
| 4732 addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitIniti
alValue(), important); |
| 4733 addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialV
alue(), important); |
| 4734 return true; |
| 4735 } |
| 4736 |
| 4737 m_range = rangeCopy; |
| 4738 |
| 4739 // 2- <grid-auto-flow> [ <grid-auto-rows> [ / <grid-auto-columns> ]? ] |
| 4740 CSSValueList* gridAutoFlow = consumeGridAutoFlow(m_range); |
| 4741 if (!gridAutoFlow) |
| 4742 return false; |
| 4743 |
| 4744 CSSValue* autoColumnsValue = nullptr; |
| 4745 CSSValue* autoRowsValue = nullptr; |
| 4746 |
| 4747 if (!m_range.atEnd()) { |
| 4748 autoRowsValue = consumeGridTrackSize(m_range, m_context.mode()); |
| 4749 if (!autoRowsValue) |
| 4750 return false; |
| 4751 if (consumeSlashIncludingWhitespace(m_range)) { |
| 4752 autoColumnsValue = consumeGridTrackSize(m_range, m_context.mode()); |
| 4753 if (!autoColumnsValue) |
| 4754 return false; |
| 4755 } |
| 4756 if (!m_range.atEnd()) |
| 4757 return false; |
| 4758 } else { |
| 4759 // Other omitted values are set to their initial values. |
| 4760 autoColumnsValue = cssValuePool().createImplicitInitialValue(); |
| 4761 autoRowsValue = cssValuePool().createImplicitInitialValue(); |
| 4762 } |
| 4763 |
| 4764 // if <grid-auto-columns> value is omitted, it is set to the value specified
for grid-auto-rows. |
| 4765 if (!autoColumnsValue) |
| 4766 autoColumnsValue = autoRowsValue; |
| 4767 |
| 4768 // It can only be specified the explicit or the implicit grid properties in
a single grid declaration. |
| 4769 // The sub-properties not specified are set to their initial value, as norma
l for shorthands. |
| 4770 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni
tialValue(), important); |
| 4771 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia
lValue(), important); |
| 4772 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti
alValue(), important); |
| 4773 addProperty(CSSPropertyGridAutoFlow, gridAutoFlow, important); |
| 4774 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important); |
| 4775 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important); |
| 4776 addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitInitialVa
lue(), important); |
| 4777 addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialValue
(), important); |
| 4778 |
| 4779 return true; |
| 4780 } |
| 4781 |
4566 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
portant) | 4782 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im
portant) |
4567 { | 4783 { |
4568 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); | 4784 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); |
4569 | 4785 |
4570 CSSPropertyID oldShorthand = m_currentShorthand; | 4786 CSSPropertyID oldShorthand = m_currentShorthand; |
4571 // TODO(rob.buis): Remove this when the legacy property parser is gone | 4787 // TODO(rob.buis): Remove this when the legacy property parser is gone |
4572 m_currentShorthand = property; | 4788 m_currentShorthand = property; |
4573 switch (property) { | 4789 switch (property) { |
4574 case CSSPropertyWebkitMarginCollapse: { | 4790 case CSSPropertyWebkitMarginCollapse: { |
4575 CSSValueID id = m_range.consumeIncludingWhitespace().id(); | 4791 CSSValueID id = m_range.consumeIncludingWhitespace().id(); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4740 addProperty(CSSPropertyGridColumnGap, columnGap, important); | 4956 addProperty(CSSPropertyGridColumnGap, columnGap, important); |
4741 return true; | 4957 return true; |
4742 } | 4958 } |
4743 case CSSPropertyGridColumn: | 4959 case CSSPropertyGridColumn: |
4744 case CSSPropertyGridRow: | 4960 case CSSPropertyGridRow: |
4745 return consumeGridItemPositionShorthand(property, important); | 4961 return consumeGridItemPositionShorthand(property, important); |
4746 case CSSPropertyGridArea: | 4962 case CSSPropertyGridArea: |
4747 return consumeGridAreaShorthand(important); | 4963 return consumeGridAreaShorthand(important); |
4748 case CSSPropertyGridTemplate: | 4964 case CSSPropertyGridTemplate: |
4749 return consumeGridTemplateShorthand(important); | 4965 return consumeGridTemplateShorthand(important); |
| 4966 case CSSPropertyGrid: |
| 4967 return consumeGridShorthand(important); |
4750 default: | 4968 default: |
4751 m_currentShorthand = oldShorthand; | 4969 m_currentShorthand = oldShorthand; |
4752 CSSParserValueList valueList(m_range); | 4970 return false; |
4753 if (!valueList.size()) | |
4754 return false; | |
4755 m_valueList = &valueList; | |
4756 return legacyParseShorthand(unresolvedProperty, important); | |
4757 } | 4971 } |
4758 } | 4972 } |
4759 | 4973 |
4760 } // namespace blink | 4974 } // namespace blink |
OLD | NEW |