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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
index 53eae84f694221d69e58fba1b700446bd189bb7f..7674a1d83526a3a12a61459352eefee7f51eda7d 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp
@@ -940,9 +940,19 @@ static CSSPrimitiveValue* ConsumeAngleOrPercent(CSSParserTokenRange& range,
CSSParserMode,
ValueRange value_range,
UnitlessQuirk) {
- return range.Peek().GetType() == kPercentageToken
- ? ConsumePercent(range, value_range)
- : ConsumeAngle(range);
+ const CSSParserToken& token = range.Peek();
+ if (token.GetType() == kDimensionToken || token.GetType() == kNumberToken)
+ return ConsumeAngle(range);
+ if (token.GetType() == kPercentageToken)
+ return ConsumePercent(range, value_range);
+ CalcParser calc_parser(range, value_range);
+ if (const CSSCalcValue* calculation = calc_parser.Value()) {
+ CalculationCategory category = calculation->Category();
+ // TODO(fs): Add and support kCalcPercentAngle?
+ if (category == kCalcAngle || category == kCalcPercent)
+ return calc_parser.ConsumeValue();
+ }
+ return nullptr;
}
using PositionFunctor = CSSPrimitiveValue* (*)(CSSParserTokenRange&,
« 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