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

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

Issue 2755493004: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in core/css/ (Closed)
Patch Set: Worked on Review Comments done Created 3 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
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 <memory> 7 #include <memory>
8 #include "core/StylePropertyShorthand.h" 8 #include "core/StylePropertyShorthand.h"
9 #include "core/css/CSSBasicShapeValues.h" 9 #include "core/css/CSSBasicShapeValues.h"
10 #include "core/css/CSSBorderImage.h" 10 #include "core/css/CSSBorderImage.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 HeapVector<CSSProperty, 256>* parsedProperties) 64 HeapVector<CSSProperty, 256>* parsedProperties)
65 : m_range(range), m_context(context), m_parsedProperties(parsedProperties) { 65 : m_range(range), m_context(context), m_parsedProperties(parsedProperties) {
66 m_range.consumeWhitespace(); 66 m_range.consumeWhitespace();
67 } 67 }
68 68
69 void CSSPropertyParser::addProperty(CSSPropertyID property, 69 void CSSPropertyParser::addProperty(CSSPropertyID property,
70 CSSPropertyID currentShorthand, 70 CSSPropertyID currentShorthand,
71 const CSSValue& value, 71 const CSSValue& value,
72 bool important, 72 bool important,
73 bool implicit) { 73 bool implicit) {
74 ASSERT(!isPropertyAlias(property)); 74 DCHECK(!isPropertyAlias(property));
75 75
76 int shorthandIndex = 0; 76 int shorthandIndex = 0;
77 bool setFromShorthand = false; 77 bool setFromShorthand = false;
78 78
79 if (currentShorthand) { 79 if (currentShorthand) {
80 Vector<StylePropertyShorthand, 4> shorthands; 80 Vector<StylePropertyShorthand, 4> shorthands;
81 getMatchingShorthandsForLonghand(property, &shorthands); 81 getMatchingShorthandsForLonghand(property, &shorthands);
82 setFromShorthand = true; 82 setFromShorthand = true;
83 if (shorthands.size() > 1) 83 if (shorthands.size() > 1)
84 shorthandIndex = 84 shorthandIndex =
85 indexOfShorthandForLonghand(currentShorthand, shorthands); 85 indexOfShorthandForLonghand(currentShorthand, shorthands);
86 } 86 }
87 87
88 m_parsedProperties->push_back(CSSProperty( 88 m_parsedProperties->push_back(CSSProperty(
89 property, value, important, setFromShorthand, shorthandIndex, implicit)); 89 property, value, important, setFromShorthand, shorthandIndex, implicit));
90 } 90 }
91 91
92 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, 92 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property,
93 const CSSValue& value, 93 const CSSValue& value,
94 bool important) { 94 bool important) {
95 const StylePropertyShorthand& shorthand = shorthandForProperty(property); 95 const StylePropertyShorthand& shorthand = shorthandForProperty(property);
96 unsigned shorthandLength = shorthand.length(); 96 unsigned shorthandLength = shorthand.length();
97 ASSERT(shorthandLength); 97 DCHECK(shorthandLength);
98 const CSSPropertyID* longhands = shorthand.properties(); 98 const CSSPropertyID* longhands = shorthand.properties();
99 for (unsigned i = 0; i < shorthandLength; ++i) 99 for (unsigned i = 0; i < shorthandLength; ++i)
100 addProperty(longhands[i], property, value, important); 100 addProperty(longhands[i], property, value, important);
101 } 101 }
102 102
103 bool CSSPropertyParser::parseValue( 103 bool CSSPropertyParser::parseValue(
104 CSSPropertyID unresolvedProperty, 104 CSSPropertyID unresolvedProperty,
105 bool important, 105 bool important,
106 const CSSParserTokenRange& range, 106 const CSSParserTokenRange& range,
107 const CSSParserContext* context, 107 const CSSParserContext* context,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 if (unresolvedProperty != CSSPropertyInvalid && 377 if (unresolvedProperty != CSSPropertyInvalid &&
378 unresolvedProperty != CSSPropertyVariable) { 378 unresolvedProperty != CSSPropertyVariable) {
379 DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty)); 379 DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
380 range.consumeIncludingWhitespace(); 380 range.consumeIncludingWhitespace();
381 return CSSCustomIdentValue::create(unresolvedProperty); 381 return CSSCustomIdentValue::create(unresolvedProperty);
382 } 382 }
383 return consumeCustomIdent(range); 383 return consumeCustomIdent(range);
384 } 384 }
385 385
386 static CSSValue* consumeSteps(CSSParserTokenRange& range) { 386 static CSSValue* consumeSteps(CSSParserTokenRange& range) {
387 ASSERT(range.peek().functionId() == CSSValueSteps); 387 DCHECK_EQ(range.peek().functionId(), CSSValueSteps);
388 CSSParserTokenRange rangeCopy = range; 388 CSSParserTokenRange rangeCopy = range;
389 CSSParserTokenRange args = consumeFunction(rangeCopy); 389 CSSParserTokenRange args = consumeFunction(rangeCopy);
390 390
391 CSSPrimitiveValue* steps = consumePositiveInteger(args); 391 CSSPrimitiveValue* steps = consumePositiveInteger(args);
392 if (!steps) 392 if (!steps)
393 return nullptr; 393 return nullptr;
394 394
395 StepsTimingFunction::StepPosition position = 395 StepsTimingFunction::StepPosition position =
396 StepsTimingFunction::StepPosition::END; 396 StepsTimingFunction::StepPosition::END;
397 if (consumeCommaIncludingWhitespace(args)) { 397 if (consumeCommaIncludingWhitespace(args)) {
(...skipping 15 matching lines...) Expand all
413 } 413 }
414 414
415 if (!args.atEnd()) 415 if (!args.atEnd())
416 return nullptr; 416 return nullptr;
417 417
418 range = rangeCopy; 418 range = rangeCopy;
419 return CSSStepsTimingFunctionValue::create(steps->getIntValue(), position); 419 return CSSStepsTimingFunctionValue::create(steps->getIntValue(), position);
420 } 420 }
421 421
422 static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) { 422 static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) {
423 ASSERT(range.peek().functionId() == CSSValueCubicBezier); 423 DCHECK_EQ(range.peek().functionId(), CSSValueCubicBezier);
424 CSSParserTokenRange rangeCopy = range; 424 CSSParserTokenRange rangeCopy = range;
425 CSSParserTokenRange args = consumeFunction(rangeCopy); 425 CSSParserTokenRange args = consumeFunction(rangeCopy);
426 426
427 double x1, y1, x2, y2; 427 double x1, y1, x2, y2;
428 if (consumeNumberRaw(args, x1) && x1 >= 0 && x1 <= 1 && 428 if (consumeNumberRaw(args, x1) && x1 >= 0 && x1 <= 1 &&
429 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, y1) && 429 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, y1) &&
430 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, x2) && 430 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, x2) &&
431 x2 >= 0 && x2 <= 1 && consumeCommaIncludingWhitespace(args) && 431 x2 >= 0 && x2 <= 1 && consumeCommaIncludingWhitespace(args) &&
432 consumeNumberRaw(args, y2) && args.atEnd()) { 432 consumeNumberRaw(args, y2) && args.atEnd()) {
433 range = rangeCopy; 433 range = rangeCopy;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 case CSSPropertyAnimationName: 475 case CSSPropertyAnimationName:
476 return consumeAnimationName(range, context, useLegacyParsing); 476 return consumeAnimationName(range, context, useLegacyParsing);
477 case CSSPropertyAnimationPlayState: 477 case CSSPropertyAnimationPlayState:
478 return consumeIdent<CSSValueRunning, CSSValuePaused>(range); 478 return consumeIdent<CSSValueRunning, CSSValuePaused>(range);
479 case CSSPropertyTransitionProperty: 479 case CSSPropertyTransitionProperty:
480 return consumeTransitionProperty(range); 480 return consumeTransitionProperty(range);
481 case CSSPropertyAnimationTimingFunction: 481 case CSSPropertyAnimationTimingFunction:
482 case CSSPropertyTransitionTimingFunction: 482 case CSSPropertyTransitionTimingFunction:
483 return consumeAnimationTimingFunction(range); 483 return consumeAnimationTimingFunction(range);
484 default: 484 default:
485 ASSERT_NOT_REACHED(); 485 NOTREACHED();
486 return nullptr; 486 return nullptr;
487 } 487 }
488 } 488 }
489 489
490 static bool isValidAnimationPropertyList(CSSPropertyID property, 490 static bool isValidAnimationPropertyList(CSSPropertyID property,
491 const CSSValueList& valueList) { 491 const CSSValueList& valueList) {
492 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) 492 if (property != CSSPropertyTransitionProperty || valueList.length() < 2)
493 return true; 493 return true;
494 for (auto& value : valueList) { 494 for (auto& value : valueList) {
495 if (value->isIdentifierValue() && 495 if (value->isIdentifierValue() &&
(...skipping 11 matching lines...) Expand all
507 CSSValueList* list = CSSValueList::createCommaSeparated(); 507 CSSValueList* list = CSSValueList::createCommaSeparated();
508 do { 508 do {
509 CSSValue* value = 509 CSSValue* value =
510 consumeAnimationValue(property, range, context, useLegacyParsing); 510 consumeAnimationValue(property, range, context, useLegacyParsing);
511 if (!value) 511 if (!value)
512 return nullptr; 512 return nullptr;
513 list->append(*value); 513 list->append(*value);
514 } while (consumeCommaIncludingWhitespace(range)); 514 } while (consumeCommaIncludingWhitespace(range));
515 if (!isValidAnimationPropertyList(property, *list)) 515 if (!isValidAnimationPropertyList(property, *list))
516 return nullptr; 516 return nullptr;
517 ASSERT(list->length()); 517 DCHECK(list->length());
518 return list; 518 return list;
519 } 519 }
520 520
521 bool CSSPropertyParser::consumeAnimationShorthand( 521 bool CSSPropertyParser::consumeAnimationShorthand(
522 const StylePropertyShorthand& shorthand, 522 const StylePropertyShorthand& shorthand,
523 bool useLegacyParsing, 523 bool useLegacyParsing,
524 bool important) { 524 bool important) {
525 const unsigned longhandCount = shorthand.length(); 525 const unsigned longhandCount = shorthand.length();
526 CSSValueList* longhands[8]; 526 CSSValueList* longhands[8];
527 ASSERT(longhandCount <= 8); 527 DCHECK_LE(longhandCount, static_cast<unsigned>(8));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(8) -> 8u
nikhil.sahni 2017/03/30 12:17:58 Done.
528 for (size_t i = 0; i < longhandCount; ++i) 528 for (size_t i = 0; i < longhandCount; ++i)
529 longhands[i] = CSSValueList::createCommaSeparated(); 529 longhands[i] = CSSValueList::createCommaSeparated();
530 530
531 do { 531 do {
532 bool parsedLonghand[8] = {false}; 532 bool parsedLonghand[8] = {false};
533 do { 533 do {
534 bool foundProperty = false; 534 bool foundProperty = false;
535 for (size_t i = 0; i < longhandCount; ++i) { 535 for (size_t i = 0; i < longhandCount; ++i) {
536 if (parsedLonghand[i]) 536 if (parsedLonghand[i])
537 continue; 537 continue;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 continue; 1191 continue;
1192 } 1192 }
1193 if (!repeat) { 1193 if (!repeat) {
1194 repeat = consumeBorderImageRepeat(range); 1194 repeat = consumeBorderImageRepeat(range);
1195 if (repeat) 1195 if (repeat)
1196 continue; 1196 continue;
1197 } 1197 }
1198 if (!slice) { 1198 if (!slice) {
1199 slice = consumeBorderImageSlice(property, range); 1199 slice = consumeBorderImageSlice(property, range);
1200 if (slice) { 1200 if (slice) {
1201 ASSERT(!width && !outset); 1201 DCHECK(!width);
1202 DCHECK(!outset);
1202 if (consumeSlashIncludingWhitespace(range)) { 1203 if (consumeSlashIncludingWhitespace(range)) {
1203 width = consumeBorderImageWidth(range); 1204 width = consumeBorderImageWidth(range);
1204 if (consumeSlashIncludingWhitespace(range)) { 1205 if (consumeSlashIncludingWhitespace(range)) {
1205 outset = consumeBorderImageOutset(range); 1206 outset = consumeBorderImageOutset(range);
1206 if (!outset) 1207 if (!outset)
1207 return false; 1208 return false;
1208 } else if (!width) { 1209 } else if (!width) {
1209 return false; 1210 return false;
1210 } 1211 }
1211 } 1212 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 static CSSValue* consumeBackgroundBox(CSSParserTokenRange& range) { 1277 static CSSValue* consumeBackgroundBox(CSSParserTokenRange& range) {
1277 return consumeIdent<CSSValueBorderBox, CSSValuePaddingBox, 1278 return consumeIdent<CSSValueBorderBox, CSSValuePaddingBox,
1278 CSSValueContentBox>(range); 1279 CSSValueContentBox>(range);
1279 } 1280 }
1280 1281
1281 static CSSValue* consumeBackgroundComposite(CSSParserTokenRange& range) { 1282 static CSSValue* consumeBackgroundComposite(CSSParserTokenRange& range) {
1282 return consumeIdentRange(range, CSSValueClear, CSSValuePlusLighter); 1283 return consumeIdentRange(range, CSSValueClear, CSSValuePlusLighter);
1283 } 1284 }
1284 1285
1285 static CSSValue* consumeMaskSourceType(CSSParserTokenRange& range) { 1286 static CSSValue* consumeMaskSourceType(CSSParserTokenRange& range) {
1286 ASSERT(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); 1287 DCHECK(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled());
1287 return consumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range); 1288 return consumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range);
1288 } 1289 }
1289 1290
1290 static CSSValue* consumePrefixedBackgroundBox(CSSPropertyID property, 1291 static CSSValue* consumePrefixedBackgroundBox(CSSPropertyID property,
1291 CSSParserTokenRange& range, 1292 CSSParserTokenRange& range,
1292 const CSSParserContext* context) { 1293 const CSSParserContext* context) {
1293 // The values 'border', 'padding' and 'content' are deprecated and do not 1294 // The values 'border', 'padding' and 'content' are deprecated and do not
1294 // apply to the version of the property that has the -webkit- prefix removed. 1295 // apply to the version of the property that has the -webkit- prefix removed.
1295 if (CSSValue* value = 1296 if (CSSValue* value =
1296 consumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox)) 1297 consumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox))
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 CSSPrimitiveValue::UnitType::Integer); 1472 CSSPrimitiveValue::UnitType::Integer);
1472 } 1473 }
1473 1474
1474 CSSValueList* values = CSSValueList::createSpaceSeparated(); 1475 CSSValueList* values = CSSValueList::createSpaceSeparated();
1475 if (spanValue) 1476 if (spanValue)
1476 values->append(*spanValue); 1477 values->append(*spanValue);
1477 if (numericValue) 1478 if (numericValue)
1478 values->append(*numericValue); 1479 values->append(*numericValue);
1479 if (gridLineName) 1480 if (gridLineName)
1480 values->append(*gridLineName); 1481 values->append(*gridLineName);
1481 ASSERT(values->length()); 1482 DCHECK(values->length());
1482 return values; 1483 return values;
1483 } 1484 }
1484 1485
1485 static bool isGridBreadthFixedSized(const CSSValue& value) { 1486 static bool isGridBreadthFixedSized(const CSSValue& value) {
1486 if (value.isIdentifierValue()) { 1487 if (value.isIdentifierValue()) {
1487 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); 1488 CSSValueID valueID = toCSSIdentifierValue(value).getValueID();
1488 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent || 1489 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent ||
1489 valueID == CSSValueAuto); 1490 valueID == CSSValueAuto);
1490 } 1491 }
1491 1492
(...skipping 14 matching lines...) Expand all
1506 if (function.functionType() == CSSValueFitContent) 1507 if (function.functionType() == CSSValueFitContent)
1507 return false; 1508 return false;
1508 1509
1509 const CSSValue& minValue = function.item(0); 1510 const CSSValue& minValue = function.item(0);
1510 const CSSValue& maxValue = function.item(1); 1511 const CSSValue& maxValue = function.item(1);
1511 return isGridBreadthFixedSized(minValue) || isGridBreadthFixedSized(maxValue); 1512 return isGridBreadthFixedSized(minValue) || isGridBreadthFixedSized(maxValue);
1512 } 1513 }
1513 1514
1514 static Vector<String> parseGridTemplateAreasColumnNames( 1515 static Vector<String> parseGridTemplateAreasColumnNames(
1515 const String& gridRowNames) { 1516 const String& gridRowNames) {
1516 ASSERT(!gridRowNames.isEmpty()); 1517 DCHECK(!gridRowNames.isEmpty());
1517 Vector<String> columnNames; 1518 Vector<String> columnNames;
1518 // Using StringImpl to avoid checks and indirection in every call to 1519 // Using StringImpl to avoid checks and indirection in every call to
1519 // String::operator[]. 1520 // String::operator[].
1520 StringImpl& text = *gridRowNames.impl(); 1521 StringImpl& text = *gridRowNames.impl();
1521 1522
1522 StringBuilder areaName; 1523 StringBuilder areaName;
1523 for (unsigned i = 0; i < text.length(); ++i) { 1524 for (unsigned i = 0; i < text.length(); ++i) {
1524 if (isCSSSpace(text[i])) { 1525 if (isCSSSpace(text[i])) {
1525 if (!areaName.isEmpty()) { 1526 if (!areaName.isEmpty()) {
1526 columnNames.push_back(areaName.toString()); 1527 columnNames.push_back(areaName.toString());
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 while (range.peek().type() == StringToken) { 1814 while (range.peek().type() == StringToken) {
1814 if (!parseGridTemplateAreasRow( 1815 if (!parseGridTemplateAreasRow(
1815 range.consumeIncludingWhitespace().value().toString(), gridAreaMap, 1816 range.consumeIncludingWhitespace().value().toString(), gridAreaMap,
1816 rowCount, columnCount)) 1817 rowCount, columnCount))
1817 return nullptr; 1818 return nullptr;
1818 ++rowCount; 1819 ++rowCount;
1819 } 1820 }
1820 1821
1821 if (rowCount == 0) 1822 if (rowCount == 0)
1822 return nullptr; 1823 return nullptr;
1823 ASSERT(columnCount); 1824 DCHECK(columnCount);
1824 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); 1825 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount);
1825 } 1826 }
1826 1827
1827 static void countKeywordOnlyPropertyUsage(CSSPropertyID property, 1828 static void countKeywordOnlyPropertyUsage(CSSPropertyID property,
1828 const CSSParserContext* context, 1829 const CSSParserContext* context,
1829 CSSValueID valueID) { 1830 CSSValueID valueID) {
1830 if (!context->isUseCounterRecordingEnabled()) 1831 if (!context->isUseCounterRecordingEnabled())
1831 return; 1832 return;
1832 switch (property) { 1833 switch (property) {
1833 case CSSPropertyWebkitAppearance: { 1834 case CSSPropertyWebkitAppearance: {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 return consumeBorderWidth(m_range, m_context->mode(), unitless); 1993 return consumeBorderWidth(m_range, m_context->mode(), unitless);
1993 } 1994 }
1994 case CSSPropertyTextShadow: 1995 case CSSPropertyTextShadow:
1995 case CSSPropertyBoxShadow: 1996 case CSSPropertyBoxShadow:
1996 return consumeShadow(m_range, m_context->mode(), 1997 return consumeShadow(m_range, m_context->mode(),
1997 property == CSSPropertyBoxShadow); 1998 property == CSSPropertyBoxShadow);
1998 case CSSPropertyFilter: 1999 case CSSPropertyFilter:
1999 case CSSPropertyBackdropFilter: 2000 case CSSPropertyBackdropFilter:
2000 return consumeFilter(m_range, m_context); 2001 return consumeFilter(m_range, m_context);
2001 case CSSPropertyTextDecoration: 2002 case CSSPropertyTextDecoration:
2002 ASSERT(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); 2003 DCHECK(!RuntimeEnabledFeatures::css3TextDecorationsEnabled());
2003 // fallthrough 2004 // fallthrough
2004 case CSSPropertyWebkitTextDecorationsInEffect: 2005 case CSSPropertyWebkitTextDecorationsInEffect:
2005 case CSSPropertyTextDecorationLine: 2006 case CSSPropertyTextDecorationLine:
2006 return consumeTextDecorationLine(m_range); 2007 return consumeTextDecorationLine(m_range);
2007 case CSSPropertyD: 2008 case CSSPropertyD:
2008 return consumePathOrNone(m_range); 2009 return consumePathOrNone(m_range);
2009 case CSSPropertyOffsetPath: 2010 case CSSPropertyOffsetPath:
2010 return consumeOffsetPath( 2011 return consumeOffsetPath(
2011 m_range, m_context, 2012 m_range, m_context,
2012 currentShorthand == CSSPropertyMotion || 2013 currentShorthand == CSSPropertyMotion ||
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 case CSSPropertyR: 2050 case CSSPropertyR:
2050 return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll, 2051 return consumeLengthOrPercent(m_range, SVGAttributeMode, ValueRangeAll,
2051 UnitlessQuirk::Forbid); 2052 UnitlessQuirk::Forbid);
2052 case CSSPropertyPerspective: 2053 case CSSPropertyPerspective:
2053 return consumePerspective(m_range, m_context, unresolvedProperty); 2054 return consumePerspective(m_range, m_context, unresolvedProperty);
2054 case CSSPropertyScrollSnapPointsX: 2055 case CSSPropertyScrollSnapPointsX:
2055 case CSSPropertyScrollSnapPointsY: 2056 case CSSPropertyScrollSnapPointsY:
2056 return consumeScrollSnapPoints(m_range, m_context->mode()); 2057 return consumeScrollSnapPoints(m_range, m_context->mode());
2057 case CSSPropertyJustifyContent: 2058 case CSSPropertyJustifyContent:
2058 case CSSPropertyAlignContent: 2059 case CSSPropertyAlignContent:
2059 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2060 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2060 return consumeContentDistributionOverflowPosition(m_range); 2061 return consumeContentDistributionOverflowPosition(m_range);
2061 case CSSPropertyBorderImageRepeat: 2062 case CSSPropertyBorderImageRepeat:
2062 case CSSPropertyWebkitMaskBoxImageRepeat: 2063 case CSSPropertyWebkitMaskBoxImageRepeat:
2063 return consumeBorderImageRepeat(m_range); 2064 return consumeBorderImageRepeat(m_range);
2064 case CSSPropertyBorderImageSlice: 2065 case CSSPropertyBorderImageSlice:
2065 case CSSPropertyWebkitMaskBoxImageSlice: 2066 case CSSPropertyWebkitMaskBoxImageSlice:
2066 return consumeBorderImageSlice(property, m_range); 2067 return consumeBorderImageSlice(property, m_range);
2067 case CSSPropertyBorderImageOutset: 2068 case CSSPropertyBorderImageOutset:
2068 case CSSPropertyWebkitMaskBoxImageOutset: 2069 case CSSPropertyWebkitMaskBoxImageOutset:
2069 return consumeBorderImageOutset(m_range); 2070 return consumeBorderImageOutset(m_range);
(...skipping 24 matching lines...) Expand all
2094 case CSSPropertyWebkitMaskSize: 2095 case CSSPropertyWebkitMaskSize:
2095 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, 2096 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty,
2096 m_range, m_context); 2097 m_range, m_context);
2097 case CSSPropertyWebkitMaskRepeatX: 2098 case CSSPropertyWebkitMaskRepeatX:
2098 case CSSPropertyWebkitMaskRepeatY: 2099 case CSSPropertyWebkitMaskRepeatY:
2099 return nullptr; 2100 return nullptr;
2100 case CSSPropertyGridColumnEnd: 2101 case CSSPropertyGridColumnEnd:
2101 case CSSPropertyGridColumnStart: 2102 case CSSPropertyGridColumnStart:
2102 case CSSPropertyGridRowEnd: 2103 case CSSPropertyGridRowEnd:
2103 case CSSPropertyGridRowStart: 2104 case CSSPropertyGridRowStart:
2104 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2105 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2105 return consumeGridLine(m_range); 2106 return consumeGridLine(m_range);
2106 case CSSPropertyGridAutoColumns: 2107 case CSSPropertyGridAutoColumns:
2107 case CSSPropertyGridAutoRows: 2108 case CSSPropertyGridAutoRows:
2108 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2109 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2109 return consumeGridTrackList(m_range, m_context->mode(), GridAuto); 2110 return consumeGridTrackList(m_range, m_context->mode(), GridAuto);
2110 case CSSPropertyGridTemplateColumns: 2111 case CSSPropertyGridTemplateColumns:
2111 case CSSPropertyGridTemplateRows: 2112 case CSSPropertyGridTemplateRows:
2112 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2113 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2113 return consumeGridTemplatesRowsOrColumns(m_range, m_context->mode()); 2114 return consumeGridTemplatesRowsOrColumns(m_range, m_context->mode());
2114 case CSSPropertyGridTemplateAreas: 2115 case CSSPropertyGridTemplateAreas:
2115 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 2116 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
2116 return consumeGridTemplateAreas(m_range); 2117 return consumeGridTemplateAreas(m_range);
2117 default: 2118 default:
2118 return nullptr; 2119 return nullptr;
2119 } 2120 }
2120 } 2121 }
2121 2122
2122 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) { 2123 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) {
2123 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, 2124 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap,
2124 CSSValueFallback, CSSValueOptional>(range); 2125 CSSValueFallback, CSSValueOptional>(range);
2125 } 2126 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2247 2248
2248 if (!parsedValue || !m_range.atEnd()) 2249 if (!parsedValue || !m_range.atEnd())
2249 return false; 2250 return false;
2250 2251
2251 addProperty(propId, CSSPropertyInvalid, *parsedValue, false); 2252 addProperty(propId, CSSPropertyInvalid, *parsedValue, false);
2252 return true; 2253 return true;
2253 } 2254 }
2254 2255
2255 bool CSSPropertyParser::consumeSystemFont(bool important) { 2256 bool CSSPropertyParser::consumeSystemFont(bool important) {
2256 CSSValueID systemFontID = m_range.consumeIncludingWhitespace().id(); 2257 CSSValueID systemFontID = m_range.consumeIncludingWhitespace().id();
2257 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar); 2258 DCHECK_GE(systemFontID, CSSValueCaption);
2259 DCHECK_LE(systemFontID, CSSValueStatusBar);
2258 if (!m_range.atEnd()) 2260 if (!m_range.atEnd())
2259 return false; 2261 return false;
2260 2262
2261 FontStyle fontStyle = FontStyleNormal; 2263 FontStyle fontStyle = FontStyleNormal;
2262 FontWeight fontWeight = FontWeightNormal; 2264 FontWeight fontWeight = FontWeightNormal;
2263 float fontSize = 0; 2265 float fontSize = 0;
2264 AtomicString fontFamily; 2266 AtomicString fontFamily;
2265 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSize, 2267 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSize,
2266 fontFamily); 2268 fontFamily);
2267 2269
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 if (parsedValue) 2496 if (parsedValue)
2495 return parsedValue; 2497 return parsedValue;
2496 return consumePercent(range, ValueRangeNonNegative); 2498 return consumePercent(range, ValueRangeNonNegative);
2497 } 2499 }
2498 case CSSPropertyUserZoom: 2500 case CSSPropertyUserZoom:
2499 return consumeIdent<CSSValueZoom, CSSValueFixed>(range); 2501 return consumeIdent<CSSValueZoom, CSSValueFixed>(range);
2500 case CSSPropertyOrientation: 2502 case CSSPropertyOrientation:
2501 return consumeIdent<CSSValueAuto, CSSValuePortrait, CSSValueLandscape>( 2503 return consumeIdent<CSSValueAuto, CSSValuePortrait, CSSValueLandscape>(
2502 range); 2504 range);
2503 default: 2505 default:
2504 ASSERT_NOT_REACHED(); 2506 NOTREACHED();
2505 break; 2507 break;
2506 } 2508 }
2507 2509
2508 ASSERT_NOT_REACHED(); 2510 NOTREACHED();
2509 return nullptr; 2511 return nullptr;
2510 } 2512 }
2511 2513
2512 bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, 2514 bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId,
2513 bool important) { 2515 bool important) {
2514 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || 2516 DCHECK(RuntimeEnabledFeatures::cssViewportEnabled() ||
2515 isUASheetBehavior(m_context->mode())); 2517 isUASheetBehavior(m_context->mode()));
2516 2518
2517 switch (propId) { 2519 switch (propId) {
2518 case CSSPropertyWidth: { 2520 case CSSPropertyWidth: {
2519 CSSValue* minWidth = consumeSingleViewportDescriptor( 2521 CSSValue* minWidth = consumeSingleViewportDescriptor(
2520 m_range, CSSPropertyMinWidth, m_context->mode()); 2522 m_range, CSSPropertyMinWidth, m_context->mode());
2521 if (!minWidth) 2523 if (!minWidth)
2522 return false; 2524 return false;
2523 CSSValue* maxWidth = minWidth; 2525 CSSValue* maxWidth = minWidth;
2524 if (!m_range.atEnd()) { 2526 if (!m_range.atEnd()) {
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2728 addExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); 2730 addExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important);
2729 addExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); 2731 addExpandedPropertyForValue(CSSPropertyBorderColor, *color, important);
2730 addExpandedPropertyForValue(CSSPropertyBorderImage, 2732 addExpandedPropertyForValue(CSSPropertyBorderImage,
2731 *CSSInitialValue::create(), important); 2733 *CSSInitialValue::create(), important);
2732 2734
2733 return m_range.atEnd(); 2735 return m_range.atEnd();
2734 } 2736 }
2735 2737
2736 bool CSSPropertyParser::consume4Values(const StylePropertyShorthand& shorthand, 2738 bool CSSPropertyParser::consume4Values(const StylePropertyShorthand& shorthand,
2737 bool important) { 2739 bool important) {
2738 ASSERT(shorthand.length() == 4); 2740 DCHECK_EQ(shorthand.length(), static_cast<unsigned>(4));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(4) -> 4u
nikhil.sahni 2017/03/30 12:17:58 Done.
2739 const CSSPropertyID* longhands = shorthand.properties(); 2741 const CSSPropertyID* longhands = shorthand.properties();
2740 const CSSValue* top = parseSingleValue(longhands[0], shorthand.id()); 2742 const CSSValue* top = parseSingleValue(longhands[0], shorthand.id());
2741 if (!top) 2743 if (!top)
2742 return false; 2744 return false;
2743 2745
2744 const CSSValue* right = parseSingleValue(longhands[1], shorthand.id()); 2746 const CSSValue* right = parseSingleValue(longhands[1], shorthand.id());
2745 const CSSValue* bottom = nullptr; 2747 const CSSValue* bottom = nullptr;
2746 const CSSValue* left = nullptr; 2748 const CSSValue* left = nullptr;
2747 if (right) { 2749 if (right) {
2748 bottom = parseSingleValue(longhands[2], shorthand.id()); 2750 bottom = parseSingleValue(longhands[2], shorthand.id());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2798 addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, 2800 addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage,
2799 slice ? *slice : *CSSInitialValue::create(), important); 2801 slice ? *slice : *CSSInitialValue::create(), important);
2800 addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, 2802 addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage,
2801 width ? *width : *CSSInitialValue::create(), important); 2803 width ? *width : *CSSInitialValue::create(), important);
2802 addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, 2804 addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage,
2803 outset ? *outset : *CSSInitialValue::create(), important); 2805 outset ? *outset : *CSSInitialValue::create(), important);
2804 addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, 2806 addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage,
2805 repeat ? *repeat : *CSSInitialValue::create(), important); 2807 repeat ? *repeat : *CSSInitialValue::create(), important);
2806 return true; 2808 return true;
2807 default: 2809 default:
2808 ASSERT_NOT_REACHED(); 2810 NOTREACHED();
2809 return false; 2811 return false;
2810 } 2812 }
2811 } 2813 }
2812 return false; 2814 return false;
2813 } 2815 }
2814 2816
2815 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value) { 2817 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value) {
2816 if (value == CSSValueAlways) 2818 if (value == CSSValueAlways)
2817 return CSSValuePage; 2819 return CSSValuePage;
2818 if (value == CSSValueAuto || value == CSSValueAvoid || 2820 if (value == CSSValueAuto || value == CSSValueAvoid ||
(...skipping 16 matching lines...) Expand all
2835 return CSSValueInvalid; 2837 return CSSValueInvalid;
2836 } 2838 }
2837 2839
2838 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) { 2840 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) {
2839 if (property == CSSPropertyPageBreakAfter || 2841 if (property == CSSPropertyPageBreakAfter ||
2840 property == CSSPropertyWebkitColumnBreakAfter) 2842 property == CSSPropertyWebkitColumnBreakAfter)
2841 return CSSPropertyBreakAfter; 2843 return CSSPropertyBreakAfter;
2842 if (property == CSSPropertyPageBreakBefore || 2844 if (property == CSSPropertyPageBreakBefore ||
2843 property == CSSPropertyWebkitColumnBreakBefore) 2845 property == CSSPropertyWebkitColumnBreakBefore)
2844 return CSSPropertyBreakBefore; 2846 return CSSPropertyBreakBefore;
2845 ASSERT(property == CSSPropertyPageBreakInside || 2847 DCHECK(property == CSSPropertyPageBreakInside ||
2846 property == CSSPropertyWebkitColumnBreakInside); 2848 property == CSSPropertyWebkitColumnBreakInside);
2847 return CSSPropertyBreakInside; 2849 return CSSPropertyBreakInside;
2848 } 2850 }
2849 2851
2850 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, 2852 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property,
2851 bool important) { 2853 bool important) {
2852 // The fragmentation spec says that page-break-(after|before|inside) are to be 2854 // The fragmentation spec says that page-break-(after|before|inside) are to be
2853 // treated as shorthands for their break-(after|before|inside) counterparts. 2855 // treated as shorthands for their break-(after|before|inside) counterparts.
2854 // We'll do the same for the non-standard properties 2856 // We'll do the same for the non-standard properties
2855 // -webkit-column-break-(after|before|inside). 2857 // -webkit-column-break-(after|before|inside).
(...skipping 10 matching lines...) Expand all
2866 break; 2868 break;
2867 case CSSPropertyWebkitColumnBreakAfter: 2869 case CSSPropertyWebkitColumnBreakAfter:
2868 case CSSPropertyWebkitColumnBreakBefore: 2870 case CSSPropertyWebkitColumnBreakBefore:
2869 value = mapFromColumnBreakBetween(value); 2871 value = mapFromColumnBreakBetween(value);
2870 break; 2872 break;
2871 case CSSPropertyPageBreakInside: 2873 case CSSPropertyPageBreakInside:
2872 case CSSPropertyWebkitColumnBreakInside: 2874 case CSSPropertyWebkitColumnBreakInside:
2873 value = mapFromColumnOrPageBreakInside(value); 2875 value = mapFromColumnOrPageBreakInside(value);
2874 break; 2876 break;
2875 default: 2877 default:
2876 ASSERT_NOT_REACHED(); 2878 NOTREACHED();
2877 } 2879 }
2878 if (value == CSSValueInvalid) 2880 if (value == CSSValueInvalid)
2879 return false; 2881 return false;
2880 2882
2881 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); 2883 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property);
2882 addProperty(genericBreakProperty, property, 2884 addProperty(genericBreakProperty, property,
2883 *CSSIdentifierValue::create(value), important); 2885 *CSSIdentifierValue::create(value), important);
2884 return true; 2886 return true;
2885 } 2887 }
2886 2888
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2946 return true; 2948 return true;
2947 } 2949 }
2948 2950
2949 // Note: consumeBackgroundShorthand assumes y properties (for example 2951 // Note: consumeBackgroundShorthand assumes y properties (for example
2950 // background-position-y) follow the x properties in the shorthand array. 2952 // background-position-y) follow the x properties in the shorthand array.
2951 bool CSSPropertyParser::consumeBackgroundShorthand( 2953 bool CSSPropertyParser::consumeBackgroundShorthand(
2952 const StylePropertyShorthand& shorthand, 2954 const StylePropertyShorthand& shorthand,
2953 bool important) { 2955 bool important) {
2954 const unsigned longhandCount = shorthand.length(); 2956 const unsigned longhandCount = shorthand.length();
2955 CSSValue* longhands[10] = {0}; 2957 CSSValue* longhands[10] = {0};
2956 ASSERT(longhandCount <= 10); 2958 DCHECK_LE(longhandCount, static_cast<unsigned>(10));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(10) -> 10u
nikhil.sahni 2017/03/30 12:17:58 Done.
2957 2959
2958 bool implicit = false; 2960 bool implicit = false;
2959 do { 2961 do {
2960 bool parsedLonghand[10] = {false}; 2962 bool parsedLonghand[10] = {false};
2961 CSSValue* originValue = nullptr; 2963 CSSValue* originValue = nullptr;
2962 do { 2964 do {
2963 bool foundProperty = false; 2965 bool foundProperty = false;
2964 for (size_t i = 0; i < longhandCount; ++i) { 2966 for (size_t i = 0; i < longhandCount; ++i) {
2965 if (parsedLonghand[i]) 2967 if (parsedLonghand[i])
2966 continue; 2968 continue;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 m_context->useLegacyBackgroundSizeShorthandBehavior()) 3038 m_context->useLegacyBackgroundSizeShorthandBehavior())
3037 continue; 3039 continue;
3038 addProperty(property, shorthand.id(), *longhands[i], important, implicit); 3040 addProperty(property, shorthand.id(), *longhands[i], important, implicit);
3039 } 3041 }
3040 return true; 3042 return true;
3041 } 3043 }
3042 3044
3043 bool CSSPropertyParser::consumeGridItemPositionShorthand( 3045 bool CSSPropertyParser::consumeGridItemPositionShorthand(
3044 CSSPropertyID shorthandId, 3046 CSSPropertyID shorthandId,
3045 bool important) { 3047 bool important) {
3046 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3048 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3047 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); 3049 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId);
3048 ASSERT(shorthand.length() == 2); 3050 DCHECK_EQ(shorthand.length(), static_cast<unsigned>(2));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(2) -> 2u
nikhil.sahni 2017/03/30 12:17:58 Done.
3049 CSSValue* startValue = consumeGridLine(m_range); 3051 CSSValue* startValue = consumeGridLine(m_range);
3050 if (!startValue) 3052 if (!startValue)
3051 return false; 3053 return false;
3052 3054
3053 CSSValue* endValue = nullptr; 3055 CSSValue* endValue = nullptr;
3054 if (consumeSlashIncludingWhitespace(m_range)) { 3056 if (consumeSlashIncludingWhitespace(m_range)) {
3055 endValue = consumeGridLine(m_range); 3057 endValue = consumeGridLine(m_range);
3056 if (!endValue) 3058 if (!endValue)
3057 return false; 3059 return false;
3058 } else { 3060 } else {
3059 endValue = startValue->isCustomIdentValue() 3061 endValue = startValue->isCustomIdentValue()
3060 ? startValue 3062 ? startValue
3061 : CSSIdentifierValue::create(CSSValueAuto); 3063 : CSSIdentifierValue::create(CSSValueAuto);
3062 } 3064 }
3063 if (!m_range.atEnd()) 3065 if (!m_range.atEnd())
3064 return false; 3066 return false;
3065 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); 3067 addProperty(shorthand.properties()[0], shorthandId, *startValue, important);
3066 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); 3068 addProperty(shorthand.properties()[1], shorthandId, *endValue, important);
3067 return true; 3069 return true;
3068 } 3070 }
3069 3071
3070 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) { 3072 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) {
3071 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3073 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3072 ASSERT(gridAreaShorthand().length() == 4); 3074 DCHECK_EQ(gridAreaShorthand().length(), static_cast<unsigned>(4));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(4) -> 4u
nikhil.sahni 2017/03/30 12:17:58 Done.
3073 CSSValue* rowStartValue = consumeGridLine(m_range); 3075 CSSValue* rowStartValue = consumeGridLine(m_range);
3074 if (!rowStartValue) 3076 if (!rowStartValue)
3075 return false; 3077 return false;
3076 CSSValue* columnStartValue = nullptr; 3078 CSSValue* columnStartValue = nullptr;
3077 CSSValue* rowEndValue = nullptr; 3079 CSSValue* rowEndValue = nullptr;
3078 CSSValue* columnEndValue = nullptr; 3080 CSSValue* columnEndValue = nullptr;
3079 if (consumeSlashIncludingWhitespace(m_range)) { 3081 if (consumeSlashIncludingWhitespace(m_range)) {
3080 columnStartValue = consumeGridLine(m_range); 3082 columnStartValue = consumeGridLine(m_range);
3081 if (!columnStartValue) 3083 if (!columnStartValue)
3082 return false; 3084 return false;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 important); 3180 important);
3179 addProperty( 3181 addProperty(
3180 CSSPropertyGridTemplateAreas, shorthandId, 3182 CSSPropertyGridTemplateAreas, shorthandId,
3181 *CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount), 3183 *CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount),
3182 important); 3184 important);
3183 return true; 3185 return true;
3184 } 3186 }
3185 3187
3186 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, 3188 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId,
3187 bool important) { 3189 bool important) {
3188 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3190 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3189 ASSERT(gridTemplateShorthand().length() == 3); 3191 DCHECK_EQ(gridTemplateShorthand().length(), static_cast<unsigned>(3));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(3) -> 3u
nikhil.sahni 2017/03/30 12:17:58 Done.
3190 3192
3191 CSSParserTokenRange rangeCopy = m_range; 3193 CSSParserTokenRange rangeCopy = m_range;
3192 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); 3194 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range);
3193 3195
3194 // 1- 'none' case. 3196 // 1- 'none' case.
3195 if (rowsValue && m_range.atEnd()) { 3197 if (rowsValue && m_range.atEnd()) {
3196 addProperty(CSSPropertyGridTemplateRows, shorthandId, 3198 addProperty(CSSPropertyGridTemplateRows, shorthandId,
3197 *CSSIdentifierValue::create(CSSValueNone), important); 3199 *CSSIdentifierValue::create(CSSValueNone), important);
3198 addProperty(CSSPropertyGridTemplateColumns, shorthandId, 3200 addProperty(CSSPropertyGridTemplateColumns, shorthandId,
3199 *CSSIdentifierValue::create(CSSValueNone), important); 3201 *CSSIdentifierValue::create(CSSValueNone), important);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 return nullptr; 3245 return nullptr;
3244 } 3246 }
3245 CSSValueList* list = CSSValueList::createSpaceSeparated(); 3247 CSSValueList* list = CSSValueList::createSpaceSeparated();
3246 list->append(flowDirection); 3248 list->append(flowDirection);
3247 if (denseAlgorithm) 3249 if (denseAlgorithm)
3248 list->append(*denseAlgorithm); 3250 list->append(*denseAlgorithm);
3249 return list; 3251 return list;
3250 } 3252 }
3251 3253
3252 bool CSSPropertyParser::consumeGridShorthand(bool important) { 3254 bool CSSPropertyParser::consumeGridShorthand(bool important) {
3253 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); 3255 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3254 ASSERT(shorthandForProperty(CSSPropertyGrid).length() == 8); 3256 DCHECK_EQ(shorthandForProperty(CSSPropertyGrid).length(),
3257 static_cast<unsigned>(8));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(8) -> 8u
nikhil.sahni 2017/03/30 12:17:58 Done.
3255 3258
3256 CSSParserTokenRange rangeCopy = m_range; 3259 CSSParserTokenRange rangeCopy = m_range;
3257 3260
3258 // 1- <grid-template> 3261 // 1- <grid-template>
3259 if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) { 3262 if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) {
3260 // It can only be specified the explicit or the implicit grid properties in 3263 // It can only be specified the explicit or the implicit grid properties in
3261 // a single grid declaration. The sub-properties not specified are set to 3264 // a single grid declaration. The sub-properties not specified are set to
3262 // their initial value, as normal for shorthands. 3265 // their initial value, as normal for shorthands.
3263 addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, 3266 addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid,
3264 *CSSInitialValue::create(), important); 3267 *CSSInitialValue::create(), important);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3490 case CSSPropertyColumns: 3493 case CSSPropertyColumns:
3491 return consumeColumns(important); 3494 return consumeColumns(important);
3492 case CSSPropertyAnimation: 3495 case CSSPropertyAnimation:
3493 return consumeAnimationShorthand( 3496 return consumeAnimationShorthand(
3494 animationShorthandForParsing(), 3497 animationShorthandForParsing(),
3495 unresolvedProperty == CSSPropertyAliasWebkitAnimation, important); 3498 unresolvedProperty == CSSPropertyAliasWebkitAnimation, important);
3496 case CSSPropertyTransition: 3499 case CSSPropertyTransition:
3497 return consumeAnimationShorthand(transitionShorthandForParsing(), false, 3500 return consumeAnimationShorthand(transitionShorthandForParsing(), false,
3498 important); 3501 important);
3499 case CSSPropertyTextDecoration: 3502 case CSSPropertyTextDecoration:
3500 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); 3503 DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
3501 return consumeShorthandGreedily(textDecorationShorthand(), important); 3504 return consumeShorthandGreedily(textDecorationShorthand(), important);
3502 case CSSPropertyMargin: 3505 case CSSPropertyMargin:
3503 return consume4Values(marginShorthand(), important); 3506 return consume4Values(marginShorthand(), important);
3504 case CSSPropertyPadding: 3507 case CSSPropertyPadding:
3505 return consume4Values(paddingShorthand(), important); 3508 return consume4Values(paddingShorthand(), important);
3506 case CSSPropertyMotion: 3509 case CSSPropertyMotion:
3507 return consumeShorthandGreedily(motionShorthand(), important); 3510 return consumeShorthandGreedily(motionShorthand(), important);
3508 case CSSPropertyOffset: 3511 case CSSPropertyOffset:
3509 return consumeOffsetShorthand(important); 3512 return consumeOffsetShorthand(important);
3510 case CSSPropertyWebkitTextEmphasis: 3513 case CSSPropertyWebkitTextEmphasis:
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 ? CSSPropertyBackgroundRepeatY 3627 ? CSSPropertyBackgroundRepeatY
3625 : CSSPropertyWebkitMaskRepeatY, 3628 : CSSPropertyWebkitMaskRepeatY,
3626 property, *resultY, important, implicit); 3629 property, *resultY, important, implicit);
3627 return true; 3630 return true;
3628 } 3631 }
3629 case CSSPropertyBackground: 3632 case CSSPropertyBackground:
3630 return consumeBackgroundShorthand(backgroundShorthand(), important); 3633 return consumeBackgroundShorthand(backgroundShorthand(), important);
3631 case CSSPropertyWebkitMask: 3634 case CSSPropertyWebkitMask:
3632 return consumeBackgroundShorthand(webkitMaskShorthand(), important); 3635 return consumeBackgroundShorthand(webkitMaskShorthand(), important);
3633 case CSSPropertyGridGap: { 3636 case CSSPropertyGridGap: {
3634 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled() && 3637 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3635 shorthandForProperty(CSSPropertyGridGap).length() == 2); 3638 DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), static_cast<u nsigned>(2));
tkent 2017/03/28 14:44:56 static_cast<unsigned>(2) -> 2u
nikhil.sahni 2017/03/30 12:17:58 Done.
3636 CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context->mode(), 3639 CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context->mode(),
3637 ValueRangeNonNegative); 3640 ValueRangeNonNegative);
3638 CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context->mode(), 3641 CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context->mode(),
3639 ValueRangeNonNegative); 3642 ValueRangeNonNegative);
3640 if (!rowGap || !m_range.atEnd()) 3643 if (!rowGap || !m_range.atEnd())
3641 return false; 3644 return false;
3642 if (!columnGap) 3645 if (!columnGap)
3643 columnGap = rowGap; 3646 columnGap = rowGap;
3644 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, *rowGap, 3647 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, *rowGap,
3645 important); 3648 important);
(...skipping 11 matching lines...) Expand all
3657 case CSSPropertyGrid: 3660 case CSSPropertyGrid:
3658 return consumeGridShorthand(important); 3661 return consumeGridShorthand(important);
3659 case CSSPropertyPlaceContent: 3662 case CSSPropertyPlaceContent:
3660 return consumePlaceContentShorthand(important); 3663 return consumePlaceContentShorthand(important);
3661 default: 3664 default:
3662 return false; 3665 return false;
3663 } 3666 }
3664 } 3667 }
3665 3668
3666 } // namespace blink 3669 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698