| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/css/CSSVariableReferenceValue.h" | 34 #include "core/css/CSSVariableReferenceValue.h" |
| 35 #include "core/css/HashTools.h" | 35 #include "core/css/HashTools.h" |
| 36 #include "core/css/parser/CSSParserFastPaths.h" | 36 #include "core/css/parser/CSSParserFastPaths.h" |
| 37 #include "core/css/parser/CSSParserIdioms.h" | 37 #include "core/css/parser/CSSParserIdioms.h" |
| 38 #include "core/css/parser/CSSPropertyParserHelpers.h" | 38 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 39 #include "core/css/parser/CSSVariableParser.h" | 39 #include "core/css/parser/CSSVariableParser.h" |
| 40 #include "core/css/parser/FontVariantLigaturesParser.h" | 40 #include "core/css/parser/FontVariantLigaturesParser.h" |
| 41 #include "core/css/parser/FontVariantNumericParser.h" | 41 #include "core/css/parser/FontVariantNumericParser.h" |
| 42 #include "core/css/properties/CSSPropertyAPI.h" | 42 #include "core/css/properties/CSSPropertyAPI.h" |
| 43 #include "core/css/properties/CSSPropertyAlignmentUtils.h" | 43 #include "core/css/properties/CSSPropertyAlignmentUtils.h" |
| 44 #include "core/css/properties/CSSPropertyAnimationNameUtils.h" |
| 44 #include "core/css/properties/CSSPropertyColumnUtils.h" | 45 #include "core/css/properties/CSSPropertyColumnUtils.h" |
| 45 #include "core/css/properties/CSSPropertyDescriptor.h" | 46 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 46 #include "core/css/properties/CSSPropertyFontUtils.h" | 47 #include "core/css/properties/CSSPropertyFontUtils.h" |
| 47 #include "core/css/properties/CSSPropertyLengthUtils.h" | 48 #include "core/css/properties/CSSPropertyLengthUtils.h" |
| 48 #include "core/css/properties/CSSPropertyMarginUtils.h" | 49 #include "core/css/properties/CSSPropertyMarginUtils.h" |
| 49 #include "core/css/properties/CSSPropertyOffsetPathUtils.h" | 50 #include "core/css/properties/CSSPropertyOffsetPathUtils.h" |
| 50 #include "core/css/properties/CSSPropertyPositionUtils.h" | 51 #include "core/css/properties/CSSPropertyPositionUtils.h" |
| 51 #include "core/css/properties/CSSPropertyShapeUtils.h" | 52 #include "core/css/properties/CSSPropertyShapeUtils.h" |
| 52 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" | 53 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" |
| 53 #include "core/frame/UseCounter.h" | 54 #include "core/frame/UseCounter.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 return ConsumeIdent(range); | 324 return ConsumeIdent(range); |
| 324 return ConsumeString(range); | 325 return ConsumeString(range); |
| 325 } | 326 } |
| 326 | 327 |
| 327 static CSSValue* ConsumeAnimationIterationCount(CSSParserTokenRange& range) { | 328 static CSSValue* ConsumeAnimationIterationCount(CSSParserTokenRange& range) { |
| 328 if (range.Peek().Id() == CSSValueInfinite) | 329 if (range.Peek().Id() == CSSValueInfinite) |
| 329 return ConsumeIdent(range); | 330 return ConsumeIdent(range); |
| 330 return ConsumeNumber(range, kValueRangeNonNegative); | 331 return ConsumeNumber(range, kValueRangeNonNegative); |
| 331 } | 332 } |
| 332 | 333 |
| 333 static CSSValue* ConsumeAnimationName(CSSParserTokenRange& range, | |
| 334 const CSSParserContext* context, | |
| 335 bool allow_quoted_name) { | |
| 336 if (range.Peek().Id() == CSSValueNone) | |
| 337 return ConsumeIdent(range); | |
| 338 | |
| 339 if (allow_quoted_name && range.Peek().GetType() == kStringToken) { | |
| 340 // Legacy support for strings in prefixed animations. | |
| 341 context->Count(UseCounter::kQuotedAnimationName); | |
| 342 | |
| 343 const CSSParserToken& token = range.ConsumeIncludingWhitespace(); | |
| 344 if (EqualIgnoringASCIICase(token.Value(), "none")) | |
| 345 return CSSIdentifierValue::Create(CSSValueNone); | |
| 346 return CSSCustomIdentValue::Create(token.Value().ToAtomicString()); | |
| 347 } | |
| 348 | |
| 349 return ConsumeCustomIdent(range); | |
| 350 } | |
| 351 | |
| 352 static CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { | 334 static CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { |
| 353 const CSSParserToken& token = range.Peek(); | 335 const CSSParserToken& token = range.Peek(); |
| 354 if (token.GetType() != kIdentToken) | 336 if (token.GetType() != kIdentToken) |
| 355 return nullptr; | 337 return nullptr; |
| 356 if (token.Id() == CSSValueNone) | 338 if (token.Id() == CSSValueNone) |
| 357 return ConsumeIdent(range); | 339 return ConsumeIdent(range); |
| 358 | 340 |
| 359 CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID(); | 341 CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID(); |
| 360 if (unresolved_property != CSSPropertyInvalid && | 342 if (unresolved_property != CSSPropertyInvalid && |
| 361 unresolved_property != CSSPropertyVariable) { | 343 unresolved_property != CSSPropertyVariable) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 CSSValueAlternateReverse>(range); | 453 CSSValueAlternateReverse>(range); |
| 472 case CSSPropertyAnimationDuration: | 454 case CSSPropertyAnimationDuration: |
| 473 case CSSPropertyTransitionDuration: | 455 case CSSPropertyTransitionDuration: |
| 474 return ConsumeTime(range, kValueRangeNonNegative); | 456 return ConsumeTime(range, kValueRangeNonNegative); |
| 475 case CSSPropertyAnimationFillMode: | 457 case CSSPropertyAnimationFillMode: |
| 476 return ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, | 458 return ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, |
| 477 CSSValueBoth>(range); | 459 CSSValueBoth>(range); |
| 478 case CSSPropertyAnimationIterationCount: | 460 case CSSPropertyAnimationIterationCount: |
| 479 return ConsumeAnimationIterationCount(range); | 461 return ConsumeAnimationIterationCount(range); |
| 480 case CSSPropertyAnimationName: | 462 case CSSPropertyAnimationName: |
| 481 return ConsumeAnimationName(range, context, use_legacy_parsing); | 463 return CSSPropertyAnimationNameUtils::ConsumeAnimationName( |
| 464 range, context, use_legacy_parsing); |
| 482 case CSSPropertyAnimationPlayState: | 465 case CSSPropertyAnimationPlayState: |
| 483 return ConsumeIdent<CSSValueRunning, CSSValuePaused>(range); | 466 return ConsumeIdent<CSSValueRunning, CSSValuePaused>(range); |
| 484 case CSSPropertyTransitionProperty: | 467 case CSSPropertyTransitionProperty: |
| 485 return ConsumeTransitionProperty(range); | 468 return ConsumeTransitionProperty(range); |
| 486 case CSSPropertyAnimationTimingFunction: | 469 case CSSPropertyAnimationTimingFunction: |
| 487 case CSSPropertyTransitionTimingFunction: | 470 case CSSPropertyTransitionTimingFunction: |
| 488 return ConsumeAnimationTimingFunction(range); | 471 return ConsumeAnimationTimingFunction(range); |
| 489 default: | 472 default: |
| 490 NOTREACHED(); | 473 NOTREACHED(); |
| 491 return nullptr; | 474 return nullptr; |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 case CSSPropertyTransitionDuration: | 1648 case CSSPropertyTransitionDuration: |
| 1666 return ConsumeCommaSeparatedList(ConsumeTime, range_, | 1649 return ConsumeCommaSeparatedList(ConsumeTime, range_, |
| 1667 kValueRangeNonNegative); | 1650 kValueRangeNonNegative); |
| 1668 case CSSPropertyAnimationFillMode: | 1651 case CSSPropertyAnimationFillMode: |
| 1669 return ConsumeCommaSeparatedList( | 1652 return ConsumeCommaSeparatedList( |
| 1670 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, | 1653 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, |
| 1671 CSSValueBoth>, | 1654 CSSValueBoth>, |
| 1672 range_); | 1655 range_); |
| 1673 case CSSPropertyAnimationIterationCount: | 1656 case CSSPropertyAnimationIterationCount: |
| 1674 return ConsumeCommaSeparatedList(ConsumeAnimationIterationCount, range_); | 1657 return ConsumeCommaSeparatedList(ConsumeAnimationIterationCount, range_); |
| 1675 case CSSPropertyAnimationName: | |
| 1676 return ConsumeCommaSeparatedList( | |
| 1677 ConsumeAnimationName, range_, context_, | |
| 1678 unresolved_property == CSSPropertyAliasWebkitAnimationName); | |
| 1679 case CSSPropertyAnimationPlayState: | 1658 case CSSPropertyAnimationPlayState: |
| 1680 return ConsumeCommaSeparatedList( | 1659 return ConsumeCommaSeparatedList( |
| 1681 ConsumeIdent<CSSValueRunning, CSSValuePaused>, range_); | 1660 ConsumeIdent<CSSValueRunning, CSSValuePaused>, range_); |
| 1682 case CSSPropertyTransitionProperty: { | 1661 case CSSPropertyTransitionProperty: { |
| 1683 CSSValueList* list = | 1662 CSSValueList* list = |
| 1684 ConsumeCommaSeparatedList(ConsumeTransitionProperty, range_); | 1663 ConsumeCommaSeparatedList(ConsumeTransitionProperty, range_); |
| 1685 if (!list || !IsValidAnimationPropertyList(*list)) | 1664 if (!list || !IsValidAnimationPropertyList(*list)) |
| 1686 return nullptr; | 1665 return nullptr; |
| 1687 return list; | 1666 return list; |
| 1688 } | 1667 } |
| (...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3411 case CSSPropertyPlaceItems: | 3390 case CSSPropertyPlaceItems: |
| 3412 return ConsumePlaceItemsShorthand(important); | 3391 return ConsumePlaceItemsShorthand(important); |
| 3413 case CSSPropertyPlaceSelf: | 3392 case CSSPropertyPlaceSelf: |
| 3414 return ConsumePlaceSelfShorthand(important); | 3393 return ConsumePlaceSelfShorthand(important); |
| 3415 default: | 3394 default: |
| 3416 return false; | 3395 return false; |
| 3417 } | 3396 } |
| 3418 } | 3397 } |
| 3419 | 3398 |
| 3420 } // namespace blink | 3399 } // namespace blink |
| OLD | NEW |