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

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

Issue 1877073004: Move the grid shorthand into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
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
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 propId, CSSValue* value, bool important, bool implicit)
Timothy Loh 2016/04/13 06:09:41 since you're moving this, can you rename propId to
rwlbuis 2016/04/13 22:16:29 Done.
64 {
65 ASSERT(!isPropertyAlias(propId));
66
67 int shorthandIndex = 0;
68 bool setFromShorthand = false;
69
70 if (m_currentShorthand) {
71 Vector<StylePropertyShorthand, 4> shorthands;
72 getMatchingShorthandsForLonghand(propId, &shorthands);
73 setFromShorthand = true;
74 if (shorthands.size() > 1)
75 shorthandIndex = indexOfShorthandForLonghand(m_currentShorthand, sho rthands);
76 }
77
78 m_parsedProperties->append(CSSProperty(propId, value, important, setFromShor thand, shorthandIndex, implicit));
79 }
80
81 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID propId, CSSVal ue* value, bool important)
Timothy Loh 2016/04/13 06:09:42 propId -> property
rwlbuis 2016/04/13 22:16:29 Done.
82 {
83 const StylePropertyShorthand& shorthand = shorthandForProperty(propId);
84 unsigned shorthandLength = shorthand.length();
85 if (!shorthandLength) {
86 addProperty(propId, value, important);
87 return;
88 }
89
90 ShorthandScope scope(this, propId);
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
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
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 (auto value : valueList) {
Timothy Loh 2016/04/13 06:09:42 does it work to write for (CSSValue* value : valu
rwlbuis 2016/04/13 22:16:29 Done.
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 ASSERT(value->isPrimitiveValue() || (value->isFunctionValue() && toCSSFu nctionValue(*value).item(0)));
Timothy Loh 2016/04/13 06:09:42 I guess this assertion is unnecessary since the co
rwlbuis 2016/04/13 22:16:29 It is not 100% covered just by that code. In theor
Timothy Loh 2016/04/14 02:04:12 Not sure I follow. Ternary below says: non-null p
3151 const CSSPrimitiveValue& primitiveValue = value->isPrimitiveValue()
3152 ? toCSSPrimitiveValue(*value)
3153 : toCSSPrimitiveValue(*toCSSFunctionValue(*value).item(0));
3154 CSSValueID valueID = primitiveValue.getValueID();
3155 if (valueID == CSSValueMinContent || valueID == CSSValueMaxContent || va lueID == CSSValueAuto || primitiveValue.isFlex())
3156 return false;
3157 }
3158 return true;
3159 }
3160
3161 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNam es)
3162 {
3163 ASSERT(!gridRowNames.isEmpty());
3164 Vector<String> columnNames;
3165 // Using StringImpl to avoid checks and indirection in every call to String: :operator[].
3166 StringImpl& text = *gridRowNames.impl();
3167
3168 StringBuilder areaName;
3169 for (unsigned i = 0; i < text.length(); ++i) {
3170 if (text[i] == ' ') {
Timothy Loh 2016/04/13 06:09:42 Needs a TODO that this whitespace check is missing
rwlbuis 2016/04/13 22:16:29 Done.
3171 if (!areaName.isEmpty()) {
3172 columnNames.append(areaName.toString());
3173 areaName.clear();
3174 }
3175 continue;
3176 }
3177 if (text[i] == '.') {
3178 if (areaName == ".")
3179 continue;
3180 if (!areaName.isEmpty()) {
3181 columnNames.append(areaName.toString());
3182 areaName.clear();
3183 }
3184 } else {
Timothy Loh 2016/04/13 06:09:42 Needs a TODO to handle trash tokens (should only a
rwlbuis 2016/04/13 22:16:28 Done.
3185 if (areaName == ".") {
3186 columnNames.append(areaName.toString());
3187 areaName.clear();
3188 }
3189 }
3190
3191 areaName.append(text[i]);
3192 }
3193
3194 if (!areaName.isEmpty())
3195 columnNames.append(areaName.toString());
3196
3197 return columnNames;
3198 }
3199
3200 static bool parseGridTemplateAreasRow(const String& gridRowNames, NamedGridAreaM ap& gridAreaMap, const size_t rowCount, size_t& columnCount)
3201 {
3202 if (gridRowNames.isEmpty() || gridRowNames.containsOnlyWhitespace())
Timothy Loh 2016/04/13 06:09:42 I feel like I had this discussion before... but is
rwlbuis 2016/04/13 22:16:29 Acknowledged.
3203 return false;
3204
3205 Vector<String> columnNames = parseGridTemplateAreasColumnNames(gridRowNames) ;
3206 if (!columnCount) {
Timothy Loh 2016/04/13 06:09:42 IMO more obvious if you write if (rowCount == 0)
rwlbuis 2016/04/13 22:16:29 You meant columnCount == 0, right? Done.
Timothy Loh 2016/04/14 02:04:12 Nope, I meant rowCount. I think it makes more sens
3207 columnCount = columnNames.size();
3208 ASSERT(columnCount);
3209 } else if (columnCount != columnNames.size()) {
3210 // The declaration is invalid is all the rows don't have the number of c olumns.
Timothy Loh 2016/04/13 06:09:41 invalid is -> invalid if
rwlbuis 2016/04/13 22:16:29 Done.
3211 return false;
3212 }
3213
3214 for (size_t currentCol = 0; currentCol < columnCount; ++currentCol) {
Timothy Loh 2016/04/13 06:09:41 currentColumn
rwlbuis 2016/04/13 22:16:29 Done.
3215 const String& gridAreaName = columnNames[currentCol];
3216
3217 // Unamed areas are always valid (we consider them to be 1x1).
3218 if (gridAreaName == ".")
3219 continue;
3220
3221 // We handle several grid areas with the same name at once to simplify t he validation code.
Timothy Loh 2016/04/13 06:09:42 I'm not really sure what this comment is trying to
rwlbuis 2016/04/13 22:16:29 Done.
3222 size_t lookAheadCol;
Timothy Loh 2016/04/13 06:09:42 imo more readable as size_t lookAheadColumn = cur
rwlbuis 2016/04/13 22:16:29 Done.
3223 for (lookAheadCol = currentCol + 1; lookAheadCol < columnCount; ++lookAh eadCol) {
3224 if (columnNames[lookAheadCol] != gridAreaName)
3225 break;
3226 }
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 , lookAheadCol)));
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 (currentCol != 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 (lookAheadCol != gridArea.columns.endLine())
3245 return false;
3246
3247 gridArea.rows = GridSpan::translatedDefiniteGridSpan(gridArea.rows.s tartLine(), gridArea.rows.endLine() + 1);
3248 }
3249 currentCol = lookAheadCol - 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
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 addProperty(CSSPropertyGridAutoFlow, gridAutoFlow, important);
4769 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important);
4770 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important);
4771
4772 // It can only be specified the explicit or the implicit grid properties in a single grid declaration.
4773 // The sub-properties not specified are set to their initial value, as norma l for shorthands.
4774 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni tialValue(), important);
Timothy Loh 2016/04/13 06:09:42 I think it makes sense for the longhands to always
rwlbuis 2016/04/13 22:16:29 Done.
4775 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia lValue(), important);
4776 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti alValue(), important);
4777 addProperty(CSSPropertyGridColumnGap, cssValuePool().createImplicitInitialVa lue(), important);
4778 addProperty(CSSPropertyGridRowGap, cssValuePool().createImplicitInitialValue (), important);
4779
4780 return true;
4781 }
4782
4566 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant) 4783 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant)
4567 { 4784 {
4568 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 4785 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
4569 4786
4570 CSSPropertyID oldShorthand = m_currentShorthand; 4787 CSSPropertyID oldShorthand = m_currentShorthand;
4571 // TODO(rob.buis): Remove this when the legacy property parser is gone 4788 // TODO(rob.buis): Remove this when the legacy property parser is gone
4572 m_currentShorthand = property; 4789 m_currentShorthand = property;
4573 switch (property) { 4790 switch (property) {
4574 case CSSPropertyWebkitMarginCollapse: { 4791 case CSSPropertyWebkitMarginCollapse: {
4575 CSSValueID id = m_range.consumeIncludingWhitespace().id(); 4792 CSSValueID id = m_range.consumeIncludingWhitespace().id();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4740 addProperty(CSSPropertyGridColumnGap, columnGap, important); 4957 addProperty(CSSPropertyGridColumnGap, columnGap, important);
4741 return true; 4958 return true;
4742 } 4959 }
4743 case CSSPropertyGridColumn: 4960 case CSSPropertyGridColumn:
4744 case CSSPropertyGridRow: 4961 case CSSPropertyGridRow:
4745 return consumeGridItemPositionShorthand(property, important); 4962 return consumeGridItemPositionShorthand(property, important);
4746 case CSSPropertyGridArea: 4963 case CSSPropertyGridArea:
4747 return consumeGridAreaShorthand(important); 4964 return consumeGridAreaShorthand(important);
4748 case CSSPropertyGridTemplate: 4965 case CSSPropertyGridTemplate:
4749 return consumeGridTemplateShorthand(important); 4966 return consumeGridTemplateShorthand(important);
4967 case CSSPropertyGrid:
4968 return consumeGridShorthand(important);
4750 default: 4969 default:
4751 m_currentShorthand = oldShorthand; 4970 m_currentShorthand = oldShorthand;
4752 CSSParserValueList valueList(m_range); 4971 return false;
4753 if (!valueList.size())
4754 return false;
4755 m_valueList = &valueList;
4756 return legacyParseShorthand(unresolvedProperty, important);
4757 } 4972 }
4758 } 4973 }
4759 4974
4760 } // namespace blink 4975 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698