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

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

Issue 1319343004: Add property parser code path based on CSSParserTokenRange (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add handling of overflow shorthand Created 5 years, 3 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 /* 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "core/css/CSSReflectValue.h" 49 #include "core/css/CSSReflectValue.h"
50 #include "core/css/CSSSVGDocumentValue.h" 50 #include "core/css/CSSSVGDocumentValue.h"
51 #include "core/css/CSSShadowValue.h" 51 #include "core/css/CSSShadowValue.h"
52 #include "core/css/CSSTimingFunctionValue.h" 52 #include "core/css/CSSTimingFunctionValue.h"
53 #include "core/css/CSSUnicodeRangeValue.h" 53 #include "core/css/CSSUnicodeRangeValue.h"
54 #include "core/css/CSSValuePair.h" 54 #include "core/css/CSSValuePair.h"
55 #include "core/css/CSSValuePool.h" 55 #include "core/css/CSSValuePool.h"
56 #include "core/css/HashTools.h" 56 #include "core/css/HashTools.h"
57 #include "core/css/parser/CSSParserFastPaths.h" 57 #include "core/css/parser/CSSParserFastPaths.h"
58 #include "core/css/parser/CSSParserValues.h" 58 #include "core/css/parser/CSSParserValues.h"
59 #include "core/css/parser/CSSPropertyParserNew.cpp"
alancutter (OOO until 2018) 2015/09/09 04:45:26 Don't include CPP files, parseSingleValue() is def
59 #include "core/frame/UseCounter.h" 60 #include "core/frame/UseCounter.h"
60 #include "core/layout/LayoutTheme.h" 61 #include "core/layout/LayoutTheme.h"
61 #include "core/style/GridCoordinate.h" 62 #include "core/style/GridCoordinate.h"
62 #include "core/svg/SVGPathUtilities.h" 63 #include "core/svg/SVGPathUtilities.h"
63 #include "platform/RuntimeEnabledFeatures.h" 64 #include "platform/RuntimeEnabledFeatures.h"
64 65
65 namespace blink { 66 namespace blink {
66 67
67 template <unsigned N> 68 template <unsigned N>
68 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N]) 69 static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N])
69 { 70 {
70 unsigned length = N - 1; // Ignore the trailing null character 71 unsigned length = N - 1; // Ignore the trailing null character
71 if (a.length() != length) 72 if (a.length() != length)
72 return false; 73 return false;
73 74
74 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF ::equalIgnoringCase(b, a.characters16(), length); 75 return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF ::equalIgnoringCase(b, a.characters16(), length);
75 } 76 }
76 77
77 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, 78 CSSPropertyParser::CSSPropertyParser(CSSParserValueList* valueList, const CSSPar serTokenRange& range,
78 const CSSParserContext& context, WillBeHeapVector<CSSProperty, 256>& parsedP roperties, 79 const CSSParserContext& context, WillBeHeapVector<CSSProperty, 256>& parsedP roperties,
79 StyleRule::Type ruleType) 80 StyleRule::Type ruleType)
80 : m_valueList(valueList) 81 : m_valueList(valueList)
82 , m_range(range)
81 , m_context(context) 83 , m_context(context)
82 , m_parsedProperties(parsedProperties) 84 , m_parsedProperties(parsedProperties)
83 , m_ruleType(ruleType) 85 , m_ruleType(ruleType)
84 , m_inParseShorthand(0) 86 , m_inParseShorthand(0)
85 , m_currentShorthand(CSSPropertyInvalid) 87 , m_currentShorthand(CSSPropertyInvalid)
86 , m_implicitShorthand(false) 88 , m_implicitShorthand(false)
87 { 89 {
88 } 90 }
89 91
90 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant, 92 bool CSSPropertyParser::parseValue(CSSPropertyID unresolvedProperty, bool import ant,
91 CSSParserValueList* valueList, const CSSParserContext& context, 93 const CSSParserTokenRange& range, const CSSParserContext& context,
92 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy pe) 94 WillBeHeapVector<CSSProperty, 256>& parsedProperties, StyleRule::Type ruleTy pe)
93 { 95 {
94 int parsedPropertiesSize = parsedProperties.size(); 96 int parsedPropertiesSize = parsedProperties.size();
95 97
96 CSSPropertyParser parser(valueList, context, parsedProperties, ruleType); 98 CSSParserValueList valueList(range);
99 if (!valueList.size())
100 return false; // Parser error
101 CSSPropertyParser parser(&valueList, range, context, parsedProperties, ruleT ype);
97 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty); 102 CSSPropertyID resolvedProperty = resolveCSSPropertyID(unresolvedProperty);
98 bool parseSuccess; 103 bool parseSuccess;
99 104
100 if (ruleType == StyleRule::Viewport) { 105 if (ruleType == StyleRule::Viewport) {
101 parseSuccess = (RuntimeEnabledFeatures::cssViewportEnabled() || isUAShee tBehavior(context.mode())) 106 parseSuccess = (RuntimeEnabledFeatures::cssViewportEnabled() || isUAShee tBehavior(context.mode()))
102 && parser.parseViewportProperty(resolvedProperty, important); 107 && parser.parseViewportProperty(resolvedProperty, important);
103 } else if (ruleType == StyleRule::FontFace) { 108 } else if (ruleType == StyleRule::FontFace) {
104 parseSuccess = parser.parseFontFaceDescriptor(resolvedProperty); 109 parseSuccess = parser.parseFontFaceDescriptor(resolvedProperty);
105 } else { 110 } else {
106 parseSuccess = parser.parseValue(unresolvedProperty, important); 111 parseSuccess = parser.parseValue(unresolvedProperty, important);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 467
463 if (CSSParserFastPaths::isKeywordPropertyID(propId)) { 468 if (CSSParserFastPaths::isKeywordPropertyID(propId)) {
464 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id)) 469 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(propId, id))
465 return false; 470 return false;
466 if (m_valueList->next() && !inShorthand()) 471 if (m_valueList->next() && !inShorthand())
467 return false; 472 return false;
468 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ; 473 addProperty(propId, cssValuePool().createIdentifierValue(id), important) ;
469 return true; 474 return true;
470 } 475 }
471 476
477 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
478 if ((parsedValue = parseSingleValue(propId))) {
479 if (!m_range.atEnd())
480 return false;
481 addProperty(propId, parsedValue.release(), important);
482 return true;
483 }
484 if (parseShorthand(propId, important))
485 return true;
486
472 bool validPrimitive = false; 487 bool validPrimitive = false;
473 Units unitless = FUnknown; 488 Units unitless = FUnknown;
474 RefPtrWillBeRawPtr<CSSValue> parsedValue = nullptr;
475 489
476 switch (propId) { 490 switch (propId) {
477 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] 491 case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
478 parsedValue = parseSize(); 492 parsedValue = parseSize();
479 break; 493 break;
480 case CSSPropertyQuotes: // [<string> <string>]+ | none 494 case CSSPropertyQuotes: // [<string> <string>]+ | none
481 if (id == CSSValueNone) 495 if (id == CSSValueNone)
482 validPrimitive = true; 496 validPrimitive = true;
483 else 497 else
484 parsedValue = parseQuotes(); 498 parsedValue = parseQuotes();
485 break; 499 break;
486 500
487 case CSSPropertyContent: // [ <string> | <uri> | <counter> | at tr(X) | open-quote | 501 case CSSPropertyContent: // [ <string> | <uri> | <counter> | at tr(X) | open-quote |
488 // close-quote | no-open-quote | no-close-quote ]+ | inherit 502 // close-quote | no-open-quote | no-close-quote ]+ | inherit
489 parsedValue = parseContent(); 503 parsedValue = parseContent();
490 break; 504 break;
491 case CSSPropertyClip: // <shape> | auto | inherit 505 case CSSPropertyClip: // <shape> | auto | inherit
492 if (id == CSSValueAuto) 506 if (id == CSSValueAuto)
493 validPrimitive = true; 507 validPrimitive = true;
494 else if (value->m_unit == CSSParserValue::Function) 508 else if (value->m_unit == CSSParserValue::Function)
495 parsedValue = parseClipShape(); 509 parsedValue = parseClipShape();
496 break; 510 break;
497 511
498 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work 512 /* Start of supported CSS properties with validation. This is needed for par seShorthand to work
499 * correctly and allows optimization in blink::applyRule(..) 513 * correctly and allows optimization in blink::applyRule(..)
500 */ 514 */
501 case CSSPropertyOverflow: {
502 ShorthandScope scope(this, propId);
503 if (!parseValue(CSSPropertyOverflowY, important) || m_valueList->current ())
504 return false;
505
506 RefPtrWillBeRawPtr<CSSValue> overflowXValue = nullptr;
507
508 // FIXME: -webkit-paged-x or -webkit-paged-y only apply to overflow-y. I f this value has been
509 // set using the shorthand, then for now overflow-x will default to auto , but once we implement
510 // pagination controls, it should default to hidden. If the overflow-y v alue is anything but
511 // paged-x or paged-y, then overflow-x and overflow-y should have the sa me value.
512 if (id == CSSValueWebkitPagedX || id == CSSValueWebkitPagedY)
513 overflowXValue = cssValuePool().createIdentifierValue(CSSValueAuto);
514 else
515 overflowXValue = m_parsedProperties.last().value();
516 addProperty(CSSPropertyOverflowX, overflowXValue.release(), important);
517 return true;
518 }
519 515
520 case CSSPropertyTextAlign: 516 case CSSPropertyTextAlign:
521 // left | right | center | justify | -webkit-left | -webkit-right | -web kit-center | -webkit-match-parent 517 // left | right | center | justify | -webkit-left | -webkit-right | -web kit-center | -webkit-match-parent
522 // | start | end | <string> | inherit | -webkit-auto (converted to start ) 518 // | start | end | <string> | inherit | -webkit-auto (converted to start )
523 // FIXME: <string> not supported right now 519 // FIXME: <string> not supported right now
524 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd) { 520 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id == CSSValueStart || id == CSSValueEnd) {
525 validPrimitive = true; 521 validPrimitive = true;
526 } 522 }
527 break; 523 break;
528 524
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 break; 1270 break;
1275 1271
1276 case CSSPropertyGridTemplate: 1272 case CSSPropertyGridTemplate:
1277 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1273 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1278 return parseGridTemplateShorthand(important); 1274 return parseGridTemplateShorthand(important);
1279 1275
1280 case CSSPropertyGrid: 1276 case CSSPropertyGrid:
1281 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 1277 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
1282 return parseGridShorthand(important); 1278 return parseGridShorthand(important);
1283 1279
1284 case CSSPropertyWebkitMarginCollapse: {
1285 ShorthandScope scope(this, CSSPropertyWebkitMarginCollapse);
1286 if (!parseValue(webkitMarginCollapseShorthand().properties()[0], importa nt))
1287 return false;
1288 if (!m_valueList->current()) {
1289 CSSValue* value = m_parsedProperties.last().value();
1290 addProperty(webkitMarginCollapseShorthand().properties()[1], value, important);
1291 return true;
1292 }
1293 if (!parseValue(webkitMarginCollapseShorthand().properties()[1], importa nt))
1294 return false;
1295 return !m_valueList->current();
1296 }
1297 case CSSPropertyWebkitColumnCount: 1280 case CSSPropertyWebkitColumnCount:
1298 parsedValue = parseColumnCount(); 1281 parsedValue = parseColumnCount();
1299 break; 1282 break;
1300 case CSSPropertyWebkitColumnGap: // normal | <length> 1283 case CSSPropertyWebkitColumnGap: // normal | <length>
1301 if (id == CSSValueNormal) 1284 if (id == CSSValueNormal)
1302 validPrimitive = true; 1285 validPrimitive = true;
1303 else 1286 else
1304 validPrimitive = validUnit(value, FLength | FNonNeg); 1287 validPrimitive = validUnit(value, FLength | FNonNeg);
1305 break; 1288 break;
1306 case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the unprefixed property) 1289 case CSSPropertyWebkitColumnSpan: // none | all | 1 (will be dropped in the unprefixed property)
1307 validPrimitive = id == CSSValueAll || id == CSSValueNone || (value->unit () == CSSPrimitiveValue::UnitType::Number && value->fValue == 1); 1290 validPrimitive = id == CSSValueAll || id == CSSValueNone || (value->unit () == CSSPrimitiveValue::UnitType::Number && value->fValue == 1);
1308 break; 1291 break;
1309 case CSSPropertyWebkitColumnWidth: // auto | <length> 1292 case CSSPropertyWebkitColumnWidth: // auto | <length>
1310 parsedValue = parseColumnWidth(); 1293 parsedValue = parseColumnWidth();
1311 break; 1294 break;
1312 case CSSPropertyWillChange:
1313 parsedValue = parseWillChange();
1314 break;
1315 // End of CSS3 properties 1295 // End of CSS3 properties
1316 1296
1317 // Apple specific properties. These will never be standardized and are pure ly to 1297 // Apple specific properties. These will never be standardized and are pure ly to
1318 // support custom WebKit-based Apple applications. 1298 // support custom WebKit-based Apple applications.
1319 case CSSPropertyWebkitLineClamp: 1299 case CSSPropertyWebkitLineClamp:
1320 // When specifying number of lines, don't allow 0 as a valid value 1300 // When specifying number of lines, don't allow 0 as a valid value
1321 // When specifying either type of unit, require non-negative integers 1301 // When specifying either type of unit, require non-negative integers
1322 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc entage || value->fValue)); 1302 validPrimitive = (!id && !isCalculation(value) && validUnit(value, FInte ger | FPercent | FNonNeg) && (value->unit() == CSSPrimitiveValue::UnitType::Perc entage || value->fValue));
1323 break; 1303 break;
1324 1304
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 case CSSPropertyWebkitColumnRule: 1416 case CSSPropertyWebkitColumnRule:
1437 return parseShorthand(propId, webkitColumnRuleShorthand(), important); 1417 return parseShorthand(propId, webkitColumnRuleShorthand(), important);
1438 case CSSPropertyWebkitTextStroke: 1418 case CSSPropertyWebkitTextStroke:
1439 return parseShorthand(propId, webkitTextStrokeShorthand(), important); 1419 return parseShorthand(propId, webkitTextStrokeShorthand(), important);
1440 case CSSPropertyAnimation: 1420 case CSSPropertyAnimation:
1441 return parseAnimationShorthand(unresolvedProperty == CSSPropertyAliasWeb kitAnimation, important); 1421 return parseAnimationShorthand(unresolvedProperty == CSSPropertyAliasWeb kitAnimation, important);
1442 case CSSPropertyTransition: 1422 case CSSPropertyTransition:
1443 return parseTransitionShorthand(important); 1423 return parseTransitionShorthand(important);
1444 case CSSPropertyInvalid: 1424 case CSSPropertyInvalid:
1445 return false; 1425 return false;
1446 case CSSPropertyPage:
1447 parsedValue = parsePage();
1448 break;
1449 // CSS Text Layout Module Level 3: Vertical writing support 1426 // CSS Text Layout Module Level 3: Vertical writing support
1450 case CSSPropertyWebkitTextEmphasis: 1427 case CSSPropertyWebkitTextEmphasis:
1451 return parseShorthand(propId, webkitTextEmphasisShorthand(), important); 1428 return parseShorthand(propId, webkitTextEmphasisShorthand(), important);
1452 1429
1453 case CSSPropertyWebkitTextEmphasisStyle: 1430 case CSSPropertyWebkitTextEmphasisStyle:
1454 parsedValue = parseTextEmphasisStyle(); 1431 parsedValue = parseTextEmphasisStyle();
1455 break; 1432 break;
1456 1433
1457 case CSSPropertyWebkitTextOrientation: 1434 case CSSPropertyWebkitTextOrientation:
1458 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right. 1435 // FIXME: For now just support sideways, sideways-right, upright and ver tical-right.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 // Properties below are validated inside parseViewportProperty, because we 1493 // Properties below are validated inside parseViewportProperty, because we
1517 // check for parser state. We need to invalidate if someone adds them outsid e 1494 // check for parser state. We need to invalidate if someone adds them outsid e
1518 // a @viewport rule. 1495 // a @viewport rule.
1519 case CSSPropertyMaxZoom: 1496 case CSSPropertyMaxZoom:
1520 case CSSPropertyMinZoom: 1497 case CSSPropertyMinZoom:
1521 case CSSPropertyOrientation: 1498 case CSSPropertyOrientation:
1522 case CSSPropertyUserZoom: 1499 case CSSPropertyUserZoom:
1523 validPrimitive = false; 1500 validPrimitive = false;
1524 break; 1501 break;
1525 1502
1503 // These were not accepted by the new path above so we should return false.
1504 case CSSPropertyWebkitMarginCollapse:
1505 case CSSPropertyWillChange:
1506 case CSSPropertyPage:
1507 case CSSPropertyOverflow:
1508 validPrimitive = false;
1509 break;
1510
1526 case CSSPropertyScrollSnapPointsX: 1511 case CSSPropertyScrollSnapPointsX:
1527 case CSSPropertyScrollSnapPointsY: 1512 case CSSPropertyScrollSnapPointsY:
1528 parsedValue = parseScrollSnapPoints(); 1513 parsedValue = parseScrollSnapPoints();
1529 break; 1514 break;
1530 case CSSPropertyScrollSnapCoordinate: 1515 case CSSPropertyScrollSnapCoordinate:
1531 parsedValue = parseScrollSnapCoordinate(); 1516 parsedValue = parseScrollSnapCoordinate();
1532 break; 1517 break;
1533 case CSSPropertyScrollSnapDestination: 1518 case CSSPropertyScrollSnapDestination:
1534 parsedValue = parsePosition(m_valueList); 1519 parsedValue = parsePosition(m_valueList);
1535 break; 1520 break;
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2057 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate() 2042 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseScrollSnapCoordinate()
2058 { 2043 {
2059 if (m_valueList->current()->id == CSSValueNone) { 2044 if (m_valueList->current()->id == CSSValueNone) {
2060 m_valueList->next(); 2045 m_valueList->next();
2061 return cssValuePool().createIdentifierValue(CSSValueNone); 2046 return cssValuePool().createIdentifierValue(CSSValueNone);
2062 } 2047 }
2063 2048
2064 return parsePositionList(m_valueList); 2049 return parsePositionList(m_valueList);
2065 } 2050 }
2066 2051
2067 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parsePage()
2068 {
2069 CSSParserValue* value = m_valueList->current();
2070 m_valueList->next();
2071 ASSERT(value);
2072
2073 if (value->id == CSSValueAuto)
2074 return cssValuePool().createIdentifierValue(value->id);
2075 if (value->m_unit == CSSParserValue::Identifier)
2076 return createPrimitiveCustomIdentValue(value);
2077 return nullptr;
2078 }
2079
2080 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ] 2052 // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
2081 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseSize() 2053 PassRefPtrWillBeRawPtr<CSSValueList> CSSPropertyParser::parseSize()
2082 { 2054 {
2083 CSSParserValue* value = m_valueList->current(); 2055 CSSParserValue* value = m_valueList->current();
2084 ASSERT(value); 2056 ASSERT(value);
2085 2057
2086 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep arated(); 2058 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep arated();
2087 2059
2088 // First parameter. 2060 // First parameter.
2089 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None); 2061 SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None);
(...skipping 4619 matching lines...) Expand 10 before | Expand all | Expand 10 after
6709 break; 6681 break;
6710 6682
6711 // If there are more arguments, they should be after a comma. 6683 // If there are more arguments, they should be after a comma.
6712 if (!consumeComma(functionArgs)) 6684 if (!consumeComma(functionArgs))
6713 return nullptr; 6685 return nullptr;
6714 } 6686 }
6715 6687
6716 return imageSet.release(); 6688 return imageSet.release();
6717 } 6689 }
6718 6690
6719 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseWillChange()
6720 {
6721 RefPtrWillBeRawPtr<CSSValueList> values = CSSValueList::createCommaSeparated ();
6722 if (m_valueList->current()->id == CSSValueAuto) {
6723 // FIXME: This will be read back as an empty string instead of auto
6724 return values.release();
6725 }
6726
6727 // Every comma-separated list of identifiers is a valid will-change value,
6728 // unless the list includes an explicitly disallowed identifier.
6729 while (true) {
6730 CSSParserValue* currentValue = m_valueList->current();
6731 if (!currentValue || currentValue->m_unit != CSSParserValue::Identifier)
6732 return nullptr;
6733
6734 CSSPropertyID unresolvedProperty = unresolvedCSSPropertyID(currentValue- >string);
6735 if (unresolvedProperty) {
6736 ASSERT(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
6737 // Now "all" is used by both CSSValue and CSSPropertyValue.
6738 // Need to return nullptr when currentValue is CSSPropertyAll.
6739 if (unresolvedProperty == CSSPropertyWillChange || unresolvedPropert y == CSSPropertyAll)
6740 return nullptr;
6741 values->append(cssValuePool().createIdentifierValue(unresolvedProper ty));
6742 } else {
6743 switch (currentValue->id) {
6744 case CSSValueNone:
6745 case CSSValueAll:
6746 case CSSValueAuto:
6747 case CSSValueDefault:
6748 case CSSValueInitial:
6749 case CSSValueInherit:
6750 return nullptr;
6751 case CSSValueContents:
6752 case CSSValueScrollPosition:
6753 values->append(cssValuePool().createIdentifierValue(currentValue ->id));
6754 break;
6755 default:
6756 break;
6757 }
6758 }
6759
6760 if (!m_valueList->next())
6761 break;
6762 if (!consumeComma(m_valueList))
6763 return nullptr;
6764 }
6765
6766 return values.release();
6767 }
6768
6769 PassRefPtrWillBeRawPtr<CSSFunctionValue> CSSPropertyParser::parseBuiltinFilterAr guments(CSSParserValueList* args, CSSValueID filterType) 6691 PassRefPtrWillBeRawPtr<CSSFunctionValue> CSSPropertyParser::parseBuiltinFilterAr guments(CSSParserValueList* args, CSSValueID filterType)
6770 { 6692 {
6771 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = CSSFunctionValue::create( filterType); 6693 RefPtrWillBeRawPtr<CSSFunctionValue> filterValue = CSSFunctionValue::create( filterType);
6772 ASSERT(args); 6694 ASSERT(args);
6773 6695
6774 switch (filterType) { 6696 switch (filterType) {
6775 case CSSValueGrayscale: 6697 case CSSValueGrayscale:
6776 case CSSValueSepia: 6698 case CSSValueSepia:
6777 case CSSValueSaturate: 6699 case CSSValueSaturate:
6778 case CSSValueInvert: 6700 case CSSValueInvert:
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
7941 } 7863 }
7942 } 7864 }
7943 7865
7944 if (!list->length()) 7866 if (!list->length())
7945 return nullptr; 7867 return nullptr;
7946 7868
7947 return list.release(); 7869 return list.release();
7948 } 7870 }
7949 7871
7950 } // namespace blink 7872 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/parser/CSSPropertyParserNew.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698