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

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

Issue 1603193002: Move two shape related properties into CSSPropertyParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V5 Created 4 years, 11 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 "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h"
8 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
9 #include "core/css/CSSCounterValue.h" 10 #include "core/css/CSSCounterValue.h"
10 #include "core/css/CSSCrossfadeValue.h" 11 #include "core/css/CSSCrossfadeValue.h"
11 #include "core/css/CSSCursorImageValue.h" 12 #include "core/css/CSSCursorImageValue.h"
12 #include "core/css/CSSCustomIdentValue.h" 13 #include "core/css/CSSCustomIdentValue.h"
13 #include "core/css/CSSFontFaceSrcValue.h" 14 #include "core/css/CSSFontFaceSrcValue.h"
14 #include "core/css/CSSFontFeatureValue.h" 15 #include "core/css/CSSFontFeatureValue.h"
15 #include "core/css/CSSFunctionValue.h" 16 #include "core/css/CSSFunctionValue.h"
16 #include "core/css/CSSImageSetValue.h" 17 #include "core/css/CSSImageSetValue.h"
17 #include "core/css/CSSPathValue.h" 18 #include "core/css/CSSPathValue.h"
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after
2744 } else if (id == CSSValueWebkitLinearGradient) { 2745 } else if (id == CSSValueWebkitLinearGradient) {
2745 // FIXME: This should send a deprecation message. 2746 // FIXME: This should send a deprecation message.
2746 if (context.useCounter()) 2747 if (context.useCounter())
2747 context.useCounter()->count(UseCounter::DeprecatedWebKitLinearGradie nt); 2748 context.useCounter()->count(UseCounter::DeprecatedWebKitLinearGradie nt);
2748 result = consumeLinearGradient(args, context.mode(), NonRepeating, CSSPr efixedLinearGradient); 2749 result = consumeLinearGradient(args, context.mode(), NonRepeating, CSSPr efixedLinearGradient);
2749 } else if (id == CSSValueWebkitRepeatingLinearGradient) { 2750 } else if (id == CSSValueWebkitRepeatingLinearGradient) {
2750 // FIXME: This should send a deprecation message. 2751 // FIXME: This should send a deprecation message.
2751 if (context.useCounter()) 2752 if (context.useCounter())
2752 context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingLin earGradient); 2753 context.useCounter()->count(UseCounter::DeprecatedWebKitRepeatingLin earGradient);
2753 result = consumeLinearGradient(args, context.mode(), Repeating, CSSPrefi xedLinearGradient); 2754 result = consumeLinearGradient(args, context.mode(), Repeating, CSSPrefi xedLinearGradient);
2755 } else if (id == CSSValueRepeatingLinearGradient) {
2756 result = consumeLinearGradient(args, context.mode(), Repeating, CSSLinea rGradient);
2754 } else if (id == CSSValueLinearGradient) { 2757 } else if (id == CSSValueLinearGradient) {
2755 result = consumeLinearGradient(args, context.mode(), NonRepeating, CSSLi nearGradient); 2758 result = consumeLinearGradient(args, context.mode(), NonRepeating, CSSLi nearGradient);
2756 } else if (id == CSSValueWebkitGradient) { 2759 } else if (id == CSSValueWebkitGradient) {
2757 // FIXME: This should send a deprecation message. 2760 // FIXME: This should send a deprecation message.
2758 if (context.useCounter()) 2761 if (context.useCounter())
2759 context.useCounter()->count(UseCounter::DeprecatedWebKitGradient); 2762 context.useCounter()->count(UseCounter::DeprecatedWebKitGradient);
2760 result = consumeDeprecatedGradient(args, context.mode()); 2763 result = consumeDeprecatedGradient(args, context.mode());
2761 } else if (id == CSSValueWebkitRadialGradient) { 2764 } else if (id == CSSValueWebkitRadialGradient) {
2762 // FIXME: This should send a deprecation message. 2765 // FIXME: This should send a deprecation message.
2763 if (context.useCounter()) 2766 if (context.useCounter())
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 } 2940 }
2938 2941
2939 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeVerticalAlign(CSSParserT okenRange& range, CSSParserMode cssParserMode) 2942 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeVerticalAlign(CSSParserT okenRange& range, CSSParserMode cssParserMode)
2940 { 2943 {
2941 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = consumeIdentRange(range, CSSValueBaseline, CSSValueWebkitBaselineMiddle); 2944 RefPtrWillBeRawPtr<CSSPrimitiveValue> parsedValue = consumeIdentRange(range, CSSValueBaseline, CSSValueWebkitBaselineMiddle);
2942 if (!parsedValue) 2945 if (!parsedValue)
2943 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll , UnitlessQuirk::Allow); 2946 parsedValue = consumeLengthOrPercent(range, cssParserMode, ValueRangeAll , UnitlessQuirk::Allow);
2944 return parsedValue.release(); 2947 return parsedValue.release();
2945 } 2948 }
2946 2949
2950 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeShapeRadius(CSSParserTok enRange& args, CSSParserMode cssParserMode)
2951 {
2952 if (identMatches<CSSValueClosestSide, CSSValueFarthestSide>(args.peek().id() ))
2953 return consumeIdent(args);
2954 return consumeLengthOrPercent(args, cssParserMode, ValueRangeNonNegative);
2955 }
2956
2957 static PassRefPtrWillBeRawPtr<CSSBasicShapeCircleValue> consumeBasicShapeCircle( CSSParserTokenRange& args, CSSParserContext context)
Timothy Loh 2016/01/27 00:44:03 const CSSParserContext& everywhere
rwlbuis 2016/01/27 20:02:39 Done.
2958 {
2959 // circle(radius) | circle(radius at <position>) | circle(at <position>)
Timothy Loh 2016/01/27 00:44:03 If you want to describe the syntax, it'd be better
rwlbuis 2016/01/27 20:02:39 Done.
2960 // where position defines centerX and centerY using a CSS <position> data ty pe.
2961 RefPtrWillBeRawPtr<CSSBasicShapeCircleValue> shape = CSSBasicShapeCircleValu e::create();
2962 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radius = consumeShapeRadius(args, context.mode()))
2963 shape->setRadius(radius.release());
2964 if (consumeIdent<CSSValueAt>(args)) {
2965 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
2966 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
2967 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY))
2968 return nullptr;
2969 shape->setCenterX(centerX);
2970 shape->setCenterY(centerY);
2971 }
2972 return shape.release();
2973 }
2974
2975 static PassRefPtrWillBeRawPtr<CSSBasicShapeEllipseValue> consumeBasicShapeEllips e(CSSParserTokenRange& args, CSSParserContext context)
2976 {
2977 // ellipse(radiusX) | ellipse(radiusX at <position>) | ellipse(radiusX radiu sY)
Timothy Loh 2016/01/27 00:44:03 Same as above, copy the spec text if you want this
rwlbuis 2016/01/27 20:02:39 Done.
2978 // ellipse(radiusX radiusY at <position>) | ellipse(at <position>)
2979 // where position defines centerX and centerY using a CSS <position> data ty pe.
2980 RefPtrWillBeRawPtr<CSSBasicShapeEllipseValue> shape = CSSBasicShapeEllipseVa lue::create();
2981 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radiusX = consumeShapeRadius(args, context.mode())) {
2982 shape->setRadiusX(radiusX);
2983 if (RefPtrWillBeRawPtr<CSSPrimitiveValue> radiusY = consumeShapeRadius(a rgs, context.mode()))
2984 shape->setRadiusY(radiusY);
2985 }
2986 if (consumeIdent<CSSValueAt>(args)) {
2987 RefPtrWillBeRawPtr<CSSValue> centerX = nullptr;
2988 RefPtrWillBeRawPtr<CSSValue> centerY = nullptr;
2989 if (!consumePosition(args, context.mode(), UnitlessQuirk::Forbid, center X, centerY))
2990 return nullptr;
2991 shape->setCenterX(centerX);
2992 shape->setCenterY(centerY);
2993 }
2994 return shape.release();
2995 }
2996
2997 static PassRefPtrWillBeRawPtr<CSSBasicShapePolygonValue> consumeBasicShapePolygo n(CSSParserTokenRange& args, CSSParserContext context)
2998 {
2999 RefPtrWillBeRawPtr<CSSBasicShapePolygonValue> shape = CSSBasicShapePolygonVa lue::create();
3000 if (identMatches<CSSValueEvenodd, CSSValueNonzero>(args.peek().id())) {
3001 shape->setWindRule(args.consumeIncludingWhitespace().id() == CSSValueEve nodd ? RULE_EVENODD : RULE_NONZERO);
3002 if (!consumeCommaIncludingWhitespace(args))
3003 return nullptr;
3004 }
3005
3006 do {
3007 RefPtrWillBeRawPtr<CSSPrimitiveValue> xLength = consumeLengthOrPercent(a rgs, context.mode(), ValueRangeAll);
3008 if (!xLength)
3009 return nullptr;
3010 RefPtrWillBeRawPtr<CSSPrimitiveValue> yLength = consumeLengthOrPercent(a rgs, context.mode(), ValueRangeAll);
3011 if (!yLength)
3012 return nullptr;
3013 shape->appendPoint(xLength.release(), yLength.release());
3014 } while (consumeCommaIncludingWhitespace(args));
3015 return shape.release();
3016 }
3017
3018 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4])
3019 {
3020 if (radii[3])
3021 return;
3022 if (!radii[2]) {
3023 if (!radii[1])
3024 radii[1] = radii[0];
3025 radii[2] = radii[0];
3026 }
3027 radii[3] = radii[1];
3028 }
3029
3030 static bool consumeRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRadii[4 ], RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRadii[4], CSSParserTokenRange& range, CSSParserMode cssParserMode, bool useLegacyParsing)
3031 {
3032 #if ENABLE(OILPAN)
3033 // Unconditionally zero initialize the arrays of raw pointers.
3034 memset(horizontalRadii, 0, 4 * sizeof(horizontalRadii[0]));
3035 memset(verticalRadii, 0, 4 * sizeof(verticalRadii[0]));
3036 #endif
3037 unsigned i = 0;
3038 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i ) {
3039 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative);
3040 if (!horizontalRadii[i])
3041 return false;
3042 }
3043 if (!horizontalRadii[0])
3044 return false;
3045 if (range.atEnd()) {
3046 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to border- radius: l1 / l2;
3047 if (useLegacyParsing && i == 2) {
3048 verticalRadii[0] = horizontalRadii[1];
3049 horizontalRadii[1] = nullptr;
3050 } else {
3051 completeBorderRadii(horizontalRadii);
3052 for (unsigned i = 0; i < 4; ++i)
3053 verticalRadii[i] = horizontalRadii[i];
3054 return true;
3055 }
3056 } else {
3057 if (range.peek().type() != DelimiterToken || range.peek().delimiter() != '/')
3058 return false;
3059 range.consumeIncludingWhitespace();
3060 for (i = 0; i < 4 && !range.atEnd(); ++i) {
3061 verticalRadii[i] = consumeLengthOrPercent(range, cssParserMode, Valu eRangeNonNegative);
3062 if (!verticalRadii[i])
3063 return false;
3064 }
3065 if (!verticalRadii[0] || !range.atEnd())
3066 return false;
3067 }
3068 completeBorderRadii(horizontalRadii);
3069 completeBorderRadii(verticalRadii);
3070 return true;
3071 }
3072
3073 static PassRefPtrWillBeRawPtr<CSSBasicShapeInsetValue> consumeBasicShapeInset(CS SParserTokenRange& args, CSSParserContext context)
3074 {
3075 RefPtrWillBeRawPtr<CSSBasicShapeInsetValue> shape = CSSBasicShapeInsetValue: :create();
3076 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = consumeLengthOrPercent(args, con text.mode(), ValueRangeAll);
3077 if (!top)
3078 return nullptr;
3079 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr;
3080 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr;
3081 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr;
3082 if ((right = consumeLengthOrPercent(args, context.mode(), ValueRangeAll))) {
3083 if ((bottom = consumeLengthOrPercent(args, context.mode(), ValueRangeAll )))
3084 left = consumeLengthOrPercent(args, context.mode(), ValueRangeAll);
3085 }
3086 if (left)
3087 shape->updateShapeSize4Values(top.get(), right.get(), bottom.get(), left .get());
3088 else if (bottom)
3089 shape->updateShapeSize3Values(top.get(), right.get(), bottom.get());
3090 else if (right)
3091 shape->updateShapeSize2Values(top.get(), right.get());
3092 else
3093 shape->updateShapeSize1Value(top.get());
3094
3095 if (consumeIdent<CSSValueRound>(args)) {
3096 RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRadii[4];
3097 RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRadii[4];
3098 if (!consumeRadii(horizontalRadii, verticalRadii, args, context.mode(), false))
3099 return nullptr;
3100 shape->setTopLeftRadius(CSSValuePair::create(horizontalRadii[0].release( ), verticalRadii[0].release(), CSSValuePair::DropIdenticalValues));
3101 shape->setTopRightRadius(CSSValuePair::create(horizontalRadii[1].release (), verticalRadii[1].release(), CSSValuePair::DropIdenticalValues));
3102 shape->setBottomRightRadius(CSSValuePair::create(horizontalRadii[2].rele ase(), verticalRadii[2].release(), CSSValuePair::DropIdenticalValues));
3103 shape->setBottomLeftRadius(CSSValuePair::create(horizontalRadii[3].relea se(), verticalRadii[3].release(), CSSValuePair::DropIdenticalValues));
3104 }
3105 return shape.release();
3106 }
3107
3108 static PassRefPtrWillBeRawPtr<CSSValue> consumeBasicShape(CSSParserTokenRange& r ange, CSSParserContext context)
3109 {
3110 RefPtrWillBeRawPtr<CSSValue> shape = nullptr;
3111 if (range.peek().type() != FunctionToken)
3112 return nullptr;
3113 CSSValueID id = range.peek().functionId();
3114 CSSParserTokenRange rangeCopy = range;
3115 CSSParserTokenRange args = consumeFunction(rangeCopy);
3116 if (id == CSSValueCircle)
3117 shape = consumeBasicShapeCircle(args, context);
3118 else if (id == CSSValueEllipse)
3119 shape = consumeBasicShapeEllipse(args, context);
3120 else if (id == CSSValuePolygon)
3121 shape = consumeBasicShapePolygon(args, context);
3122 else if (id == CSSValueInset)
3123 shape = consumeBasicShapeInset(args, context);
3124 if (!shape || !args.atEnd())
3125 return nullptr;
3126 range = rangeCopy;
3127 return shape.release();
3128 }
3129
3130 static PassRefPtrWillBeRawPtr<CSSValue> consumeClipPath(CSSParserTokenRange& ran ge, CSSParserContext context)
3131 {
3132 if (range.peek().id() == CSSValueNone)
3133 return consumeIdent(range);
3134 String url = consumeUrl(range);
3135 if (!url.isNull())
3136 return CSSURIValue::create(url);
3137 return consumeBasicShape(range, context);
3138 }
3139
3140 static PassRefPtrWillBeRawPtr<CSSValue> consumeShapeOutside(CSSParserTokenRange& range, CSSParserContext context)
3141 {
3142 if (range.peek().id() == CSSValueNone)
3143 return consumeIdent(range);
3144 if (RefPtrWillBeRawPtr<CSSValue> imageValue = consumeImage(range, context))
3145 return imageValue.release();
3146 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
3147 if (RefPtrWillBeRawPtr<CSSValue> boxValue = consumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, CSSValueMarginBox>(range))
3148 list->append(boxValue.release());
3149 if (RefPtrWillBeRawPtr<CSSValue> shapeValue = consumeBasicShape(range, conte xt)) {
3150 list->append(shapeValue.release());
3151 if (list->length() < 2) {
3152 if (RefPtrWillBeRawPtr<CSSValue> boxValue = consumeIdent<CSSValueCon tentBox, CSSValuePaddingBox, CSSValueBorderBox, CSSValueMarginBox>(range))
3153 list->append(boxValue.release());
3154 }
3155 }
3156 if (!list->length())
3157 return nullptr;
3158 return list.release();
3159 }
3160
2947 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty) 3161 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSProperty ID unresolvedProperty)
2948 { 3162 {
2949 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 3163 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
2950 if (CSSParserFastPaths::isKeywordPropertyID(property)) { 3164 if (CSSParserFastPaths::isKeywordPropertyID(property)) {
2951 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id())) 3165 if (!CSSParserFastPaths::isValidKeywordPropertyAndValue(property, m_rang e.peek().id()))
2952 return nullptr; 3166 return nullptr;
2953 return consumeIdent(m_range); 3167 return consumeIdent(m_range);
2954 } 3168 }
2955 switch (property) { 3169 switch (property) {
2956 case CSSPropertyWillChange: 3170 case CSSPropertyWillChange:
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
3233 case CSSPropertyWebkitBoxFlexGroup: 3447 case CSSPropertyWebkitBoxFlexGroup:
3234 return consumeInteger(m_range, 0); 3448 return consumeInteger(m_range, 0);
3235 case CSSPropertyOrder: 3449 case CSSPropertyOrder:
3236 return consumeInteger(m_range); 3450 return consumeInteger(m_range);
3237 case CSSPropertyTextUnderlinePosition: 3451 case CSSPropertyTextUnderlinePosition:
3238 // auto | [ under || [ left | right ] ], but we only support auto | unde r for now 3452 // auto | [ under || [ left | right ] ], but we only support auto | unde r for now
3239 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled()); 3453 ASSERT(RuntimeEnabledFeatures::css3TextDecorationsEnabled());
3240 return consumeIdent<CSSValueAuto, CSSValueUnder>(m_range); 3454 return consumeIdent<CSSValueAuto, CSSValueUnder>(m_range);
3241 case CSSPropertyVerticalAlign: 3455 case CSSPropertyVerticalAlign:
3242 return consumeVerticalAlign(m_range, m_context.mode()); 3456 return consumeVerticalAlign(m_range, m_context.mode());
3457 case CSSPropertyShapeOutside:
3458 return consumeShapeOutside(m_range, m_context);
3459 case CSSPropertyWebkitClipPath:
3460 return consumeClipPath(m_range, m_context);
3243 default: 3461 default:
3244 CSSParserValueList valueList(m_range); 3462 CSSParserValueList valueList(m_range);
3245 if (valueList.size()) { 3463 if (valueList.size()) {
3246 m_valueList = &valueList; 3464 m_valueList = &valueList;
3247 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) { 3465 if (RefPtrWillBeRawPtr<CSSValue> result = legacyParseValue(unresolve dProperty)) {
3248 while (!m_range.atEnd()) 3466 while (!m_range.atEnd())
3249 m_range.consume(); 3467 m_range.consume();
3250 return result.release(); 3468 return result.release();
3251 } 3469 }
3252 } 3470 }
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3751 left = right; 3969 left = right;
3752 3970
3753 addProperty(longhands[0], top.release(), important); 3971 addProperty(longhands[0], top.release(), important);
3754 addProperty(longhands[1], right.release(), important); 3972 addProperty(longhands[1], right.release(), important);
3755 addProperty(longhands[2], bottom.release(), important); 3973 addProperty(longhands[2], bottom.release(), important);
3756 addProperty(longhands[3], left.release(), important); 3974 addProperty(longhands[3], left.release(), important);
3757 3975
3758 return m_range.atEnd(); 3976 return m_range.atEnd();
3759 } 3977 }
3760 3978
3761 static bool consumeRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> horizontalRadii[4 ], RefPtrWillBeRawPtr<CSSPrimitiveValue> verticalRadii[4], CSSParserTokenRange& range, CSSParserMode cssParserMode, bool useLegacyParsing)
3762 {
3763 #if ENABLE(OILPAN)
3764 // Unconditionally zero initialize the arrays of raw pointers.
3765 memset(horizontalRadii, 0, 4 * sizeof(horizontalRadii[0]));
3766 memset(verticalRadii, 0, 4 * sizeof(verticalRadii[0]));
3767 #endif
3768 unsigned i = 0;
3769 for (; i < 4 && !range.atEnd() && range.peek().type() != DelimiterToken; ++i ) {
3770 horizontalRadii[i] = consumeLengthOrPercent(range, cssParserMode, ValueR angeNonNegative);
3771 if (!horizontalRadii[i])
3772 return false;
3773 }
3774 if (!horizontalRadii[0])
3775 return false;
3776 if (range.atEnd()) {
3777 // Legacy syntax: -webkit-border-radius: l1 l2; is equivalent to border- radius: l1 / l2;
3778 if (useLegacyParsing && i == 2) {
3779 verticalRadii[0] = horizontalRadii[1];
3780 horizontalRadii[1] = nullptr;
3781 } else {
3782 completeBorderRadii(horizontalRadii);
3783 for (unsigned i = 0; i < 4; ++i)
3784 verticalRadii[i] = horizontalRadii[i];
3785 return true;
3786 }
3787 } else {
3788 if (range.peek().type() != DelimiterToken || range.peek().delimiter() != '/')
3789 return false;
3790 range.consumeIncludingWhitespace();
3791 for (i = 0; i < 4 && !range.atEnd(); ++i) {
3792 verticalRadii[i] = consumeLengthOrPercent(range, cssParserMode, Valu eRangeNonNegative);
3793 if (!verticalRadii[i])
3794 return false;
3795 }
3796 if (!verticalRadii[0] || !range.atEnd())
3797 return false;
3798 }
3799 completeBorderRadii(horizontalRadii);
3800 completeBorderRadii(verticalRadii);
3801 return true;
3802 }
3803
3804 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant) 3979 bool CSSPropertyParser::parseShorthand(CSSPropertyID unresolvedProperty, bool im portant)
3805 { 3980 {
3806 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty); 3981 CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
3807 3982
3808 CSSPropertyID oldShorthand = m_currentShorthand; 3983 CSSPropertyID oldShorthand = m_currentShorthand;
3809 // TODO(rob.buis): Remove this when the legacy property parser is gone 3984 // TODO(rob.buis): Remove this when the legacy property parser is gone
3810 m_currentShorthand = property; 3985 m_currentShorthand = property;
3811 switch (property) { 3986 switch (property) {
3812 case CSSPropertyWebkitMarginCollapse: { 3987 case CSSPropertyWebkitMarginCollapse: {
3813 CSSValueID id = m_range.consumeIncludingWhitespace().id(); 3988 CSSValueID id = m_range.consumeIncludingWhitespace().id();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
3936 m_currentShorthand = oldShorthand; 4111 m_currentShorthand = oldShorthand;
3937 CSSParserValueList valueList(m_range); 4112 CSSParserValueList valueList(m_range);
3938 if (!valueList.size()) 4113 if (!valueList.size())
3939 return false; 4114 return false;
3940 m_valueList = &valueList; 4115 m_valueList = &valueList;
3941 return legacyParseShorthand(unresolvedProperty, important); 4116 return legacyParseShorthand(unresolvedProperty, important);
3942 } 4117 }
3943 } 4118 }
3944 4119
3945 } // namespace blink 4120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698