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

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

Issue 973623002: Fix serialization of content property to always quote (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add another method Created 5 years, 9 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
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim itiveValue::CSS_DPCM)); 319 || (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrim itiveValue::CSS_DPCM));
320 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal ue::UnitType>(value->unit)); 320 return cssValuePool().createValue(value->fValue, static_cast<CSSPrimitiveVal ue::UnitType>(value->unit));
321 } 321 }
322 322
323 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit iveStringValue(CSSParserValue* value) 323 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit iveStringValue(CSSParserValue* value)
324 { 324 {
325 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri mitiveValue::CSS_IDENT); 325 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri mitiveValue::CSS_IDENT);
326 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI NG); 326 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_STRI NG);
327 } 327 }
328 328
329 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::createPrimit iveCustomIdentValue(CSSParserValue* value)
330 {
331 ASSERT(value->unit == CSSPrimitiveValue::CSS_STRING || value->unit == CSSPri mitiveValue::CSS_IDENT);
332 return cssValuePool().createValue(value->string, CSSPrimitiveValue::CSS_CUST OM_IDENT);
333 }
334
329 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi thReferrer(const String& rawValue, const KURL& url) 335 inline PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::createCSSImageValueWi thReferrer(const String& rawValue, const KURL& url)
330 { 336 {
331 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l); 337 RefPtrWillBeRawPtr<CSSValue> imageValue = CSSImageValue::create(rawValue, ur l);
332 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer()); 338 toCSSImageValue(imageValue.get())->setReferrer(m_context.referrer());
333 return imageValue; 339 return imageValue;
334 } 340 }
335 341
336 static inline bool isComma(CSSParserValue* value) 342 static inline bool isComma(CSSParserValue* value)
337 { 343 {
338 ASSERT(value); 344 ASSERT(value);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent) 385 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic || id == CSSValueW ebkitMinContent || id == CSSValueWebkitMaxContent || id == CSSValueWebkitFillAva ilable || id == CSSValueWebkitFitContent)
380 return true; 386 return true;
381 return !id && validUnit(value, FLength | FPercent | FNonNeg | unitless); 387 return !id && validUnit(value, FLength | FPercent | FNonNeg | unitless);
382 } 388 }
383 389
384 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr imitive(CSSValueID identifier, CSSParserValue* value) 390 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr imitive(CSSValueID identifier, CSSParserValue* value)
385 { 391 {
386 if (identifier) 392 if (identifier)
387 return cssValuePool().createIdentifierValue(identifier); 393 return cssValuePool().createIdentifierValue(identifier);
388 if (value->unit == CSSPrimitiveValue::CSS_STRING) 394 if (value->unit == CSSPrimitiveValue::CSS_STRING)
389 return createPrimitiveStringValue(value); 395 return createPrimitiveCustomIdentValue(value);
Timothy Loh 2015/03/05 22:43:35 What hit's this case now?
390 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ) 396 if (value->unit >= CSSPrimitiveValue::CSS_NUMBER && value->unit <= CSSPrimit iveValue::CSS_KHZ)
391 return createPrimitiveNumericValue(value); 397 return createPrimitiveNumericValue(value);
392 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS) 398 if (value->unit >= CSSPrimitiveValue::CSS_TURN && value->unit <= CSSPrimitiv eValue::CSS_CHS)
393 return createPrimitiveNumericValue(value); 399 return createPrimitiveNumericValue(value);
394 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX) 400 if (value->unit >= CSSPrimitiveValue::CSS_VW && value->unit <= CSSPrimitiveV alue::CSS_VMAX)
395 return createPrimitiveNumericValue(value); 401 return createPrimitiveNumericValue(value);
396 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM) 402 if (value->unit >= CSSPrimitiveValue::CSS_DPPX && value->unit <= CSSPrimitiv eValue::CSS_DPCM)
397 return createPrimitiveNumericValue(value); 403 return createPrimitiveNumericValue(value);
398 if (value->unit >= CSSParserValue::Q_EMS) 404 if (value->unit >= CSSParserValue::Q_EMS)
399 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS); 405 return CSSPrimitiveValue::createAllowingMarginQuirk(value->fValue, CSSPr imitiveValue::CSS_EMS);
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 // When specifying number of lines, don't allow 0 as a valid value 1332 // When specifying number of lines, don't allow 0 as a valid value
1327 // When specifying either type of unit, require non-negative integers 1333 // When specifying either type of unit, require non-negative integers
1328 validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTA GE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg)); 1334 validPrimitive = (!id && (value->unit == CSSPrimitiveValue::CSS_PERCENTA GE || value->fValue) && validUnit(value, FInteger | FPercent | FNonNeg));
1329 break; 1335 break;
1330 1336
1331 case CSSPropertyWebkitFontSizeDelta: // <length> 1337 case CSSPropertyWebkitFontSizeDelta: // <length>
1332 validPrimitive = validUnit(value, FLength | FUnitlessQuirk); 1338 validPrimitive = validUnit(value, FLength | FUnitlessQuirk);
1333 break; 1339 break;
1334 1340
1335 case CSSPropertyWebkitHighlight: 1341 case CSSPropertyWebkitHighlight:
1336 if (id == CSSValueNone || value->unit == CSSPrimitiveValue::CSS_STRING) 1342 if (id == CSSValueNone) {
1337 validPrimitive = true; 1343 validPrimitive = true;
1344 } else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
1345 parsedValue = createPrimitiveStringValue(value);
1346 m_valueList->next();
1347 }
1338 break; 1348 break;
1339 1349
1340 case CSSPropertyWebkitHyphenateCharacter: 1350 case CSSPropertyWebkitHyphenateCharacter:
1341 if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING) 1351 if (id == CSSValueAuto) {
1342 validPrimitive = true; 1352 validPrimitive = true;
1353 } else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
1354 parsedValue = createPrimitiveStringValue(value);
1355 m_valueList->next();
1356 }
1343 break; 1357 break;
1344 1358
1345 case CSSPropertyWebkitLocale: 1359 case CSSPropertyWebkitLocale:
1346 if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING) 1360 if (id == CSSValueAuto) {
1347 validPrimitive = true; 1361 validPrimitive = true;
1362 } else if (value->unit == CSSPrimitiveValue::CSS_STRING) {
1363 parsedValue = createPrimitiveStringValue(value);
1364 m_valueList->next();
1365 }
1348 break; 1366 break;
1349 1367
1350 // End Apple-specific properties 1368 // End Apple-specific properties
1351 1369
1352 case CSSPropertyWebkitAppRegion: 1370 case CSSPropertyWebkitAppRegion:
1353 if (id >= CSSValueDrag && id <= CSSValueNoDrag) 1371 if (id >= CSSValueDrag && id <= CSSValueNoDrag)
1354 validPrimitive = true; 1372 validPrimitive = true;
1355 break; 1373 break;
1356 1374
1357 case CSSPropertyWebkitTapHighlightColor: 1375 case CSSPropertyWebkitTapHighlightColor:
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 return false; 2085 return false;
2068 2086
2069 CSSParserValue* value = m_valueList->current(); 2087 CSSParserValue* value = m_valueList->current();
2070 if (!value) 2088 if (!value)
2071 return false; 2089 return false;
2072 2090
2073 if (value->id == CSSValueAuto) { 2091 if (value->id == CSSValueAuto) {
2074 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant); 2092 addProperty(propId, cssValuePool().createIdentifierValue(value->id), imp ortant);
2075 return true; 2093 return true;
2076 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { 2094 } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) {
2077 addProperty(propId, createPrimitiveStringValue(value), important); 2095 addProperty(propId, createPrimitiveCustomIdentValue(value), important);
2078 return true; 2096 return true;
2079 } 2097 }
2080 return false; 2098 return false;
2081 } 2099 }
2082 2100
2083 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] 2101 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
2084 bool CSSPropertyParser::parseSize(CSSPropertyID propId, bool important) 2102 bool CSSPropertyParser::parseSize(CSSPropertyID propId, bool important)
2085 { 2103 {
2086 ASSERT(propId == CSSPropertySize); 2104 ASSERT(propId == CSSPropertySize);
2087 2105
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 } 2976 }
2959 2977
2960 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo wQuotedName) 2978 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationName(bool allo wQuotedName)
2961 { 2979 {
2962 CSSParserValue* value = m_valueList->current(); 2980 CSSParserValue* value = m_valueList->current();
2963 2981
2964 if (value->id == CSSValueNone) 2982 if (value->id == CSSValueNone)
2965 return cssValuePool().createIdentifierValue(CSSValueNone); 2983 return cssValuePool().createIdentifierValue(CSSValueNone);
2966 2984
2967 if (value->unit == CSSPrimitiveValue::CSS_IDENT) 2985 if (value->unit == CSSPrimitiveValue::CSS_IDENT)
2968 return createPrimitiveStringValue(value); 2986 return createPrimitiveCustomIdentValue(value);
2969 2987
2970 if (allowQuotedName && value->unit == CSSPrimitiveValue::CSS_STRING) { 2988 if (allowQuotedName && value->unit == CSSPrimitiveValue::CSS_STRING) {
2971 // Legacy support for strings in prefixed animations 2989 // Legacy support for strings in prefixed animations
2972 if (m_context.useCounter()) 2990 if (m_context.useCounter())
2973 m_context.useCounter()->count(UseCounter::QuotedAnimationName); 2991 m_context.useCounter()->count(UseCounter::QuotedAnimationName);
2974 if (equalIgnoringCase(value->string, "none")) 2992 if (equalIgnoringCase(value->string, "none"))
2975 return cssValuePool().createIdentifierValue(CSSValueNone); 2993 return cssValuePool().createIdentifierValue(CSSValueNone);
2976 return createPrimitiveStringValue(value); 2994 return createPrimitiveCustomIdentValue(value);
2977 } 2995 }
2978 2996
2979 return nullptr; 2997 return nullptr;
2980 } 2998 }
2981 2999
2982 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationPlayState() 3000 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseAnimationPlayState()
2983 { 3001 {
2984 CSSParserValue* value = m_valueList->current(); 3002 CSSParserValue* value = m_valueList->current();
2985 if (value->id == CSSValueRunning || value->id == CSSValuePaused) 3003 if (value->id == CSSValueRunning || value->id == CSSValuePaused)
2986 return cssValuePool().createIdentifierValue(value->id); 3004 return cssValuePool().createIdentifierValue(value->id);
(...skipping 12 matching lines...) Expand all
2999 return cssValuePool().createIdentifierValue(CSSValueAll); 3017 return cssValuePool().createIdentifierValue(CSSValueAll);
3000 CSSPropertyID property = cssPropertyID(value->string); 3018 CSSPropertyID property = cssPropertyID(value->string);
3001 if (property) { 3019 if (property) {
3002 ASSERT(CSSPropertyMetadata::isEnabledProperty(property)); 3020 ASSERT(CSSPropertyMetadata::isEnabledProperty(property));
3003 return cssValuePool().createIdentifierValue(property); 3021 return cssValuePool().createIdentifierValue(property);
3004 } 3022 }
3005 if (value->id == CSSValueNone) 3023 if (value->id == CSSValueNone)
3006 return cssValuePool().createIdentifierValue(CSSValueNone); 3024 return cssValuePool().createIdentifierValue(CSSValueNone);
3007 if (value->id == CSSValueInitial || value->id == CSSValueInherit) 3025 if (value->id == CSSValueInitial || value->id == CSSValueInherit)
3008 return nullptr; 3026 return nullptr;
3009 return createPrimitiveStringValue(value); 3027 return createPrimitiveCustomIdentValue(value);
3010 } 3028 }
3011 3029
3012 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result) 3030 bool CSSPropertyParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result)
3013 { 3031 {
3014 CSSParserValue* v = args->current(); 3032 CSSParserValue* v = args->current();
3015 if (!validUnit(v, FNumber)) 3033 if (!validUnit(v, FNumber))
3016 return false; 3034 return false;
3017 result = v->fValue; 3035 result = v->fValue;
3018 v = args->next(); 3036 v = args->next();
3019 if (!v) 3037 if (!v)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 } 3212 }
3195 3213
3196 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can be stand alone or with 'span'). 3214 // The function parses [ <integer> || <custom-ident> ] in <grid-line> (which can be stand alone or with 'span').
3197 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gr idLineName) 3215 bool CSSPropertyParser::parseIntegerOrCustomIdentFromGridPosition(RefPtrWillBeRa wPtr<CSSPrimitiveValue>& numericValue, RefPtrWillBeRawPtr<CSSPrimitiveValue>& gr idLineName)
3198 { 3216 {
3199 CSSParserValue* value = m_valueList->current(); 3217 CSSParserValue* value = m_valueList->current();
3200 if (validUnit(value, FInteger) && value->fValue) { 3218 if (validUnit(value, FInteger) && value->fValue) {
3201 numericValue = createPrimitiveNumericValue(value); 3219 numericValue = createPrimitiveNumericValue(value);
3202 value = m_valueList->next(); 3220 value = m_valueList->next();
3203 if (value && isValidCustomIdentForGridPositions(*value)) { 3221 if (value && isValidCustomIdentForGridPositions(*value)) {
3204 gridLineName = createPrimitiveStringValue(m_valueList->current()); 3222 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current( ));
3205 m_valueList->next(); 3223 m_valueList->next();
3206 } 3224 }
3207 return true; 3225 return true;
3208 } 3226 }
3209 3227
3210 if (isValidCustomIdentForGridPositions(*value)) { 3228 if (isValidCustomIdentForGridPositions(*value)) {
3211 gridLineName = createPrimitiveStringValue(m_valueList->current()); 3229 gridLineName = createPrimitiveCustomIdentValue(m_valueList->current());
3212 value = m_valueList->next(); 3230 value = m_valueList->next();
3213 if (value && validUnit(value, FInteger) && value->fValue) { 3231 if (value && validUnit(value, FInteger) && value->fValue) {
3214 numericValue = createPrimitiveNumericValue(value); 3232 numericValue = createPrimitiveNumericValue(value);
3215 m_valueList->next(); 3233 m_valueList->next();
3216 } 3234 }
3217 return true; 3235 return true;
3218 } 3236 }
3219 3237
3220 return false; 3238 return false;
3221 } 3239 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 // If we didn't parse anything, this is not a valid grid position. 3274 // If we didn't parse anything, this is not a valid grid position.
3257 if (!hasSeenSpanKeyword && !gridLineName && !numericValue) 3275 if (!hasSeenSpanKeyword && !gridLineName && !numericValue)
3258 return nullptr; 3276 return nullptr;
3259 3277
3260 // Negative numbers are not allowed for span (but are for <integer>). 3278 // Negative numbers are not allowed for span (but are for <integer>).
3261 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0) 3279 if (hasSeenSpanKeyword && numericValue && numericValue->getIntValue() < 0)
3262 return nullptr; 3280 return nullptr;
3263 3281
3264 // For the <custom-ident> case. 3282 // For the <custom-ident> case.
3265 if (gridLineName && !numericValue && !hasSeenSpanKeyword) 3283 if (gridLineName && !numericValue && !hasSeenSpanKeyword)
3266 return cssValuePool().createValue(gridLineName->getStringValue(), CSSPri mitiveValue::CSS_STRING); 3284 return cssValuePool().createValue(gridLineName->getStringValue(), CSSPri mitiveValue::CSS_CUSTOM_IDENT);
3267 3285
3268 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated (); 3286 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createSpaceSeparated ();
3269 if (hasSeenSpanKeyword) 3287 if (hasSeenSpanKeyword)
3270 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); 3288 values->append(cssValuePool().createIdentifierValue(CSSValueSpan));
3271 if (numericValue) 3289 if (numericValue)
3272 values->append(numericValue.release()); 3290 values->append(numericValue.release());
3273 if (gridLineName) 3291 if (gridLineName)
3274 values->append(gridLineName.release()); 3292 values->append(gridLineName.release());
3275 ASSERT(values->length()); 3293 ASSERT(values->length());
3276 return values.release(); 3294 return values.release();
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 identList->setCurrentIndex(0); 3574 identList->setCurrentIndex(0);
3557 3575
3558 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = previousNamedAreaTrail ingLineNames; 3576 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = previousNamedAreaTrail ingLineNames;
3559 if (!lineNames) 3577 if (!lineNames)
3560 lineNames = CSSGridLineNamesValue::create(); 3578 lineNames = CSSGridLineNamesValue::create();
3561 while (CSSParserValue* identValue = identList->current()) { 3579 while (CSSParserValue* identValue = identList->current()) {
3562 if (identValue->unit != CSSPrimitiveValue::CSS_IDENT) { 3580 if (identValue->unit != CSSPrimitiveValue::CSS_IDENT) {
3563 ASSERT(RuntimeEnabledFeatures::newCSSParserEnabled()); 3581 ASSERT(RuntimeEnabledFeatures::newCSSParserEnabled());
3564 return; 3582 return;
3565 } 3583 }
3566 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveStringVa lue(identValue); 3584 RefPtrWillBeRawPtr<CSSPrimitiveValue> lineName = createPrimitiveCustomId entValue(identValue);
3567 lineNames->append(lineName.release()); 3585 lineNames->append(lineName.release());
3568 identList->next(); 3586 identList->next();
3569 } 3587 }
3570 if (!previousNamedAreaTrailingLineNames) 3588 if (!previousNamedAreaTrailingLineNames)
3571 valueList.append(lineNames.release()); 3589 valueList.append(lineNames.release());
3572 3590
3573 inputList.next(); 3591 inputList.next();
3574 } 3592 }
3575 3593
3576 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTrackList() 3594 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridTrackList()
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
3840 { 3858 {
3841 unsigned numArgs = args->size(); 3859 unsigned numArgs = args->size();
3842 if (counters && numArgs != 3 && numArgs != 5) 3860 if (counters && numArgs != 3 && numArgs != 5)
3843 return nullptr; 3861 return nullptr;
3844 if (!counters && numArgs != 1 && numArgs != 3) 3862 if (!counters && numArgs != 1 && numArgs != 3)
3845 return nullptr; 3863 return nullptr;
3846 3864
3847 CSSParserValue* i = args->current(); 3865 CSSParserValue* i = args->current();
3848 if (i->unit != CSSPrimitiveValue::CSS_IDENT) 3866 if (i->unit != CSSPrimitiveValue::CSS_IDENT)
3849 return nullptr; 3867 return nullptr;
3850 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveStringValu e(i); 3868 RefPtrWillBeRawPtr<CSSPrimitiveValue> identifier = createPrimitiveCustomIden tValue(i);
3851 3869
3852 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr; 3870 RefPtrWillBeRawPtr<CSSPrimitiveValue> separator = nullptr;
3853 if (!counters) 3871 if (!counters)
3854 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ STRING); 3872 separator = cssValuePool().createValue(String(), CSSPrimitiveValue::CSS_ CUSTOM_IDENT);
3855 else { 3873 else {
3856 args->next(); 3874 args->next();
3857 if (!consumeComma(args)) 3875 if (!consumeComma(args))
3858 return nullptr; 3876 return nullptr;
3859 3877
3860 i = args->current(); 3878 i = args->current();
3861 if (i->unit != CSSPrimitiveValue::CSS_STRING) 3879 if (i->unit != CSSPrimitiveValue::CSS_STRING)
3862 return nullptr; 3880 return nullptr;
3863 3881
3864 separator = createPrimitiveStringValue(i); 3882 separator = createPrimitiveCustomIdentValue(i);
3865 } 3883 }
3866 3884
3867 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr; 3885 RefPtrWillBeRawPtr<CSSPrimitiveValue> listStyle = nullptr;
3868 i = args->next(); 3886 i = args->next();
3869 if (!i) // Make the list style default decimal 3887 if (!i) // Make the list style default decimal
3870 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal); 3888 listStyle = cssValuePool().createIdentifierValue(CSSValueDecimal);
3871 else { 3889 else {
3872 if (!consumeComma(args)) 3890 if (!consumeComma(args))
3873 return nullptr; 3891 return nullptr;
3874 3892
(...skipping 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after
6248 } 6266 }
6249 6267
6250 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu e) 6268 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounter(int defaultValu e)
6251 { 6269 {
6252 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ; 6270 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
6253 6271
6254 while (m_valueList->current()) { 6272 while (m_valueList->current()) {
6255 CSSParserValue* val = m_valueList->current(); 6273 CSSParserValue* val = m_valueList->current();
6256 if (val->unit != CSSPrimitiveValue::CSS_IDENT) 6274 if (val->unit != CSSPrimitiveValue::CSS_IDENT)
6257 return nullptr; 6275 return nullptr;
6258 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveStrin gValue(val); 6276 RefPtrWillBeRawPtr<CSSPrimitiveValue> counterName = createPrimitiveCusto mIdentValue(val);
6259 m_valueList->next(); 6277 m_valueList->next();
6260 6278
6261 val = m_valueList->current(); 6279 val = m_valueList->current();
6262 int i = defaultValue; 6280 int i = defaultValue;
6263 if (val && validUnit(val, FInteger)) { 6281 if (val && validUnit(val, FInteger)) {
6264 i = clampTo<int>(val->fValue); 6282 i = clampTo<int>(val->fValue);
6265 m_valueList->next(); 6283 m_valueList->next();
6266 } 6284 }
6267 6285
6268 list->append(createPrimitiveValuePair(counterName.release(), 6286 list->append(createPrimitiveValuePair(counterName.release(),
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after
8477 } 8495 }
8478 } 8496 }
8479 8497
8480 if (!list->length()) 8498 if (!list->length())
8481 return nullptr; 8499 return nullptr;
8482 8500
8483 return list.release(); 8501 return list.release();
8484 } 8502 }
8485 8503
8486 } // namespace blink 8504 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698