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

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

Issue 2813583002: Support calc(...) in ConsumeAngleOrPercent / for conic-gradient (Closed)
Patch Set: TypedOM CSSRotation fixup Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/CSSPropertyParserHelpers.h" 5 #include "core/css/parser/CSSPropertyParserHelpers.h"
6 6
7 #include "core/css/CSSCalculationValue.h" 7 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSColorValue.h" 8 #include "core/css/CSSColorValue.h"
9 #include "core/css/CSSCrossfadeValue.h" 9 #include "core/css/CSSCrossfadeValue.h"
10 #include "core/css/CSSGradientValue.h" 10 #include "core/css/CSSGradientValue.h"
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 result->AddStop(stop); 933 result->AddStop(stop);
934 } 934 }
935 935
936 return result; 936 return result;
937 } 937 }
938 938
939 static CSSPrimitiveValue* ConsumeAngleOrPercent(CSSParserTokenRange& range, 939 static CSSPrimitiveValue* ConsumeAngleOrPercent(CSSParserTokenRange& range,
940 CSSParserMode, 940 CSSParserMode,
941 ValueRange value_range, 941 ValueRange value_range,
942 UnitlessQuirk) { 942 UnitlessQuirk) {
943 return range.Peek().GetType() == kPercentageToken 943 const CSSParserToken& token = range.Peek();
944 ? ConsumePercent(range, value_range) 944 if (token.GetType() == kDimensionToken || token.GetType() == kNumberToken)
945 : ConsumeAngle(range); 945 return ConsumeAngle(range);
946 if (token.GetType() == kPercentageToken)
947 return ConsumePercent(range, value_range);
948 CalcParser calc_parser(range, value_range);
949 if (const CSSCalcValue* calculation = calc_parser.Value()) {
950 CalculationCategory category = calculation->Category();
951 // TODO(fs): Add and support kCalcPercentAngle?
952 if (category == kCalcAngle || category == kCalcPercent)
953 return calc_parser.ConsumeValue();
954 }
955 return nullptr;
946 } 956 }
947 957
948 using PositionFunctor = CSSPrimitiveValue* (*)(CSSParserTokenRange&, 958 using PositionFunctor = CSSPrimitiveValue* (*)(CSSParserTokenRange&,
949 CSSParserMode, 959 CSSParserMode,
950 ValueRange, 960 ValueRange,
951 UnitlessQuirk); 961 UnitlessQuirk);
952 962
953 static bool ConsumeGradientColorStops(CSSParserTokenRange& range, 963 static bool ConsumeGradientColorStops(CSSParserTokenRange& range,
954 CSSParserMode css_parser_mode, 964 CSSParserMode css_parser_mode,
955 CSSGradientValue* gradient, 965 CSSGradientValue* gradient,
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1436
1427 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box 1437 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
1428 CSSIdentifierValue* ConsumeShapeBox(CSSParserTokenRange& range) { 1438 CSSIdentifierValue* ConsumeShapeBox(CSSParserTokenRange& range) {
1429 return ConsumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, 1439 return ConsumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox,
1430 CSSValueMarginBox>(range); 1440 CSSValueMarginBox>(range);
1431 } 1441 }
1432 1442
1433 } // namespace CSSPropertyParserHelpers 1443 } // namespace CSSPropertyParserHelpers
1434 1444
1435 } // namespace blink 1445 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CSSRotation.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698