| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "core/css/properties/CSSPropertyShapeUtils.h" | 51 #include "core/css/properties/CSSPropertyShapeUtils.h" |
| 52 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" | 52 #include "core/css/properties/CSSPropertyWebkitBorderWidthUtils.h" |
| 53 #include "core/frame/UseCounter.h" | 53 #include "core/frame/UseCounter.h" |
| 54 #include "core/layout/LayoutTheme.h" | 54 #include "core/layout/LayoutTheme.h" |
| 55 #include "platform/wtf/text/StringBuilder.h" | 55 #include "platform/wtf/text/StringBuilder.h" |
| 56 | 56 |
| 57 namespace blink { | 57 namespace blink { |
| 58 | 58 |
| 59 using namespace CSSPropertyParserHelpers; | 59 using namespace CSSPropertyParserHelpers; |
| 60 | 60 |
| 61 const bool kNoOptimisation = false; |
| 62 |
| 61 CSSPropertyParser::CSSPropertyParser( | 63 CSSPropertyParser::CSSPropertyParser( |
| 62 const CSSParserTokenRange& range, | 64 const CSSParserTokenRange& range, |
| 63 const CSSParserContext* context, | 65 const CSSParserContext* context, |
| 64 HeapVector<CSSProperty, 256>* parsed_properties) | 66 HeapVector<CSSProperty, 256>* parsed_properties) |
| 65 : range_(range), context_(context), parsed_properties_(parsed_properties) { | 67 : range_(range), context_(context), parsed_properties_(parsed_properties) { |
| 66 range_.ConsumeWhitespace(); | 68 range_.ConsumeWhitespace(); |
| 67 } | 69 } |
| 68 | 70 |
| 69 void CSSPropertyParser::AddProperty(CSSPropertyID property, | 71 void CSSPropertyParser::AddProperty(CSSPropertyID property, |
| 70 CSSPropertyID current_shorthand, | 72 CSSPropertyID current_shorthand, |
| (...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 return CSSPropertyLengthUtils::ConsumeWidthOrHeight(range_, *context_); | 1650 return CSSPropertyLengthUtils::ConsumeWidthOrHeight(range_, *context_); |
| 1649 case CSSPropertyScrollSnapDestination: | 1651 case CSSPropertyScrollSnapDestination: |
| 1650 case CSSPropertyObjectPosition: | 1652 case CSSPropertyObjectPosition: |
| 1651 case CSSPropertyPerspectiveOrigin: | 1653 case CSSPropertyPerspectiveOrigin: |
| 1652 return ConsumePosition(range_, context_->Mode(), UnitlessQuirk::kForbid); | 1654 return ConsumePosition(range_, context_->Mode(), UnitlessQuirk::kForbid); |
| 1653 case CSSPropertyWebkitHyphenateCharacter: | 1655 case CSSPropertyWebkitHyphenateCharacter: |
| 1654 case CSSPropertyWebkitLocale: | 1656 case CSSPropertyWebkitLocale: |
| 1655 return ConsumeLocale(range_); | 1657 return ConsumeLocale(range_); |
| 1656 case CSSPropertyAnimationDelay: | 1658 case CSSPropertyAnimationDelay: |
| 1657 case CSSPropertyTransitionDelay: | 1659 case CSSPropertyTransitionDelay: |
| 1658 return ConsumeCommaSeparatedList(ConsumeTime, range_, kValueRangeAll); | 1660 return ConsumeCommaSeparatedList(kNoOptimisation, ConsumeTime, range_, |
| 1661 kValueRangeAll); |
| 1659 case CSSPropertyAnimationDirection: | 1662 case CSSPropertyAnimationDirection: |
| 1660 return ConsumeCommaSeparatedList( | 1663 return ConsumeCommaSeparatedList( |
| 1664 kNoOptimisation, |
| 1661 ConsumeIdent<CSSValueNormal, CSSValueAlternate, CSSValueReverse, | 1665 ConsumeIdent<CSSValueNormal, CSSValueAlternate, CSSValueReverse, |
| 1662 CSSValueAlternateReverse>, | 1666 CSSValueAlternateReverse>, |
| 1663 range_); | 1667 range_); |
| 1664 case CSSPropertyAnimationDuration: | 1668 case CSSPropertyAnimationDuration: |
| 1665 case CSSPropertyTransitionDuration: | 1669 case CSSPropertyTransitionDuration: |
| 1666 return ConsumeCommaSeparatedList(ConsumeTime, range_, | 1670 return ConsumeCommaSeparatedList(kNoOptimisation, ConsumeTime, range_, |
| 1667 kValueRangeNonNegative); | 1671 kValueRangeNonNegative); |
| 1668 case CSSPropertyAnimationFillMode: | 1672 case CSSPropertyAnimationFillMode: |
| 1669 return ConsumeCommaSeparatedList( | 1673 return ConsumeCommaSeparatedList( |
| 1674 kNoOptimisation, |
| 1670 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, | 1675 ConsumeIdent<CSSValueNone, CSSValueForwards, CSSValueBackwards, |
| 1671 CSSValueBoth>, | 1676 CSSValueBoth>, |
| 1672 range_); | 1677 range_); |
| 1673 case CSSPropertyAnimationIterationCount: | 1678 case CSSPropertyAnimationIterationCount: |
| 1674 return ConsumeCommaSeparatedList(ConsumeAnimationIterationCount, range_); | 1679 return ConsumeCommaSeparatedList(kNoOptimisation, |
| 1680 ConsumeAnimationIterationCount, range_); |
| 1675 case CSSPropertyAnimationName: | 1681 case CSSPropertyAnimationName: |
| 1676 return ConsumeCommaSeparatedList( | 1682 return ConsumeCommaSeparatedList( |
| 1677 ConsumeAnimationName, range_, context_, | 1683 kNoOptimisation, ConsumeAnimationName, range_, context_, |
| 1678 unresolved_property == CSSPropertyAliasWebkitAnimationName); | 1684 unresolved_property == CSSPropertyAliasWebkitAnimationName); |
| 1679 case CSSPropertyAnimationPlayState: | 1685 case CSSPropertyAnimationPlayState: |
| 1680 return ConsumeCommaSeparatedList( | 1686 return ConsumeCommaSeparatedList( |
| 1681 ConsumeIdent<CSSValueRunning, CSSValuePaused>, range_); | 1687 kNoOptimisation, ConsumeIdent<CSSValueRunning, CSSValuePaused>, |
| 1688 range_); |
| 1682 case CSSPropertyTransitionProperty: { | 1689 case CSSPropertyTransitionProperty: { |
| 1683 CSSValueList* list = | 1690 CSSValue* list = ConsumeCommaSeparatedList( |
| 1684 ConsumeCommaSeparatedList(ConsumeTransitionProperty, range_); | 1691 kNoOptimisation, ConsumeTransitionProperty, range_); |
| 1685 if (!list || !IsValidAnimationPropertyList(*list)) | 1692 DCHECK(!list || list->IsBaseValueList()); |
| 1693 if (!list || !IsValidAnimationPropertyList(*ToCSSValueList(list))) |
| 1686 return nullptr; | 1694 return nullptr; |
| 1687 return list; | 1695 return list; |
| 1688 } | 1696 } |
| 1689 case CSSPropertyAnimationTimingFunction: | 1697 case CSSPropertyAnimationTimingFunction: |
| 1690 case CSSPropertyTransitionTimingFunction: | 1698 case CSSPropertyTransitionTimingFunction: |
| 1691 return ConsumeCommaSeparatedList(ConsumeAnimationTimingFunction, range_); | 1699 return ConsumeCommaSeparatedList(kNoOptimisation, |
| 1700 ConsumeAnimationTimingFunction, range_); |
| 1692 case CSSPropertyGridColumnGap: | 1701 case CSSPropertyGridColumnGap: |
| 1693 case CSSPropertyGridRowGap: | 1702 case CSSPropertyGridRowGap: |
| 1694 return ConsumeLengthOrPercent(range_, context_->Mode(), | 1703 return ConsumeLengthOrPercent(range_, context_->Mode(), |
| 1695 kValueRangeNonNegative); | 1704 kValueRangeNonNegative); |
| 1696 case CSSPropertyColor: | 1705 case CSSPropertyColor: |
| 1697 case CSSPropertyBackgroundColor: | 1706 case CSSPropertyBackgroundColor: |
| 1698 return ConsumeColor(range_, context_->Mode(), InQuirksMode()); | 1707 return ConsumeColor(range_, context_->Mode(), InQuirksMode()); |
| 1699 case CSSPropertyBorderBottomColor: | 1708 case CSSPropertyBorderBottomColor: |
| 1700 case CSSPropertyBorderLeftColor: | 1709 case CSSPropertyBorderLeftColor: |
| 1701 case CSSPropertyBorderRightColor: | 1710 case CSSPropertyBorderRightColor: |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3411 case CSSPropertyPlaceItems: | 3420 case CSSPropertyPlaceItems: |
| 3412 return ConsumePlaceItemsShorthand(important); | 3421 return ConsumePlaceItemsShorthand(important); |
| 3413 case CSSPropertyPlaceSelf: | 3422 case CSSPropertyPlaceSelf: |
| 3414 return ConsumePlaceSelfShorthand(important); | 3423 return ConsumePlaceSelfShorthand(important); |
| 3415 default: | 3424 default: |
| 3416 return false; | 3425 return false; |
| 3417 } | 3426 } |
| 3418 } | 3427 } |
| 3419 | 3428 |
| 3420 } // namespace blink | 3429 } // namespace blink |
| OLD | NEW |