| 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 24 matching lines...) Expand all Loading... |
| 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/CSSParserLocalContext.h" | 38 #include "core/css/parser/CSSParserLocalContext.h" |
| 39 #include "core/css/parser/CSSPropertyParserHelpers.h" | 39 #include "core/css/parser/CSSPropertyParserHelpers.h" |
| 40 #include "core/css/parser/CSSVariableParser.h" | 40 #include "core/css/parser/CSSVariableParser.h" |
| 41 #include "core/css/parser/FontVariantLigaturesParser.h" | 41 #include "core/css/parser/FontVariantLigaturesParser.h" |
| 42 #include "core/css/parser/FontVariantNumericParser.h" | 42 #include "core/css/parser/FontVariantNumericParser.h" |
| 43 #include "core/css/properties/CSSPropertyAPI.h" | 43 #include "core/css/properties/CSSPropertyAPI.h" |
| 44 #include "core/css/properties/CSSPropertyAlignmentUtils.h" | 44 #include "core/css/properties/CSSPropertyAlignmentUtils.h" |
| 45 #include "core/css/properties/CSSPropertyAnimationNameUtils.h" |
| 45 #include "core/css/properties/CSSPropertyColumnUtils.h" | 46 #include "core/css/properties/CSSPropertyColumnUtils.h" |
| 46 #include "core/css/properties/CSSPropertyDescriptor.h" | 47 #include "core/css/properties/CSSPropertyDescriptor.h" |
| 47 #include "core/css/properties/CSSPropertyFontUtils.h" | 48 #include "core/css/properties/CSSPropertyFontUtils.h" |
| 48 #include "core/css/properties/CSSPropertyLengthUtils.h" | 49 #include "core/css/properties/CSSPropertyLengthUtils.h" |
| 49 #include "core/css/properties/CSSPropertyMarginUtils.h" | 50 #include "core/css/properties/CSSPropertyMarginUtils.h" |
| 50 #include "core/css/properties/CSSPropertyOffsetPathUtils.h" | 51 #include "core/css/properties/CSSPropertyOffsetPathUtils.h" |
| 51 #include "core/css/properties/CSSPropertyPositionUtils.h" | 52 #include "core/css/properties/CSSPropertyPositionUtils.h" |
| 52 #include "core/css/properties/CSSPropertyShapeUtils.h" | 53 #include "core/css/properties/CSSPropertyShapeUtils.h" |
| 53 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" | 54 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" |
| 54 #include "core/frame/UseCounter.h" | 55 #include "core/frame/UseCounter.h" |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return ConsumeIdent(range); | 325 return ConsumeIdent(range); |
| 325 return ConsumeString(range); | 326 return ConsumeString(range); |
| 326 } | 327 } |
| 327 | 328 |
| 328 static CSSValue* ConsumeAnimationIterationCount(CSSParserTokenRange& range) { | 329 static CSSValue* ConsumeAnimationIterationCount(CSSParserTokenRange& range) { |
| 329 if (range.Peek().Id() == CSSValueInfinite) | 330 if (range.Peek().Id() == CSSValueInfinite) |
| 330 return ConsumeIdent(range); | 331 return ConsumeIdent(range); |
| 331 return ConsumeNumber(range, kValueRangeNonNegative); | 332 return ConsumeNumber(range, kValueRangeNonNegative); |
| 332 } | 333 } |
| 333 | 334 |
| 334 static CSSValue* ConsumeAnimationName(CSSParserTokenRange& range, | |
| 335 const CSSParserContext* context, | |
| 336 bool allow_quoted_name) { | |
| 337 if (range.Peek().Id() == CSSValueNone) | |
| 338 return ConsumeIdent(range); | |
| 339 | |
| 340 if (allow_quoted_name && range.Peek().GetType() == kStringToken) { | |
| 341 // Legacy support for strings in prefixed animations. | |
| 342 context->Count(UseCounter::kQuotedAnimationName); | |
| 343 | |
| 344 const CSSParserToken& token = range.ConsumeIncludingWhitespace(); | |
| 345 if (EqualIgnoringASCIICase(token.Value(), "none")) | |
| 346 return CSSIdentifierValue::Create(CSSValueNone); | |
| 347 return CSSCustomIdentValue::Create(token.Value().ToAtomicString()); | |
| 348 } | |
| 349 | |
| 350 return ConsumeCustomIdent(range); | |
| 351 } | |
| 352 | |
| 353 static CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { | 335 static CSSValue* ConsumeTransitionProperty(CSSParserTokenRange& range) { |
| 354 const CSSParserToken& token = range.Peek(); | 336 const CSSParserToken& token = range.Peek(); |
| 355 if (token.GetType() != kIdentToken) | 337 if (token.GetType() != kIdentToken) |
| 356 return nullptr; | 338 return nullptr; |
| 357 if (token.Id() == CSSValueNone) | 339 if (token.Id() == CSSValueNone) |
| 358 return ConsumeIdent(range); | 340 return ConsumeIdent(range); |
| 359 | 341 |
| 360 CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID(); | 342 CSSPropertyID unresolved_property = token.ParseAsUnresolvedCSSPropertyID(); |
| 361 if (unresolved_property != CSSPropertyInvalid && | 343 if (unresolved_property != CSSPropertyInvalid && |
| 362 unresolved_property != CSSPropertyVariable) { | 344 unresolved_property != CSSPropertyVariable) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 CSSValueAlternateReverse>(range); | 454 CSSValueAlternateReverse>(range); |
| 473 case CSSPropertyAnimationDuration: | 455 case CSSPropertyAnimationDuration: |
| 474 case CSSPropertyTransitionDuration: | 456 case CSSPropertyTransitionDuration: |
| 475 return ConsumeTime(range, kValueRangeNonNegative); | 457 return ConsumeTime(range, kValueRangeNonNegative); |
| 476 case CSSPropertyAnimationFillMode: | 458 case CSSPropertyAnimationFillMode: |
| 477 return ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, | 459 return ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, |
| 478 CSSValueBoth>(range); | 460 CSSValueBoth>(range); |
| 479 case CSSPropertyAnimationIterationCount: | 461 case CSSPropertyAnimationIterationCount: |
| 480 return ConsumeAnimationIterationCount(range); | 462 return ConsumeAnimationIterationCount(range); |
| 481 case CSSPropertyAnimationName: | 463 case CSSPropertyAnimationName: |
| 482 return ConsumeAnimationName(range, context, use_legacy_parsing); | 464 return CSSPropertyAnimationNameUtils::ConsumeAnimationName( |
| 465 range, context, use_legacy_parsing); |
| 483 case CSSPropertyAnimationPlayState: | 466 case CSSPropertyAnimationPlayState: |
| 484 return ConsumeIdent<CSSValueRunning, CSSValuePaused>(range); | 467 return ConsumeIdent<CSSValueRunning, CSSValuePaused>(range); |
| 485 case CSSPropertyTransitionProperty: | 468 case CSSPropertyTransitionProperty: |
| 486 return ConsumeTransitionProperty(range); | 469 return ConsumeTransitionProperty(range); |
| 487 case CSSPropertyAnimationTimingFunction: | 470 case CSSPropertyAnimationTimingFunction: |
| 488 case CSSPropertyTransitionTimingFunction: | 471 case CSSPropertyTransitionTimingFunction: |
| 489 return ConsumeAnimationTimingFunction(range); | 472 return ConsumeAnimationTimingFunction(range); |
| 490 default: | 473 default: |
| 491 NOTREACHED(); | 474 NOTREACHED(); |
| 492 return nullptr; | 475 return nullptr; |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1682 case CSSPropertyTransitionDuration: | 1665 case CSSPropertyTransitionDuration: |
| 1683 return ConsumeCommaSeparatedList(ConsumeTime, range_, | 1666 return ConsumeCommaSeparatedList(ConsumeTime, range_, |
| 1684 kValueRangeNonNegative); | 1667 kValueRangeNonNegative); |
| 1685 case CSSPropertyAnimationFillMode: | 1668 case CSSPropertyAnimationFillMode: |
| 1686 return ConsumeCommaSeparatedList( | 1669 return ConsumeCommaSeparatedList( |
| 1687 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, | 1670 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, |
| 1688 CSSValueBoth>, | 1671 CSSValueBoth>, |
| 1689 range_); | 1672 range_); |
| 1690 case CSSPropertyAnimationIterationCount: | 1673 case CSSPropertyAnimationIterationCount: |
| 1691 return ConsumeCommaSeparatedList(ConsumeAnimationIterationCount, range_); | 1674 return ConsumeCommaSeparatedList(ConsumeAnimationIterationCount, range_); |
| 1692 case CSSPropertyAnimationName: | |
| 1693 return ConsumeCommaSeparatedList( | |
| 1694 ConsumeAnimationName, range_, context_, | |
| 1695 unresolved_property == CSSPropertyAliasWebkitAnimationName); | |
| 1696 case CSSPropertyAnimationPlayState: | 1675 case CSSPropertyAnimationPlayState: |
| 1697 return ConsumeCommaSeparatedList( | 1676 return ConsumeCommaSeparatedList( |
| 1698 ConsumeIdent<CSSValueRunning, CSSValuePaused>, range_); | 1677 ConsumeIdent<CSSValueRunning, CSSValuePaused>, range_); |
| 1699 case CSSPropertyTransitionProperty: { | 1678 case CSSPropertyTransitionProperty: { |
| 1700 CSSValueList* list = | 1679 CSSValueList* list = |
| 1701 ConsumeCommaSeparatedList(ConsumeTransitionProperty, range_); | 1680 ConsumeCommaSeparatedList(ConsumeTransitionProperty, range_); |
| 1702 if (!list || !IsValidAnimationPropertyList(*list)) | 1681 if (!list || !IsValidAnimationPropertyList(*list)) |
| 1703 return nullptr; | 1682 return nullptr; |
| 1704 return list; | 1683 return list; |
| 1705 } | 1684 } |
| (...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3431 case CSSPropertyPlaceItems: | 3410 case CSSPropertyPlaceItems: |
| 3432 return ConsumePlaceItemsShorthand(important); | 3411 return ConsumePlaceItemsShorthand(important); |
| 3433 case CSSPropertyPlaceSelf: | 3412 case CSSPropertyPlaceSelf: |
| 3434 return ConsumePlaceSelfShorthand(important); | 3413 return ConsumePlaceSelfShorthand(important); |
| 3435 default: | 3414 default: |
| 3436 return false; | 3415 return false; |
| 3437 } | 3416 } |
| 3438 } | 3417 } |
| 3439 | 3418 |
| 3440 } // namespace blink | 3419 } // namespace blink |
| OLD | NEW |