OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/css/parser/CSSPropertyParser.h" | 5 #include "core/css/parser/CSSPropertyParser.h" |
6 | 6 |
7 #include <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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 HeapVector<CSSProperty, 256>* parsedProperties) | 65 HeapVector<CSSProperty, 256>* parsedProperties) |
66 : m_range(range), m_context(context), m_parsedProperties(parsedProperties) { | 66 : m_range(range), m_context(context), m_parsedProperties(parsedProperties) { |
67 m_range.consumeWhitespace(); | 67 m_range.consumeWhitespace(); |
68 } | 68 } |
69 | 69 |
70 void CSSPropertyParser::addProperty(CSSPropertyID property, | 70 void CSSPropertyParser::addProperty(CSSPropertyID property, |
71 CSSPropertyID currentShorthand, | 71 CSSPropertyID currentShorthand, |
72 const CSSValue& value, | 72 const CSSValue& value, |
73 bool important, | 73 bool important, |
74 bool implicit) { | 74 bool implicit) { |
75 ASSERT(!isPropertyAlias(property)); | 75 DCHECK(!isPropertyAlias(property)); |
76 | 76 |
77 int shorthandIndex = 0; | 77 int shorthandIndex = 0; |
78 bool setFromShorthand = false; | 78 bool setFromShorthand = false; |
79 | 79 |
80 if (currentShorthand) { | 80 if (currentShorthand) { |
81 Vector<StylePropertyShorthand, 4> shorthands; | 81 Vector<StylePropertyShorthand, 4> shorthands; |
82 getMatchingShorthandsForLonghand(property, &shorthands); | 82 getMatchingShorthandsForLonghand(property, &shorthands); |
83 setFromShorthand = true; | 83 setFromShorthand = true; |
84 if (shorthands.size() > 1) | 84 if (shorthands.size() > 1) |
85 shorthandIndex = | 85 shorthandIndex = |
86 indexOfShorthandForLonghand(currentShorthand, shorthands); | 86 indexOfShorthandForLonghand(currentShorthand, shorthands); |
87 } | 87 } |
88 | 88 |
89 m_parsedProperties->push_back(CSSProperty( | 89 m_parsedProperties->push_back(CSSProperty( |
90 property, value, important, setFromShorthand, shorthandIndex, implicit)); | 90 property, value, important, setFromShorthand, shorthandIndex, implicit)); |
91 } | 91 } |
92 | 92 |
93 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, | 93 void CSSPropertyParser::addExpandedPropertyForValue(CSSPropertyID property, |
94 const CSSValue& value, | 94 const CSSValue& value, |
95 bool important) { | 95 bool important) { |
96 const StylePropertyShorthand& shorthand = shorthandForProperty(property); | 96 const StylePropertyShorthand& shorthand = shorthandForProperty(property); |
97 unsigned shorthandLength = shorthand.length(); | 97 unsigned shorthandLength = shorthand.length(); |
98 ASSERT(shorthandLength); | 98 DCHECK(shorthandLength); |
99 const CSSPropertyID* longhands = shorthand.properties(); | 99 const CSSPropertyID* longhands = shorthand.properties(); |
100 for (unsigned i = 0; i < shorthandLength; ++i) | 100 for (unsigned i = 0; i < shorthandLength; ++i) |
101 addProperty(longhands[i], property, value, important); | 101 addProperty(longhands[i], property, value, important); |
102 } | 102 } |
103 | 103 |
104 bool CSSPropertyParser::parseValue( | 104 bool CSSPropertyParser::parseValue( |
105 CSSPropertyID unresolvedProperty, | 105 CSSPropertyID unresolvedProperty, |
106 bool important, | 106 bool important, |
107 const CSSParserTokenRange& range, | 107 const CSSParserTokenRange& range, |
108 const CSSParserContext* context, | 108 const CSSParserContext* context, |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 if (unresolvedProperty != CSSPropertyInvalid && | 358 if (unresolvedProperty != CSSPropertyInvalid && |
359 unresolvedProperty != CSSPropertyVariable) { | 359 unresolvedProperty != CSSPropertyVariable) { |
360 DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty)); | 360 DCHECK(CSSPropertyMetadata::isEnabledProperty(unresolvedProperty)); |
361 range.consumeIncludingWhitespace(); | 361 range.consumeIncludingWhitespace(); |
362 return CSSCustomIdentValue::create(unresolvedProperty); | 362 return CSSCustomIdentValue::create(unresolvedProperty); |
363 } | 363 } |
364 return consumeCustomIdent(range); | 364 return consumeCustomIdent(range); |
365 } | 365 } |
366 | 366 |
367 static CSSValue* consumeSteps(CSSParserTokenRange& range) { | 367 static CSSValue* consumeSteps(CSSParserTokenRange& range) { |
368 ASSERT(range.peek().functionId() == CSSValueSteps); | 368 DCHECK_EQ(range.peek().functionId(), CSSValueSteps); |
369 CSSParserTokenRange rangeCopy = range; | 369 CSSParserTokenRange rangeCopy = range; |
370 CSSParserTokenRange args = consumeFunction(rangeCopy); | 370 CSSParserTokenRange args = consumeFunction(rangeCopy); |
371 | 371 |
372 CSSPrimitiveValue* steps = consumePositiveInteger(args); | 372 CSSPrimitiveValue* steps = consumePositiveInteger(args); |
373 if (!steps) | 373 if (!steps) |
374 return nullptr; | 374 return nullptr; |
375 | 375 |
376 StepsTimingFunction::StepPosition position = | 376 StepsTimingFunction::StepPosition position = |
377 StepsTimingFunction::StepPosition::END; | 377 StepsTimingFunction::StepPosition::END; |
378 if (consumeCommaIncludingWhitespace(args)) { | 378 if (consumeCommaIncludingWhitespace(args)) { |
(...skipping 15 matching lines...) Expand all Loading... |
394 } | 394 } |
395 | 395 |
396 if (!args.atEnd()) | 396 if (!args.atEnd()) |
397 return nullptr; | 397 return nullptr; |
398 | 398 |
399 range = rangeCopy; | 399 range = rangeCopy; |
400 return CSSStepsTimingFunctionValue::create(steps->getIntValue(), position); | 400 return CSSStepsTimingFunctionValue::create(steps->getIntValue(), position); |
401 } | 401 } |
402 | 402 |
403 static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) { | 403 static CSSValue* consumeCubicBezier(CSSParserTokenRange& range) { |
404 ASSERT(range.peek().functionId() == CSSValueCubicBezier); | 404 DCHECK_EQ(range.peek().functionId(), CSSValueCubicBezier); |
405 CSSParserTokenRange rangeCopy = range; | 405 CSSParserTokenRange rangeCopy = range; |
406 CSSParserTokenRange args = consumeFunction(rangeCopy); | 406 CSSParserTokenRange args = consumeFunction(rangeCopy); |
407 | 407 |
408 double x1, y1, x2, y2; | 408 double x1, y1, x2, y2; |
409 if (consumeNumberRaw(args, x1) && x1 >= 0 && x1 <= 1 && | 409 if (consumeNumberRaw(args, x1) && x1 >= 0 && x1 <= 1 && |
410 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, y1) && | 410 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, y1) && |
411 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, x2) && | 411 consumeCommaIncludingWhitespace(args) && consumeNumberRaw(args, x2) && |
412 x2 >= 0 && x2 <= 1 && consumeCommaIncludingWhitespace(args) && | 412 x2 >= 0 && x2 <= 1 && consumeCommaIncludingWhitespace(args) && |
413 consumeNumberRaw(args, y2) && args.atEnd()) { | 413 consumeNumberRaw(args, y2) && args.atEnd()) { |
414 range = rangeCopy; | 414 range = rangeCopy; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 case CSSPropertyAnimationName: | 456 case CSSPropertyAnimationName: |
457 return consumeAnimationName(range, context, useLegacyParsing); | 457 return consumeAnimationName(range, context, useLegacyParsing); |
458 case CSSPropertyAnimationPlayState: | 458 case CSSPropertyAnimationPlayState: |
459 return consumeIdent<CSSValueRunning, CSSValuePaused>(range); | 459 return consumeIdent<CSSValueRunning, CSSValuePaused>(range); |
460 case CSSPropertyTransitionProperty: | 460 case CSSPropertyTransitionProperty: |
461 return consumeTransitionProperty(range); | 461 return consumeTransitionProperty(range); |
462 case CSSPropertyAnimationTimingFunction: | 462 case CSSPropertyAnimationTimingFunction: |
463 case CSSPropertyTransitionTimingFunction: | 463 case CSSPropertyTransitionTimingFunction: |
464 return consumeAnimationTimingFunction(range); | 464 return consumeAnimationTimingFunction(range); |
465 default: | 465 default: |
466 ASSERT_NOT_REACHED(); | 466 NOTREACHED(); |
467 return nullptr; | 467 return nullptr; |
468 } | 468 } |
469 } | 469 } |
470 | 470 |
471 static bool isValidAnimationPropertyList(CSSPropertyID property, | 471 static bool isValidAnimationPropertyList(CSSPropertyID property, |
472 const CSSValueList& valueList) { | 472 const CSSValueList& valueList) { |
473 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) | 473 if (property != CSSPropertyTransitionProperty || valueList.length() < 2) |
474 return true; | 474 return true; |
475 for (auto& value : valueList) { | 475 for (auto& value : valueList) { |
476 if (value->isIdentifierValue() && | 476 if (value->isIdentifierValue() && |
(...skipping 11 matching lines...) Expand all Loading... |
488 CSSValueList* list = CSSValueList::createCommaSeparated(); | 488 CSSValueList* list = CSSValueList::createCommaSeparated(); |
489 do { | 489 do { |
490 CSSValue* value = | 490 CSSValue* value = |
491 consumeAnimationValue(property, range, context, useLegacyParsing); | 491 consumeAnimationValue(property, range, context, useLegacyParsing); |
492 if (!value) | 492 if (!value) |
493 return nullptr; | 493 return nullptr; |
494 list->append(*value); | 494 list->append(*value); |
495 } while (consumeCommaIncludingWhitespace(range)); | 495 } while (consumeCommaIncludingWhitespace(range)); |
496 if (!isValidAnimationPropertyList(property, *list)) | 496 if (!isValidAnimationPropertyList(property, *list)) |
497 return nullptr; | 497 return nullptr; |
498 ASSERT(list->length()); | 498 DCHECK(list->length()); |
499 return list; | 499 return list; |
500 } | 500 } |
501 | 501 |
502 bool CSSPropertyParser::consumeAnimationShorthand( | 502 bool CSSPropertyParser::consumeAnimationShorthand( |
503 const StylePropertyShorthand& shorthand, | 503 const StylePropertyShorthand& shorthand, |
504 bool useLegacyParsing, | 504 bool useLegacyParsing, |
505 bool important) { | 505 bool important) { |
506 const unsigned longhandCount = shorthand.length(); | 506 const unsigned longhandCount = shorthand.length(); |
507 CSSValueList* longhands[8]; | 507 CSSValueList* longhands[8]; |
508 ASSERT(longhandCount <= 8); | 508 DCHECK_LE(longhandCount, 8u); |
509 for (size_t i = 0; i < longhandCount; ++i) | 509 for (size_t i = 0; i < longhandCount; ++i) |
510 longhands[i] = CSSValueList::createCommaSeparated(); | 510 longhands[i] = CSSValueList::createCommaSeparated(); |
511 | 511 |
512 do { | 512 do { |
513 bool parsedLonghand[8] = {false}; | 513 bool parsedLonghand[8] = {false}; |
514 do { | 514 do { |
515 bool foundProperty = false; | 515 bool foundProperty = false; |
516 for (size_t i = 0; i < longhandCount; ++i) { | 516 for (size_t i = 0; i < longhandCount; ++i) { |
517 if (parsedLonghand[i]) | 517 if (parsedLonghand[i]) |
518 continue; | 518 continue; |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 continue; | 1125 continue; |
1126 } | 1126 } |
1127 if (!repeat) { | 1127 if (!repeat) { |
1128 repeat = consumeBorderImageRepeat(range); | 1128 repeat = consumeBorderImageRepeat(range); |
1129 if (repeat) | 1129 if (repeat) |
1130 continue; | 1130 continue; |
1131 } | 1131 } |
1132 if (!slice) { | 1132 if (!slice) { |
1133 slice = consumeBorderImageSlice(property, range); | 1133 slice = consumeBorderImageSlice(property, range); |
1134 if (slice) { | 1134 if (slice) { |
1135 ASSERT(!width && !outset); | 1135 DCHECK(!width); |
| 1136 DCHECK(!outset); |
1136 if (consumeSlashIncludingWhitespace(range)) { | 1137 if (consumeSlashIncludingWhitespace(range)) { |
1137 width = consumeBorderImageWidth(range); | 1138 width = consumeBorderImageWidth(range); |
1138 if (consumeSlashIncludingWhitespace(range)) { | 1139 if (consumeSlashIncludingWhitespace(range)) { |
1139 outset = consumeBorderImageOutset(range); | 1140 outset = consumeBorderImageOutset(range); |
1140 if (!outset) | 1141 if (!outset) |
1141 return false; | 1142 return false; |
1142 } else if (!width) { | 1143 } else if (!width) { |
1143 return false; | 1144 return false; |
1144 } | 1145 } |
1145 } | 1146 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1210 static CSSValue* consumeBackgroundBox(CSSParserTokenRange& range) { | 1211 static CSSValue* consumeBackgroundBox(CSSParserTokenRange& range) { |
1211 return consumeIdent<CSSValueBorderBox, CSSValuePaddingBox, | 1212 return consumeIdent<CSSValueBorderBox, CSSValuePaddingBox, |
1212 CSSValueContentBox>(range); | 1213 CSSValueContentBox>(range); |
1213 } | 1214 } |
1214 | 1215 |
1215 static CSSValue* consumeBackgroundComposite(CSSParserTokenRange& range) { | 1216 static CSSValue* consumeBackgroundComposite(CSSParserTokenRange& range) { |
1216 return consumeIdentRange(range, CSSValueClear, CSSValuePlusLighter); | 1217 return consumeIdentRange(range, CSSValueClear, CSSValuePlusLighter); |
1217 } | 1218 } |
1218 | 1219 |
1219 static CSSValue* consumeMaskSourceType(CSSParserTokenRange& range) { | 1220 static CSSValue* consumeMaskSourceType(CSSParserTokenRange& range) { |
1220 ASSERT(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); | 1221 DCHECK(RuntimeEnabledFeatures::cssMaskSourceTypeEnabled()); |
1221 return consumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range); | 1222 return consumeIdent<CSSValueAuto, CSSValueAlpha, CSSValueLuminance>(range); |
1222 } | 1223 } |
1223 | 1224 |
1224 static CSSValue* consumePrefixedBackgroundBox(CSSPropertyID property, | 1225 static CSSValue* consumePrefixedBackgroundBox(CSSPropertyID property, |
1225 CSSParserTokenRange& range, | 1226 CSSParserTokenRange& range, |
1226 const CSSParserContext* context) { | 1227 const CSSParserContext* context) { |
1227 // The values 'border', 'padding' and 'content' are deprecated and do not | 1228 // The values 'border', 'padding' and 'content' are deprecated and do not |
1228 // apply to the version of the property that has the -webkit- prefix removed. | 1229 // apply to the version of the property that has the -webkit- prefix removed. |
1229 if (CSSValue* value = | 1230 if (CSSValue* value = |
1230 consumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox)) | 1231 consumeIdentRange(range, CSSValueBorder, CSSValuePaddingBox)) |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1405 CSSPrimitiveValue::UnitType::Integer); | 1406 CSSPrimitiveValue::UnitType::Integer); |
1406 } | 1407 } |
1407 | 1408 |
1408 CSSValueList* values = CSSValueList::createSpaceSeparated(); | 1409 CSSValueList* values = CSSValueList::createSpaceSeparated(); |
1409 if (spanValue) | 1410 if (spanValue) |
1410 values->append(*spanValue); | 1411 values->append(*spanValue); |
1411 if (numericValue) | 1412 if (numericValue) |
1412 values->append(*numericValue); | 1413 values->append(*numericValue); |
1413 if (gridLineName) | 1414 if (gridLineName) |
1414 values->append(*gridLineName); | 1415 values->append(*gridLineName); |
1415 ASSERT(values->length()); | 1416 DCHECK(values->length()); |
1416 return values; | 1417 return values; |
1417 } | 1418 } |
1418 | 1419 |
1419 static bool isGridBreadthFixedSized(const CSSValue& value) { | 1420 static bool isGridBreadthFixedSized(const CSSValue& value) { |
1420 if (value.isIdentifierValue()) { | 1421 if (value.isIdentifierValue()) { |
1421 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); | 1422 CSSValueID valueID = toCSSIdentifierValue(value).getValueID(); |
1422 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent || | 1423 return !(valueID == CSSValueMinContent || valueID == CSSValueMaxContent || |
1423 valueID == CSSValueAuto); | 1424 valueID == CSSValueAuto); |
1424 } | 1425 } |
1425 | 1426 |
(...skipping 14 matching lines...) Expand all Loading... |
1440 if (function.functionType() == CSSValueFitContent) | 1441 if (function.functionType() == CSSValueFitContent) |
1441 return false; | 1442 return false; |
1442 | 1443 |
1443 const CSSValue& minValue = function.item(0); | 1444 const CSSValue& minValue = function.item(0); |
1444 const CSSValue& maxValue = function.item(1); | 1445 const CSSValue& maxValue = function.item(1); |
1445 return isGridBreadthFixedSized(minValue) || isGridBreadthFixedSized(maxValue); | 1446 return isGridBreadthFixedSized(minValue) || isGridBreadthFixedSized(maxValue); |
1446 } | 1447 } |
1447 | 1448 |
1448 static Vector<String> parseGridTemplateAreasColumnNames( | 1449 static Vector<String> parseGridTemplateAreasColumnNames( |
1449 const String& gridRowNames) { | 1450 const String& gridRowNames) { |
1450 ASSERT(!gridRowNames.isEmpty()); | 1451 DCHECK(!gridRowNames.isEmpty()); |
1451 Vector<String> columnNames; | 1452 Vector<String> columnNames; |
1452 // Using StringImpl to avoid checks and indirection in every call to | 1453 // Using StringImpl to avoid checks and indirection in every call to |
1453 // String::operator[]. | 1454 // String::operator[]. |
1454 StringImpl& text = *gridRowNames.impl(); | 1455 StringImpl& text = *gridRowNames.impl(); |
1455 | 1456 |
1456 StringBuilder areaName; | 1457 StringBuilder areaName; |
1457 for (unsigned i = 0; i < text.length(); ++i) { | 1458 for (unsigned i = 0; i < text.length(); ++i) { |
1458 if (isCSSSpace(text[i])) { | 1459 if (isCSSSpace(text[i])) { |
1459 if (!areaName.isEmpty()) { | 1460 if (!areaName.isEmpty()) { |
1460 columnNames.push_back(areaName.toString()); | 1461 columnNames.push_back(areaName.toString()); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 while (range.peek().type() == StringToken) { | 1748 while (range.peek().type() == StringToken) { |
1748 if (!parseGridTemplateAreasRow( | 1749 if (!parseGridTemplateAreasRow( |
1749 range.consumeIncludingWhitespace().value().toString(), gridAreaMap, | 1750 range.consumeIncludingWhitespace().value().toString(), gridAreaMap, |
1750 rowCount, columnCount)) | 1751 rowCount, columnCount)) |
1751 return nullptr; | 1752 return nullptr; |
1752 ++rowCount; | 1753 ++rowCount; |
1753 } | 1754 } |
1754 | 1755 |
1755 if (rowCount == 0) | 1756 if (rowCount == 0) |
1756 return nullptr; | 1757 return nullptr; |
1757 ASSERT(columnCount); | 1758 DCHECK(columnCount); |
1758 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); | 1759 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount); |
1759 } | 1760 } |
1760 | 1761 |
1761 static void countKeywordOnlyPropertyUsage(CSSPropertyID property, | 1762 static void countKeywordOnlyPropertyUsage(CSSPropertyID property, |
1762 const CSSParserContext* context, | 1763 const CSSParserContext* context, |
1763 CSSValueID valueID) { | 1764 CSSValueID valueID) { |
1764 if (!context->isUseCounterRecordingEnabled()) | 1765 if (!context->isUseCounterRecordingEnabled()) |
1765 return; | 1766 return; |
1766 switch (property) { | 1767 switch (property) { |
1767 case CSSPropertyWebkitAppearance: { | 1768 case CSSPropertyWebkitAppearance: { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 return consumeBorderWidth(m_range, m_context->mode(), unitless); | 1926 return consumeBorderWidth(m_range, m_context->mode(), unitless); |
1926 } | 1927 } |
1927 case CSSPropertyTextShadow: | 1928 case CSSPropertyTextShadow: |
1928 case CSSPropertyBoxShadow: | 1929 case CSSPropertyBoxShadow: |
1929 return consumeShadow(m_range, m_context->mode(), | 1930 return consumeShadow(m_range, m_context->mode(), |
1930 property == CSSPropertyBoxShadow); | 1931 property == CSSPropertyBoxShadow); |
1931 case CSSPropertyFilter: | 1932 case CSSPropertyFilter: |
1932 case CSSPropertyBackdropFilter: | 1933 case CSSPropertyBackdropFilter: |
1933 return consumeFilter(m_range, m_context); | 1934 return consumeFilter(m_range, m_context); |
1934 case CSSPropertyTextDecoration: | 1935 case CSSPropertyTextDecoration: |
1935 ASSERT(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); | 1936 DCHECK(!RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
1936 // fallthrough | 1937 // fallthrough |
1937 case CSSPropertyWebkitTextDecorationsInEffect: | 1938 case CSSPropertyWebkitTextDecorationsInEffect: |
1938 case CSSPropertyTextDecorationLine: | 1939 case CSSPropertyTextDecorationLine: |
1939 return consumeTextDecorationLine(m_range); | 1940 return consumeTextDecorationLine(m_range); |
1940 case CSSPropertyD: | 1941 case CSSPropertyD: |
1941 return consumePathOrNone(m_range); | 1942 return consumePathOrNone(m_range); |
1942 case CSSPropertyOffsetPath: | 1943 case CSSPropertyOffsetPath: |
1943 return consumeOffsetPath( | 1944 return consumeOffsetPath( |
1944 m_range, m_context, | 1945 m_range, m_context, |
1945 currentShorthand == CSSPropertyMotion || | 1946 currentShorthand == CSSPropertyMotion || |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 case CSSPropertyWebkitMaskSize: | 2024 case CSSPropertyWebkitMaskSize: |
2024 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, | 2025 return consumeCommaSeparatedBackgroundComponent(unresolvedProperty, |
2025 m_range, m_context); | 2026 m_range, m_context); |
2026 case CSSPropertyWebkitMaskRepeatX: | 2027 case CSSPropertyWebkitMaskRepeatX: |
2027 case CSSPropertyWebkitMaskRepeatY: | 2028 case CSSPropertyWebkitMaskRepeatY: |
2028 return nullptr; | 2029 return nullptr; |
2029 case CSSPropertyGridColumnEnd: | 2030 case CSSPropertyGridColumnEnd: |
2030 case CSSPropertyGridColumnStart: | 2031 case CSSPropertyGridColumnStart: |
2031 case CSSPropertyGridRowEnd: | 2032 case CSSPropertyGridRowEnd: |
2032 case CSSPropertyGridRowStart: | 2033 case CSSPropertyGridRowStart: |
2033 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 2034 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
2034 return consumeGridLine(m_range); | 2035 return consumeGridLine(m_range); |
2035 case CSSPropertyGridAutoColumns: | 2036 case CSSPropertyGridAutoColumns: |
2036 case CSSPropertyGridAutoRows: | 2037 case CSSPropertyGridAutoRows: |
2037 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 2038 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
2038 return consumeGridTrackList(m_range, m_context->mode(), GridAuto); | 2039 return consumeGridTrackList(m_range, m_context->mode(), GridAuto); |
2039 case CSSPropertyGridTemplateColumns: | 2040 case CSSPropertyGridTemplateColumns: |
2040 case CSSPropertyGridTemplateRows: | 2041 case CSSPropertyGridTemplateRows: |
2041 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 2042 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
2042 return consumeGridTemplatesRowsOrColumns(m_range, m_context->mode()); | 2043 return consumeGridTemplatesRowsOrColumns(m_range, m_context->mode()); |
2043 case CSSPropertyGridTemplateAreas: | 2044 case CSSPropertyGridTemplateAreas: |
2044 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 2045 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
2045 return consumeGridTemplateAreas(m_range); | 2046 return consumeGridTemplateAreas(m_range); |
2046 default: | 2047 default: |
2047 return nullptr; | 2048 return nullptr; |
2048 } | 2049 } |
2049 } | 2050 } |
2050 | 2051 |
2051 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) { | 2052 static CSSIdentifierValue* consumeFontDisplay(CSSParserTokenRange& range) { |
2052 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, | 2053 return consumeIdent<CSSValueAuto, CSSValueBlock, CSSValueSwap, |
2053 CSSValueFallback, CSSValueOptional>(range); | 2054 CSSValueFallback, CSSValueOptional>(range); |
2054 } | 2055 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 | 2176 |
2176 if (!parsedValue || !m_range.atEnd()) | 2177 if (!parsedValue || !m_range.atEnd()) |
2177 return false; | 2178 return false; |
2178 | 2179 |
2179 addProperty(propId, CSSPropertyInvalid, *parsedValue, false); | 2180 addProperty(propId, CSSPropertyInvalid, *parsedValue, false); |
2180 return true; | 2181 return true; |
2181 } | 2182 } |
2182 | 2183 |
2183 bool CSSPropertyParser::consumeSystemFont(bool important) { | 2184 bool CSSPropertyParser::consumeSystemFont(bool important) { |
2184 CSSValueID systemFontID = m_range.consumeIncludingWhitespace().id(); | 2185 CSSValueID systemFontID = m_range.consumeIncludingWhitespace().id(); |
2185 ASSERT(systemFontID >= CSSValueCaption && systemFontID <= CSSValueStatusBar); | 2186 DCHECK_GE(systemFontID, CSSValueCaption); |
| 2187 DCHECK_LE(systemFontID, CSSValueStatusBar); |
2186 if (!m_range.atEnd()) | 2188 if (!m_range.atEnd()) |
2187 return false; | 2189 return false; |
2188 | 2190 |
2189 FontStyle fontStyle = FontStyleNormal; | 2191 FontStyle fontStyle = FontStyleNormal; |
2190 FontWeight fontWeight = FontWeightNormal; | 2192 FontWeight fontWeight = FontWeightNormal; |
2191 float fontSize = 0; | 2193 float fontSize = 0; |
2192 AtomicString fontFamily; | 2194 AtomicString fontFamily; |
2193 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSize, | 2195 LayoutTheme::theme().systemFont(systemFontID, fontStyle, fontWeight, fontSize, |
2194 fontFamily); | 2196 fontFamily); |
2195 | 2197 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 if (parsedValue) | 2424 if (parsedValue) |
2423 return parsedValue; | 2425 return parsedValue; |
2424 return consumePercent(range, ValueRangeNonNegative); | 2426 return consumePercent(range, ValueRangeNonNegative); |
2425 } | 2427 } |
2426 case CSSPropertyUserZoom: | 2428 case CSSPropertyUserZoom: |
2427 return consumeIdent<CSSValueZoom, CSSValueFixed>(range); | 2429 return consumeIdent<CSSValueZoom, CSSValueFixed>(range); |
2428 case CSSPropertyOrientation: | 2430 case CSSPropertyOrientation: |
2429 return consumeIdent<CSSValueAuto, CSSValuePortrait, CSSValueLandscape>( | 2431 return consumeIdent<CSSValueAuto, CSSValuePortrait, CSSValueLandscape>( |
2430 range); | 2432 range); |
2431 default: | 2433 default: |
2432 ASSERT_NOT_REACHED(); | 2434 NOTREACHED(); |
2433 break; | 2435 break; |
2434 } | 2436 } |
2435 | 2437 |
2436 ASSERT_NOT_REACHED(); | 2438 NOTREACHED(); |
2437 return nullptr; | 2439 return nullptr; |
2438 } | 2440 } |
2439 | 2441 |
2440 bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, | 2442 bool CSSPropertyParser::parseViewportDescriptor(CSSPropertyID propId, |
2441 bool important) { | 2443 bool important) { |
2442 ASSERT(RuntimeEnabledFeatures::cssViewportEnabled() || | 2444 DCHECK(RuntimeEnabledFeatures::cssViewportEnabled() || |
2443 isUASheetBehavior(m_context->mode())); | 2445 isUASheetBehavior(m_context->mode())); |
2444 | 2446 |
2445 switch (propId) { | 2447 switch (propId) { |
2446 case CSSPropertyWidth: { | 2448 case CSSPropertyWidth: { |
2447 CSSValue* minWidth = consumeSingleViewportDescriptor( | 2449 CSSValue* minWidth = consumeSingleViewportDescriptor( |
2448 m_range, CSSPropertyMinWidth, m_context->mode()); | 2450 m_range, CSSPropertyMinWidth, m_context->mode()); |
2449 if (!minWidth) | 2451 if (!minWidth) |
2450 return false; | 2452 return false; |
2451 CSSValue* maxWidth = minWidth; | 2453 CSSValue* maxWidth = minWidth; |
2452 if (!m_range.atEnd()) { | 2454 if (!m_range.atEnd()) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2656 addExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); | 2658 addExpandedPropertyForValue(CSSPropertyBorderStyle, *style, important); |
2657 addExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); | 2659 addExpandedPropertyForValue(CSSPropertyBorderColor, *color, important); |
2658 addExpandedPropertyForValue(CSSPropertyBorderImage, | 2660 addExpandedPropertyForValue(CSSPropertyBorderImage, |
2659 *CSSInitialValue::create(), important); | 2661 *CSSInitialValue::create(), important); |
2660 | 2662 |
2661 return m_range.atEnd(); | 2663 return m_range.atEnd(); |
2662 } | 2664 } |
2663 | 2665 |
2664 bool CSSPropertyParser::consume4Values(const StylePropertyShorthand& shorthand, | 2666 bool CSSPropertyParser::consume4Values(const StylePropertyShorthand& shorthand, |
2665 bool important) { | 2667 bool important) { |
2666 ASSERT(shorthand.length() == 4); | 2668 DCHECK_EQ(shorthand.length(), 4u); |
2667 const CSSPropertyID* longhands = shorthand.properties(); | 2669 const CSSPropertyID* longhands = shorthand.properties(); |
2668 const CSSValue* top = parseSingleValue(longhands[0], shorthand.id()); | 2670 const CSSValue* top = parseSingleValue(longhands[0], shorthand.id()); |
2669 if (!top) | 2671 if (!top) |
2670 return false; | 2672 return false; |
2671 | 2673 |
2672 const CSSValue* right = parseSingleValue(longhands[1], shorthand.id()); | 2674 const CSSValue* right = parseSingleValue(longhands[1], shorthand.id()); |
2673 const CSSValue* bottom = nullptr; | 2675 const CSSValue* bottom = nullptr; |
2674 const CSSValue* left = nullptr; | 2676 const CSSValue* left = nullptr; |
2675 if (right) { | 2677 if (right) { |
2676 bottom = parseSingleValue(longhands[2], shorthand.id()); | 2678 bottom = parseSingleValue(longhands[2], shorthand.id()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, | 2728 addProperty(CSSPropertyBorderImageSlice, CSSPropertyBorderImage, |
2727 slice ? *slice : *CSSInitialValue::create(), important); | 2729 slice ? *slice : *CSSInitialValue::create(), important); |
2728 addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, | 2730 addProperty(CSSPropertyBorderImageWidth, CSSPropertyBorderImage, |
2729 width ? *width : *CSSInitialValue::create(), important); | 2731 width ? *width : *CSSInitialValue::create(), important); |
2730 addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, | 2732 addProperty(CSSPropertyBorderImageOutset, CSSPropertyBorderImage, |
2731 outset ? *outset : *CSSInitialValue::create(), important); | 2733 outset ? *outset : *CSSInitialValue::create(), important); |
2732 addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, | 2734 addProperty(CSSPropertyBorderImageRepeat, CSSPropertyBorderImage, |
2733 repeat ? *repeat : *CSSInitialValue::create(), important); | 2735 repeat ? *repeat : *CSSInitialValue::create(), important); |
2734 return true; | 2736 return true; |
2735 default: | 2737 default: |
2736 ASSERT_NOT_REACHED(); | 2738 NOTREACHED(); |
2737 return false; | 2739 return false; |
2738 } | 2740 } |
2739 } | 2741 } |
2740 return false; | 2742 return false; |
2741 } | 2743 } |
2742 | 2744 |
2743 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value) { | 2745 static inline CSSValueID mapFromPageBreakBetween(CSSValueID value) { |
2744 if (value == CSSValueAlways) | 2746 if (value == CSSValueAlways) |
2745 return CSSValuePage; | 2747 return CSSValuePage; |
2746 if (value == CSSValueAuto || value == CSSValueAvoid || | 2748 if (value == CSSValueAuto || value == CSSValueAvoid || |
(...skipping 16 matching lines...) Expand all Loading... |
2763 return CSSValueInvalid; | 2765 return CSSValueInvalid; |
2764 } | 2766 } |
2765 | 2767 |
2766 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) { | 2768 static inline CSSPropertyID mapFromLegacyBreakProperty(CSSPropertyID property) { |
2767 if (property == CSSPropertyPageBreakAfter || | 2769 if (property == CSSPropertyPageBreakAfter || |
2768 property == CSSPropertyWebkitColumnBreakAfter) | 2770 property == CSSPropertyWebkitColumnBreakAfter) |
2769 return CSSPropertyBreakAfter; | 2771 return CSSPropertyBreakAfter; |
2770 if (property == CSSPropertyPageBreakBefore || | 2772 if (property == CSSPropertyPageBreakBefore || |
2771 property == CSSPropertyWebkitColumnBreakBefore) | 2773 property == CSSPropertyWebkitColumnBreakBefore) |
2772 return CSSPropertyBreakBefore; | 2774 return CSSPropertyBreakBefore; |
2773 ASSERT(property == CSSPropertyPageBreakInside || | 2775 DCHECK(property == CSSPropertyPageBreakInside || |
2774 property == CSSPropertyWebkitColumnBreakInside); | 2776 property == CSSPropertyWebkitColumnBreakInside); |
2775 return CSSPropertyBreakInside; | 2777 return CSSPropertyBreakInside; |
2776 } | 2778 } |
2777 | 2779 |
2778 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, | 2780 bool CSSPropertyParser::consumeLegacyBreakProperty(CSSPropertyID property, |
2779 bool important) { | 2781 bool important) { |
2780 // The fragmentation spec says that page-break-(after|before|inside) are to be | 2782 // The fragmentation spec says that page-break-(after|before|inside) are to be |
2781 // treated as shorthands for their break-(after|before|inside) counterparts. | 2783 // treated as shorthands for their break-(after|before|inside) counterparts. |
2782 // We'll do the same for the non-standard properties | 2784 // We'll do the same for the non-standard properties |
2783 // -webkit-column-break-(after|before|inside). | 2785 // -webkit-column-break-(after|before|inside). |
(...skipping 10 matching lines...) Expand all Loading... |
2794 break; | 2796 break; |
2795 case CSSPropertyWebkitColumnBreakAfter: | 2797 case CSSPropertyWebkitColumnBreakAfter: |
2796 case CSSPropertyWebkitColumnBreakBefore: | 2798 case CSSPropertyWebkitColumnBreakBefore: |
2797 value = mapFromColumnBreakBetween(value); | 2799 value = mapFromColumnBreakBetween(value); |
2798 break; | 2800 break; |
2799 case CSSPropertyPageBreakInside: | 2801 case CSSPropertyPageBreakInside: |
2800 case CSSPropertyWebkitColumnBreakInside: | 2802 case CSSPropertyWebkitColumnBreakInside: |
2801 value = mapFromColumnOrPageBreakInside(value); | 2803 value = mapFromColumnOrPageBreakInside(value); |
2802 break; | 2804 break; |
2803 default: | 2805 default: |
2804 ASSERT_NOT_REACHED(); | 2806 NOTREACHED(); |
2805 } | 2807 } |
2806 if (value == CSSValueInvalid) | 2808 if (value == CSSValueInvalid) |
2807 return false; | 2809 return false; |
2808 | 2810 |
2809 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); | 2811 CSSPropertyID genericBreakProperty = mapFromLegacyBreakProperty(property); |
2810 addProperty(genericBreakProperty, property, | 2812 addProperty(genericBreakProperty, property, |
2811 *CSSIdentifierValue::create(value), important); | 2813 *CSSIdentifierValue::create(value), important); |
2812 return true; | 2814 return true; |
2813 } | 2815 } |
2814 | 2816 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 return true; | 2876 return true; |
2875 } | 2877 } |
2876 | 2878 |
2877 // Note: consumeBackgroundShorthand assumes y properties (for example | 2879 // Note: consumeBackgroundShorthand assumes y properties (for example |
2878 // background-position-y) follow the x properties in the shorthand array. | 2880 // background-position-y) follow the x properties in the shorthand array. |
2879 bool CSSPropertyParser::consumeBackgroundShorthand( | 2881 bool CSSPropertyParser::consumeBackgroundShorthand( |
2880 const StylePropertyShorthand& shorthand, | 2882 const StylePropertyShorthand& shorthand, |
2881 bool important) { | 2883 bool important) { |
2882 const unsigned longhandCount = shorthand.length(); | 2884 const unsigned longhandCount = shorthand.length(); |
2883 CSSValue* longhands[10] = {0}; | 2885 CSSValue* longhands[10] = {0}; |
2884 ASSERT(longhandCount <= 10); | 2886 DCHECK_LE(longhandCount, 10u); |
2885 | 2887 |
2886 bool implicit = false; | 2888 bool implicit = false; |
2887 do { | 2889 do { |
2888 bool parsedLonghand[10] = {false}; | 2890 bool parsedLonghand[10] = {false}; |
2889 CSSValue* originValue = nullptr; | 2891 CSSValue* originValue = nullptr; |
2890 do { | 2892 do { |
2891 bool foundProperty = false; | 2893 bool foundProperty = false; |
2892 for (size_t i = 0; i < longhandCount; ++i) { | 2894 for (size_t i = 0; i < longhandCount; ++i) { |
2893 if (parsedLonghand[i]) | 2895 if (parsedLonghand[i]) |
2894 continue; | 2896 continue; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 m_context->useLegacyBackgroundSizeShorthandBehavior()) | 2966 m_context->useLegacyBackgroundSizeShorthandBehavior()) |
2965 continue; | 2967 continue; |
2966 addProperty(property, shorthand.id(), *longhands[i], important, implicit); | 2968 addProperty(property, shorthand.id(), *longhands[i], important, implicit); |
2967 } | 2969 } |
2968 return true; | 2970 return true; |
2969 } | 2971 } |
2970 | 2972 |
2971 bool CSSPropertyParser::consumeGridItemPositionShorthand( | 2973 bool CSSPropertyParser::consumeGridItemPositionShorthand( |
2972 CSSPropertyID shorthandId, | 2974 CSSPropertyID shorthandId, |
2973 bool important) { | 2975 bool important) { |
2974 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 2976 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
2975 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 2977 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
2976 ASSERT(shorthand.length() == 2); | 2978 DCHECK_EQ(shorthand.length(), 2u); |
2977 CSSValue* startValue = consumeGridLine(m_range); | 2979 CSSValue* startValue = consumeGridLine(m_range); |
2978 if (!startValue) | 2980 if (!startValue) |
2979 return false; | 2981 return false; |
2980 | 2982 |
2981 CSSValue* endValue = nullptr; | 2983 CSSValue* endValue = nullptr; |
2982 if (consumeSlashIncludingWhitespace(m_range)) { | 2984 if (consumeSlashIncludingWhitespace(m_range)) { |
2983 endValue = consumeGridLine(m_range); | 2985 endValue = consumeGridLine(m_range); |
2984 if (!endValue) | 2986 if (!endValue) |
2985 return false; | 2987 return false; |
2986 } else { | 2988 } else { |
2987 endValue = startValue->isCustomIdentValue() | 2989 endValue = startValue->isCustomIdentValue() |
2988 ? startValue | 2990 ? startValue |
2989 : CSSIdentifierValue::create(CSSValueAuto); | 2991 : CSSIdentifierValue::create(CSSValueAuto); |
2990 } | 2992 } |
2991 if (!m_range.atEnd()) | 2993 if (!m_range.atEnd()) |
2992 return false; | 2994 return false; |
2993 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); | 2995 addProperty(shorthand.properties()[0], shorthandId, *startValue, important); |
2994 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); | 2996 addProperty(shorthand.properties()[1], shorthandId, *endValue, important); |
2995 return true; | 2997 return true; |
2996 } | 2998 } |
2997 | 2999 |
2998 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) { | 3000 bool CSSPropertyParser::consumeGridAreaShorthand(bool important) { |
2999 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3001 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3000 ASSERT(gridAreaShorthand().length() == 4); | 3002 DCHECK_EQ(gridAreaShorthand().length(), 4u); |
3001 CSSValue* rowStartValue = consumeGridLine(m_range); | 3003 CSSValue* rowStartValue = consumeGridLine(m_range); |
3002 if (!rowStartValue) | 3004 if (!rowStartValue) |
3003 return false; | 3005 return false; |
3004 CSSValue* columnStartValue = nullptr; | 3006 CSSValue* columnStartValue = nullptr; |
3005 CSSValue* rowEndValue = nullptr; | 3007 CSSValue* rowEndValue = nullptr; |
3006 CSSValue* columnEndValue = nullptr; | 3008 CSSValue* columnEndValue = nullptr; |
3007 if (consumeSlashIncludingWhitespace(m_range)) { | 3009 if (consumeSlashIncludingWhitespace(m_range)) { |
3008 columnStartValue = consumeGridLine(m_range); | 3010 columnStartValue = consumeGridLine(m_range); |
3009 if (!columnStartValue) | 3011 if (!columnStartValue) |
3010 return false; | 3012 return false; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3106 important); | 3108 important); |
3107 addProperty( | 3109 addProperty( |
3108 CSSPropertyGridTemplateAreas, shorthandId, | 3110 CSSPropertyGridTemplateAreas, shorthandId, |
3109 *CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount), | 3111 *CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount), |
3110 important); | 3112 important); |
3111 return true; | 3113 return true; |
3112 } | 3114 } |
3113 | 3115 |
3114 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, | 3116 bool CSSPropertyParser::consumeGridTemplateShorthand(CSSPropertyID shorthandId, |
3115 bool important) { | 3117 bool important) { |
3116 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3118 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3117 ASSERT(gridTemplateShorthand().length() == 3); | 3119 DCHECK_EQ(gridTemplateShorthand().length(), 3u); |
3118 | 3120 |
3119 CSSParserTokenRange rangeCopy = m_range; | 3121 CSSParserTokenRange rangeCopy = m_range; |
3120 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); | 3122 CSSValue* rowsValue = consumeIdent<CSSValueNone>(m_range); |
3121 | 3123 |
3122 // 1- 'none' case. | 3124 // 1- 'none' case. |
3123 if (rowsValue && m_range.atEnd()) { | 3125 if (rowsValue && m_range.atEnd()) { |
3124 addProperty(CSSPropertyGridTemplateRows, shorthandId, | 3126 addProperty(CSSPropertyGridTemplateRows, shorthandId, |
3125 *CSSIdentifierValue::create(CSSValueNone), important); | 3127 *CSSIdentifierValue::create(CSSValueNone), important); |
3126 addProperty(CSSPropertyGridTemplateColumns, shorthandId, | 3128 addProperty(CSSPropertyGridTemplateColumns, shorthandId, |
3127 *CSSIdentifierValue::create(CSSValueNone), important); | 3129 *CSSIdentifierValue::create(CSSValueNone), important); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3171 return nullptr; | 3173 return nullptr; |
3172 } | 3174 } |
3173 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 3175 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
3174 list->append(flowDirection); | 3176 list->append(flowDirection); |
3175 if (denseAlgorithm) | 3177 if (denseAlgorithm) |
3176 list->append(*denseAlgorithm); | 3178 list->append(*denseAlgorithm); |
3177 return list; | 3179 return list; |
3178 } | 3180 } |
3179 | 3181 |
3180 bool CSSPropertyParser::consumeGridShorthand(bool important) { | 3182 bool CSSPropertyParser::consumeGridShorthand(bool important) { |
3181 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | 3183 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3182 ASSERT(shorthandForProperty(CSSPropertyGrid).length() == 8); | 3184 DCHECK_EQ(shorthandForProperty(CSSPropertyGrid).length(), 8u); |
3183 | 3185 |
3184 CSSParserTokenRange rangeCopy = m_range; | 3186 CSSParserTokenRange rangeCopy = m_range; |
3185 | 3187 |
3186 // 1- <grid-template> | 3188 // 1- <grid-template> |
3187 if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) { | 3189 if (consumeGridTemplateShorthand(CSSPropertyGrid, important)) { |
3188 // It can only be specified the explicit or the implicit grid properties in | 3190 // It can only be specified the explicit or the implicit grid properties in |
3189 // a single grid declaration. The sub-properties not specified are set to | 3191 // a single grid declaration. The sub-properties not specified are set to |
3190 // their initial value, as normal for shorthands. | 3192 // their initial value, as normal for shorthands. |
3191 addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, | 3193 addProperty(CSSPropertyGridAutoFlow, CSSPropertyGrid, |
3192 *CSSInitialValue::create(), important); | 3194 *CSSInitialValue::create(), important); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3397 case CSSPropertyColumns: | 3399 case CSSPropertyColumns: |
3398 return consumeColumns(important); | 3400 return consumeColumns(important); |
3399 case CSSPropertyAnimation: | 3401 case CSSPropertyAnimation: |
3400 return consumeAnimationShorthand( | 3402 return consumeAnimationShorthand( |
3401 animationShorthandForParsing(), | 3403 animationShorthandForParsing(), |
3402 unresolvedProperty == CSSPropertyAliasWebkitAnimation, important); | 3404 unresolvedProperty == CSSPropertyAliasWebkitAnimation, important); |
3403 case CSSPropertyTransition: | 3405 case CSSPropertyTransition: |
3404 return consumeAnimationShorthand(transitionShorthandForParsing(), false, | 3406 return consumeAnimationShorthand(transitionShorthandForParsing(), false, |
3405 important); | 3407 important); |
3406 case CSSPropertyTextDecoration: | 3408 case CSSPropertyTextDecoration: |
3407 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); | 3409 DCHECK(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); |
3408 return consumeShorthandGreedily(textDecorationShorthand(), important); | 3410 return consumeShorthandGreedily(textDecorationShorthand(), important); |
3409 case CSSPropertyMargin: | 3411 case CSSPropertyMargin: |
3410 return consume4Values(marginShorthand(), important); | 3412 return consume4Values(marginShorthand(), important); |
3411 case CSSPropertyPadding: | 3413 case CSSPropertyPadding: |
3412 return consume4Values(paddingShorthand(), important); | 3414 return consume4Values(paddingShorthand(), important); |
3413 case CSSPropertyMotion: | 3415 case CSSPropertyMotion: |
3414 return consumeShorthandGreedily(motionShorthand(), important); | 3416 return consumeShorthandGreedily(motionShorthand(), important); |
3415 case CSSPropertyOffset: | 3417 case CSSPropertyOffset: |
3416 return consumeOffsetShorthand(important); | 3418 return consumeOffsetShorthand(important); |
3417 case CSSPropertyWebkitTextEmphasis: | 3419 case CSSPropertyWebkitTextEmphasis: |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 ? CSSPropertyBackgroundRepeatY | 3533 ? CSSPropertyBackgroundRepeatY |
3532 : CSSPropertyWebkitMaskRepeatY, | 3534 : CSSPropertyWebkitMaskRepeatY, |
3533 property, *resultY, important, implicit); | 3535 property, *resultY, important, implicit); |
3534 return true; | 3536 return true; |
3535 } | 3537 } |
3536 case CSSPropertyBackground: | 3538 case CSSPropertyBackground: |
3537 return consumeBackgroundShorthand(backgroundShorthand(), important); | 3539 return consumeBackgroundShorthand(backgroundShorthand(), important); |
3538 case CSSPropertyWebkitMask: | 3540 case CSSPropertyWebkitMask: |
3539 return consumeBackgroundShorthand(webkitMaskShorthand(), important); | 3541 return consumeBackgroundShorthand(webkitMaskShorthand(), important); |
3540 case CSSPropertyGridGap: { | 3542 case CSSPropertyGridGap: { |
3541 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled() && | 3543 DCHECK(RuntimeEnabledFeatures::cssGridLayoutEnabled()); |
3542 shorthandForProperty(CSSPropertyGridGap).length() == 2); | 3544 DCHECK_EQ(shorthandForProperty(CSSPropertyGridGap).length(), 2u); |
3543 CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context->mode(), | 3545 CSSValue* rowGap = consumeLengthOrPercent(m_range, m_context->mode(), |
3544 ValueRangeNonNegative); | 3546 ValueRangeNonNegative); |
3545 CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context->mode(), | 3547 CSSValue* columnGap = consumeLengthOrPercent(m_range, m_context->mode(), |
3546 ValueRangeNonNegative); | 3548 ValueRangeNonNegative); |
3547 if (!rowGap || !m_range.atEnd()) | 3549 if (!rowGap || !m_range.atEnd()) |
3548 return false; | 3550 return false; |
3549 if (!columnGap) | 3551 if (!columnGap) |
3550 columnGap = rowGap; | 3552 columnGap = rowGap; |
3551 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, *rowGap, | 3553 addProperty(CSSPropertyGridRowGap, CSSPropertyGridGap, *rowGap, |
3552 important); | 3554 important); |
(...skipping 11 matching lines...) Expand all Loading... |
3564 case CSSPropertyGrid: | 3566 case CSSPropertyGrid: |
3565 return consumeGridShorthand(important); | 3567 return consumeGridShorthand(important); |
3566 case CSSPropertyPlaceContent: | 3568 case CSSPropertyPlaceContent: |
3567 return consumePlaceContentShorthand(important); | 3569 return consumePlaceContentShorthand(important); |
3568 default: | 3570 default: |
3569 return false; | 3571 return false; |
3570 } | 3572 } |
3571 } | 3573 } |
3572 | 3574 |
3573 } // namespace blink | 3575 } // namespace blink |
OLD | NEW |