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

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

Issue 2898133002: CSS: Use count unitless 0 supplied as <angle> (Closed)
Patch Set: test Created 3 years, 6 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 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 if (token.GetType() == kPercentageToken) 316 if (token.GetType() == kPercentageToken)
317 return ConsumePercent(range, value_range); 317 return ConsumePercent(range, value_range);
318 CalcParser calc_parser(range, value_range); 318 CalcParser calc_parser(range, value_range);
319 if (const CSSCalcValue* calculation = calc_parser.Value()) { 319 if (const CSSCalcValue* calculation = calc_parser.Value()) {
320 if (CanConsumeCalcValue(calculation->Category(), css_parser_mode)) 320 if (CanConsumeCalcValue(calculation->Category(), css_parser_mode))
321 return calc_parser.ConsumeValue(); 321 return calc_parser.ConsumeValue();
322 } 322 }
323 return nullptr; 323 return nullptr;
324 } 324 }
325 325
326 CSSPrimitiveValue* ConsumeAngle(CSSParserTokenRange& range) { 326 CSSPrimitiveValue* ConsumeGradientLengthOrPercent(
327 CSSParserTokenRange& range,
328 const CSSParserContext& context,
329 ValueRange value_range,
330 UnitlessQuirk unitless) {
331 return ConsumeLengthOrPercent(range, context.Mode(), value_range, unitless);
332 }
333
334 CSSPrimitiveValue* ConsumeAngle(
335 CSSParserTokenRange& range,
336 const CSSParserContext& context,
337 WTF::Optional<UseCounter::Feature> unitlessZeroFeature) {
327 const CSSParserToken& token = range.Peek(); 338 const CSSParserToken& token = range.Peek();
328 if (token.GetType() == kDimensionToken) { 339 if (token.GetType() == kDimensionToken) {
329 switch (token.GetUnitType()) { 340 switch (token.GetUnitType()) {
330 case CSSPrimitiveValue::UnitType::kDegrees: 341 case CSSPrimitiveValue::UnitType::kDegrees:
331 case CSSPrimitiveValue::UnitType::kRadians: 342 case CSSPrimitiveValue::UnitType::kRadians:
332 case CSSPrimitiveValue::UnitType::kGradians: 343 case CSSPrimitiveValue::UnitType::kGradians:
333 case CSSPrimitiveValue::UnitType::kTurns: 344 case CSSPrimitiveValue::UnitType::kTurns:
334 return CSSPrimitiveValue::Create( 345 return CSSPrimitiveValue::Create(
335 range.ConsumeIncludingWhitespace().NumericValue(), 346 range.ConsumeIncludingWhitespace().NumericValue(),
336 token.GetUnitType()); 347 token.GetUnitType());
337 default: 348 default:
338 return nullptr; 349 return nullptr;
339 } 350 }
340 } 351 }
341 if (token.GetType() == kNumberToken && token.NumericValue() == 0) { 352 if (token.GetType() == kNumberToken && token.NumericValue() == 0 &&
353 unitlessZeroFeature) {
342 range.ConsumeIncludingWhitespace(); 354 range.ConsumeIncludingWhitespace();
355 context.Count(*unitlessZeroFeature);
343 return CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees); 356 return CSSPrimitiveValue::Create(0, CSSPrimitiveValue::UnitType::kDegrees);
344 } 357 }
345 CalcParser calc_parser(range, kValueRangeAll); 358 CalcParser calc_parser(range, kValueRangeAll);
346 if (const CSSCalcValue* calculation = calc_parser.Value()) { 359 if (const CSSCalcValue* calculation = calc_parser.Value()) {
347 if (calculation->Category() == kCalcAngle) 360 if (calculation->Category() == kCalcAngle)
348 return calc_parser.ConsumeValue(); 361 return calc_parser.ConsumeValue();
349 } 362 }
350 return nullptr; 363 return nullptr;
351 } 364 }
352 365
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 CSSGradientColorStop stop; 964 CSSGradientColorStop stop;
952 while (ConsumeCommaIncludingWhitespace(args)) { 965 while (ConsumeCommaIncludingWhitespace(args)) {
953 if (!ConsumeDeprecatedGradientColorStop(args, stop, css_parser_mode)) 966 if (!ConsumeDeprecatedGradientColorStop(args, stop, css_parser_mode))
954 return nullptr; 967 return nullptr;
955 result->AddStop(stop); 968 result->AddStop(stop);
956 } 969 }
957 970
958 return result; 971 return result;
959 } 972 }
960 973
961 static CSSPrimitiveValue* ConsumeAngleOrPercent(CSSParserTokenRange& range, 974 static CSSPrimitiveValue* ConsumeGradientAngleOrPercent(
962 CSSParserMode, 975 CSSParserTokenRange& range,
963 ValueRange value_range, 976 const CSSParserContext& context,
964 UnitlessQuirk) { 977 ValueRange value_range,
978 UnitlessQuirk) {
965 const CSSParserToken& token = range.Peek(); 979 const CSSParserToken& token = range.Peek();
966 if (token.GetType() == kDimensionToken || token.GetType() == kNumberToken) 980 if (token.GetType() == kDimensionToken || token.GetType() == kNumberToken) {
967 return ConsumeAngle(range); 981 return ConsumeAngle(range, context, UseCounter::kUnitlessZeroAngleGradient);
982 }
968 if (token.GetType() == kPercentageToken) 983 if (token.GetType() == kPercentageToken)
969 return ConsumePercent(range, value_range); 984 return ConsumePercent(range, value_range);
970 CalcParser calc_parser(range, value_range); 985 CalcParser calc_parser(range, value_range);
971 if (const CSSCalcValue* calculation = calc_parser.Value()) { 986 if (const CSSCalcValue* calculation = calc_parser.Value()) {
972 CalculationCategory category = calculation->Category(); 987 CalculationCategory category = calculation->Category();
973 // TODO(fs): Add and support kCalcPercentAngle? 988 // TODO(fs): Add and support kCalcPercentAngle?
974 if (category == kCalcAngle || category == kCalcPercent) 989 if (category == kCalcAngle || category == kCalcPercent)
975 return calc_parser.ConsumeValue(); 990 return calc_parser.ConsumeValue();
976 } 991 }
977 return nullptr; 992 return nullptr;
978 } 993 }
979 994
980 using PositionFunctor = CSSPrimitiveValue* (*)(CSSParserTokenRange&, 995 using PositionFunctor = CSSPrimitiveValue* (*)(CSSParserTokenRange&,
981 CSSParserMode, 996 const CSSParserContext&,
982 ValueRange, 997 ValueRange,
983 UnitlessQuirk); 998 UnitlessQuirk);
984 999
985 static bool ConsumeGradientColorStops(CSSParserTokenRange& range, 1000 static bool ConsumeGradientColorStops(CSSParserTokenRange& range,
986 CSSParserMode css_parser_mode, 1001 const CSSParserContext& context,
987 CSSGradientValue* gradient, 1002 CSSGradientValue* gradient,
988 PositionFunctor consume_position_func) { 1003 PositionFunctor consume_position_func) {
989 bool supports_color_hints = gradient->GradientType() == kCSSLinearGradient || 1004 bool supports_color_hints = gradient->GradientType() == kCSSLinearGradient ||
990 gradient->GradientType() == kCSSRadialGradient || 1005 gradient->GradientType() == kCSSRadialGradient ||
991 gradient->GradientType() == kCSSConicGradient; 1006 gradient->GradientType() == kCSSConicGradient;
992 1007
993 // The first color stop cannot be a color hint. 1008 // The first color stop cannot be a color hint.
994 bool previous_stop_was_color_hint = true; 1009 bool previous_stop_was_color_hint = true;
995 do { 1010 do {
996 CSSGradientColorStop stop; 1011 CSSGradientColorStop stop;
997 stop.color_ = ConsumeColor(range, css_parser_mode); 1012 stop.color_ = ConsumeColor(range, context.Mode());
998 // Two hints in a row are not allowed. 1013 // Two hints in a row are not allowed.
999 if (!stop.color_ && (!supports_color_hints || previous_stop_was_color_hint)) 1014 if (!stop.color_ && (!supports_color_hints || previous_stop_was_color_hint))
1000 return false; 1015 return false;
1001 previous_stop_was_color_hint = !stop.color_; 1016 previous_stop_was_color_hint = !stop.color_;
1002 stop.offset_ = consume_position_func(range, css_parser_mode, kValueRangeAll, 1017 stop.offset_ = consume_position_func(range, context, kValueRangeAll,
1003 UnitlessQuirk::kForbid); 1018 UnitlessQuirk::kForbid);
1004 if (!stop.color_ && !stop.offset_) 1019 if (!stop.color_ && !stop.offset_)
1005 return false; 1020 return false;
1006 gradient->AddStop(stop); 1021 gradient->AddStop(stop);
1007 1022
1008 if (RuntimeEnabledFeatures::multipleColorStopPositionsEnabled()) { 1023 if (RuntimeEnabledFeatures::multipleColorStopPositionsEnabled()) {
1009 if (!stop.color_ || !stop.offset_) 1024 if (!stop.color_ || !stop.offset_)
1010 continue; 1025 continue;
1011 1026
1012 // Optional second position. 1027 // Optional second position.
1013 stop.offset_ = consume_position_func( 1028 stop.offset_ = consume_position_func(range, context, kValueRangeAll,
1014 range, css_parser_mode, kValueRangeAll, UnitlessQuirk::kForbid); 1029 UnitlessQuirk::kForbid);
1015 if (stop.offset_) 1030 if (stop.offset_)
1016 gradient->AddStop(stop); 1031 gradient->AddStop(stop);
1017 } 1032 }
1018 } while (ConsumeCommaIncludingWhitespace(range)); 1033 } while (ConsumeCommaIncludingWhitespace(range));
1019 1034
1020 // The last color stop cannot be a color hint. 1035 // The last color stop cannot be a color hint.
1021 if (previous_stop_was_color_hint) 1036 if (previous_stop_was_color_hint)
1022 return false; 1037 return false;
1023 1038
1024 // Must have 2 or more stops to be valid. 1039 // Must have 2 or more stops to be valid.
1025 return gradient->StopCount() >= 2; 1040 return gradient->StopCount() >= 2;
1026 } 1041 }
1027 1042
1028 static CSSValue* ConsumeDeprecatedRadialGradient(CSSParserTokenRange& args, 1043 static CSSValue* ConsumeDeprecatedRadialGradient(
1029 CSSParserMode css_parser_mode, 1044 CSSParserTokenRange& args,
1030 CSSGradientRepeat repeating) { 1045 const CSSParserContext& context,
1046 CSSGradientRepeat repeating) {
1031 CSSValue* center_x = nullptr; 1047 CSSValue* center_x = nullptr;
1032 CSSValue* center_y = nullptr; 1048 CSSValue* center_y = nullptr;
1033 ConsumeOneOrTwoValuedPosition(args, css_parser_mode, UnitlessQuirk::kForbid, 1049 ConsumeOneOrTwoValuedPosition(args, context.Mode(), UnitlessQuirk::kForbid,
1034 center_x, center_y); 1050 center_x, center_y);
1035 if ((center_x || center_y) && !ConsumeCommaIncludingWhitespace(args)) 1051 if ((center_x || center_y) && !ConsumeCommaIncludingWhitespace(args))
1036 return nullptr; 1052 return nullptr;
1037 1053
1038 const CSSIdentifierValue* shape = 1054 const CSSIdentifierValue* shape =
1039 ConsumeIdent<CSSValueCircle, CSSValueEllipse>(args); 1055 ConsumeIdent<CSSValueCircle, CSSValueEllipse>(args);
1040 const CSSIdentifierValue* size_keyword = 1056 const CSSIdentifierValue* size_keyword =
1041 ConsumeIdent<CSSValueClosestSide, CSSValueClosestCorner, 1057 ConsumeIdent<CSSValueClosestSide, CSSValueClosestCorner,
1042 CSSValueFarthestSide, CSSValueFarthestCorner, 1058 CSSValueFarthestSide, CSSValueFarthestCorner,
1043 CSSValueContain, CSSValueCover>(args); 1059 CSSValueContain, CSSValueCover>(args);
1044 if (!shape) 1060 if (!shape)
1045 shape = ConsumeIdent<CSSValueCircle, CSSValueEllipse>(args); 1061 shape = ConsumeIdent<CSSValueCircle, CSSValueEllipse>(args);
1046 1062
1047 // Or, two lengths or percentages 1063 // Or, two lengths or percentages
1048 const CSSPrimitiveValue* horizontal_size = nullptr; 1064 const CSSPrimitiveValue* horizontal_size = nullptr;
1049 const CSSPrimitiveValue* vertical_size = nullptr; 1065 const CSSPrimitiveValue* vertical_size = nullptr;
1050 if (!shape && !size_keyword) { 1066 if (!shape && !size_keyword) {
1051 horizontal_size = 1067 horizontal_size =
1052 ConsumeLengthOrPercent(args, css_parser_mode, kValueRangeAll); 1068 ConsumeLengthOrPercent(args, context.Mode(), kValueRangeAll);
1053 if (horizontal_size) { 1069 if (horizontal_size) {
1054 vertical_size = 1070 vertical_size =
1055 ConsumeLengthOrPercent(args, css_parser_mode, kValueRangeAll); 1071 ConsumeLengthOrPercent(args, context.Mode(), kValueRangeAll);
1056 if (!vertical_size) 1072 if (!vertical_size)
1057 return nullptr; 1073 return nullptr;
1058 ConsumeCommaIncludingWhitespace(args); 1074 ConsumeCommaIncludingWhitespace(args);
1059 } 1075 }
1060 } else { 1076 } else {
1061 ConsumeCommaIncludingWhitespace(args); 1077 ConsumeCommaIncludingWhitespace(args);
1062 } 1078 }
1063 1079
1064 CSSGradientValue* result = CSSRadialGradientValue::Create( 1080 CSSGradientValue* result = CSSRadialGradientValue::Create(
1065 center_x, center_y, shape, size_keyword, horizontal_size, vertical_size, 1081 center_x, center_y, shape, size_keyword, horizontal_size, vertical_size,
1066 repeating, kCSSPrefixedRadialGradient); 1082 repeating, kCSSPrefixedRadialGradient);
1067 return ConsumeGradientColorStops(args, css_parser_mode, result, 1083 return ConsumeGradientColorStops(args, context, result,
1068 ConsumeLengthOrPercent) 1084 ConsumeGradientLengthOrPercent)
1069 ? result 1085 ? result
1070 : nullptr; 1086 : nullptr;
1071 } 1087 }
1072 1088
1073 static CSSValue* ConsumeRadialGradient(CSSParserTokenRange& args, 1089 static CSSValue* ConsumeRadialGradient(CSSParserTokenRange& args,
1074 const CSSParserContext& context, 1090 const CSSParserContext& context,
1075 CSSGradientRepeat repeating) { 1091 CSSGradientRepeat repeating) {
1076 const CSSIdentifierValue* shape = nullptr; 1092 const CSSIdentifierValue* shape = nullptr;
1077 const CSSIdentifierValue* size_keyword = nullptr; 1093 const CSSIdentifierValue* size_keyword = nullptr;
1078 const CSSPrimitiveValue* horizontal_size = nullptr; 1094 const CSSPrimitiveValue* horizontal_size = nullptr;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 } 1162 }
1147 1163
1148 if ((shape || size_keyword || horizontal_size || center_x || center_y) && 1164 if ((shape || size_keyword || horizontal_size || center_x || center_y) &&
1149 !ConsumeCommaIncludingWhitespace(args)) { 1165 !ConsumeCommaIncludingWhitespace(args)) {
1150 return nullptr; 1166 return nullptr;
1151 } 1167 }
1152 1168
1153 CSSGradientValue* result = CSSRadialGradientValue::Create( 1169 CSSGradientValue* result = CSSRadialGradientValue::Create(
1154 center_x, center_y, shape, size_keyword, horizontal_size, vertical_size, 1170 center_x, center_y, shape, size_keyword, horizontal_size, vertical_size,
1155 repeating, kCSSRadialGradient); 1171 repeating, kCSSRadialGradient);
1156 return ConsumeGradientColorStops(args, context.Mode(), result, 1172 return ConsumeGradientColorStops(args, context, result,
1157 ConsumeLengthOrPercent) 1173 ConsumeGradientLengthOrPercent)
1158 ? result 1174 ? result
1159 : nullptr; 1175 : nullptr;
1160 } 1176 }
1161 1177
1162 static CSSValue* ConsumeLinearGradient(CSSParserTokenRange& args, 1178 static CSSValue* ConsumeLinearGradient(CSSParserTokenRange& args,
1163 CSSParserMode css_parser_mode, 1179 const CSSParserContext& context,
1164 CSSGradientRepeat repeating, 1180 CSSGradientRepeat repeating,
1165 CSSGradientType gradient_type) { 1181 CSSGradientType gradient_type) {
1166 bool expect_comma = true; 1182 bool expect_comma = true;
1167 const CSSPrimitiveValue* angle = ConsumeAngle(args); 1183 const CSSPrimitiveValue* angle =
1184 ConsumeAngle(args, context, UseCounter::kUnitlessZeroAngleGradient);
1168 const CSSIdentifierValue* end_x = nullptr; 1185 const CSSIdentifierValue* end_x = nullptr;
1169 const CSSIdentifierValue* end_y = nullptr; 1186 const CSSIdentifierValue* end_y = nullptr;
1170 if (!angle) { 1187 if (!angle) {
1171 if (gradient_type == kCSSPrefixedLinearGradient || 1188 if (gradient_type == kCSSPrefixedLinearGradient ||
1172 ConsumeIdent<CSSValueTo>(args)) { 1189 ConsumeIdent<CSSValueTo>(args)) {
1173 end_x = ConsumeIdent<CSSValueLeft, CSSValueRight>(args); 1190 end_x = ConsumeIdent<CSSValueLeft, CSSValueRight>(args);
1174 end_y = ConsumeIdent<CSSValueBottom, CSSValueTop>(args); 1191 end_y = ConsumeIdent<CSSValueBottom, CSSValueTop>(args);
1175 if (!end_x && !end_y) { 1192 if (!end_x && !end_y) {
1176 if (gradient_type == kCSSLinearGradient) 1193 if (gradient_type == kCSSLinearGradient)
1177 return nullptr; 1194 return nullptr;
1178 end_y = CSSIdentifierValue::Create(CSSValueTop); 1195 end_y = CSSIdentifierValue::Create(CSSValueTop);
1179 expect_comma = false; 1196 expect_comma = false;
1180 } else if (!end_x) { 1197 } else if (!end_x) {
1181 end_x = ConsumeIdent<CSSValueLeft, CSSValueRight>(args); 1198 end_x = ConsumeIdent<CSSValueLeft, CSSValueRight>(args);
1182 } 1199 }
1183 } else { 1200 } else {
1184 expect_comma = false; 1201 expect_comma = false;
1185 } 1202 }
1186 } 1203 }
1187 1204
1188 if (expect_comma && !ConsumeCommaIncludingWhitespace(args)) 1205 if (expect_comma && !ConsumeCommaIncludingWhitespace(args))
1189 return nullptr; 1206 return nullptr;
1190 1207
1191 CSSGradientValue* result = CSSLinearGradientValue::Create( 1208 CSSGradientValue* result = CSSLinearGradientValue::Create(
1192 end_x, end_y, nullptr, nullptr, angle, repeating, gradient_type); 1209 end_x, end_y, nullptr, nullptr, angle, repeating, gradient_type);
1193 return ConsumeGradientColorStops(args, css_parser_mode, result, 1210 return ConsumeGradientColorStops(args, context, result,
1194 ConsumeLengthOrPercent) 1211 ConsumeGradientLengthOrPercent)
1195 ? result 1212 ? result
1196 : nullptr; 1213 : nullptr;
1197 } 1214 }
1198 1215
1199 static CSSValue* ConsumeConicGradient(CSSParserTokenRange& args, 1216 static CSSValue* ConsumeConicGradient(CSSParserTokenRange& args,
1200 const CSSParserContext& context, 1217 const CSSParserContext& context,
1201 CSSGradientRepeat repeating) { 1218 CSSGradientRepeat repeating) {
1202 if (!RuntimeEnabledFeatures::conicGradientEnabled()) 1219 if (!RuntimeEnabledFeatures::conicGradientEnabled())
1203 return nullptr; 1220 return nullptr;
1204 1221
1205 const CSSPrimitiveValue* from_angle = nullptr; 1222 const CSSPrimitiveValue* from_angle = nullptr;
1206 if (ConsumeIdent<CSSValueFrom>(args)) { 1223 if (ConsumeIdent<CSSValueFrom>(args)) {
1207 if (!(from_angle = ConsumeAngle(args))) 1224 if (!(from_angle = ConsumeAngle(args, context,
1225 UseCounter::kUnitlessZeroAngleGradient)))
1208 return nullptr; 1226 return nullptr;
1209 } 1227 }
1210 1228
1211 CSSValue* center_x = nullptr; 1229 CSSValue* center_x = nullptr;
1212 CSSValue* center_y = nullptr; 1230 CSSValue* center_y = nullptr;
1213 if (ConsumeIdent<CSSValueAt>(args)) { 1231 if (ConsumeIdent<CSSValueAt>(args)) {
1214 if (!ConsumePosition(args, context, UnitlessQuirk::kForbid, 1232 if (!ConsumePosition(args, context, UnitlessQuirk::kForbid,
1215 UseCounter::kThreeValuedPositionGradient, center_x, 1233 UseCounter::kThreeValuedPositionGradient, center_x,
1216 center_y)) 1234 center_y))
1217 return nullptr; 1235 return nullptr;
1218 } 1236 }
1219 1237
1220 // Comma separator required when fromAngle or position is present. 1238 // Comma separator required when fromAngle or position is present.
1221 if ((from_angle || center_x || center_y) && 1239 if ((from_angle || center_x || center_y) &&
1222 !ConsumeCommaIncludingWhitespace(args)) { 1240 !ConsumeCommaIncludingWhitespace(args)) {
1223 return nullptr; 1241 return nullptr;
1224 } 1242 }
1225 1243
1226 CSSGradientValue* result = 1244 CSSGradientValue* result =
1227 CSSConicGradientValue::Create(center_x, center_y, from_angle, repeating); 1245 CSSConicGradientValue::Create(center_x, center_y, from_angle, repeating);
1228 return ConsumeGradientColorStops(args, context.Mode(), result, 1246 return ConsumeGradientColorStops(args, context, result,
1229 ConsumeAngleOrPercent) 1247 ConsumeGradientAngleOrPercent)
1230 ? result 1248 ? result
1231 : nullptr; 1249 : nullptr;
1232 } 1250 }
1233 1251
1234 CSSValue* ConsumeImageOrNone(CSSParserTokenRange& range, 1252 CSSValue* ConsumeImageOrNone(CSSParserTokenRange& range,
1235 const CSSParserContext* context) { 1253 const CSSParserContext* context) {
1236 if (range.Peek().Id() == CSSValueNone) 1254 if (range.Peek().Id() == CSSValueNone)
1237 return ConsumeIdent(range); 1255 return ConsumeIdent(range);
1238 return ConsumeImage(range, context); 1256 return ConsumeImage(range, context);
1239 } 1257 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 CSSValueID id = range.Peek().FunctionId(); 1330 CSSValueID id = range.Peek().FunctionId();
1313 CSSParserTokenRange range_copy = range; 1331 CSSParserTokenRange range_copy = range;
1314 CSSParserTokenRange args = ConsumeFunction(range_copy); 1332 CSSParserTokenRange args = ConsumeFunction(range_copy);
1315 CSSValue* result = nullptr; 1333 CSSValue* result = nullptr;
1316 if (id == CSSValueRadialGradient) { 1334 if (id == CSSValueRadialGradient) {
1317 result = ConsumeRadialGradient(args, *context, kNonRepeating); 1335 result = ConsumeRadialGradient(args, *context, kNonRepeating);
1318 } else if (id == CSSValueRepeatingRadialGradient) { 1336 } else if (id == CSSValueRepeatingRadialGradient) {
1319 result = ConsumeRadialGradient(args, *context, kRepeating); 1337 result = ConsumeRadialGradient(args, *context, kRepeating);
1320 } else if (id == CSSValueWebkitLinearGradient) { 1338 } else if (id == CSSValueWebkitLinearGradient) {
1321 context->Count(UseCounter::kDeprecatedWebKitLinearGradient); 1339 context->Count(UseCounter::kDeprecatedWebKitLinearGradient);
1322 result = ConsumeLinearGradient(args, context->Mode(), kNonRepeating, 1340 result = ConsumeLinearGradient(args, *context, kNonRepeating,
1323 kCSSPrefixedLinearGradient); 1341 kCSSPrefixedLinearGradient);
1324 } else if (id == CSSValueWebkitRepeatingLinearGradient) { 1342 } else if (id == CSSValueWebkitRepeatingLinearGradient) {
1325 context->Count(UseCounter::kDeprecatedWebKitRepeatingLinearGradient); 1343 context->Count(UseCounter::kDeprecatedWebKitRepeatingLinearGradient);
1326 result = ConsumeLinearGradient(args, context->Mode(), kRepeating, 1344 result = ConsumeLinearGradient(args, *context, kRepeating,
1327 kCSSPrefixedLinearGradient); 1345 kCSSPrefixedLinearGradient);
1328 } else if (id == CSSValueRepeatingLinearGradient) { 1346 } else if (id == CSSValueRepeatingLinearGradient) {
1329 result = ConsumeLinearGradient(args, context->Mode(), kRepeating, 1347 result =
1330 kCSSLinearGradient); 1348 ConsumeLinearGradient(args, *context, kRepeating, kCSSLinearGradient);
1331 } else if (id == CSSValueLinearGradient) { 1349 } else if (id == CSSValueLinearGradient) {
1332 result = ConsumeLinearGradient(args, context->Mode(), kNonRepeating, 1350 result = ConsumeLinearGradient(args, *context, kNonRepeating,
1333 kCSSLinearGradient); 1351 kCSSLinearGradient);
1334 } else if (id == CSSValueWebkitGradient) { 1352 } else if (id == CSSValueWebkitGradient) {
1335 context->Count(UseCounter::kDeprecatedWebKitGradient); 1353 context->Count(UseCounter::kDeprecatedWebKitGradient);
1336 result = ConsumeDeprecatedGradient(args, context->Mode()); 1354 result = ConsumeDeprecatedGradient(args, context->Mode());
1337 } else if (id == CSSValueWebkitRadialGradient) { 1355 } else if (id == CSSValueWebkitRadialGradient) {
1338 context->Count(UseCounter::kDeprecatedWebKitRadialGradient); 1356 context->Count(UseCounter::kDeprecatedWebKitRadialGradient);
1339 result = 1357 result = ConsumeDeprecatedRadialGradient(args, *context, kNonRepeating);
1340 ConsumeDeprecatedRadialGradient(args, context->Mode(), kNonRepeating);
1341 } else if (id == CSSValueWebkitRepeatingRadialGradient) { 1358 } else if (id == CSSValueWebkitRepeatingRadialGradient) {
1342 context->Count(UseCounter::kDeprecatedWebKitRepeatingRadialGradient); 1359 context->Count(UseCounter::kDeprecatedWebKitRepeatingRadialGradient);
1343 result = ConsumeDeprecatedRadialGradient(args, context->Mode(), kRepeating); 1360 result = ConsumeDeprecatedRadialGradient(args, *context, kRepeating);
1344 } else if (id == CSSValueConicGradient) { 1361 } else if (id == CSSValueConicGradient) {
1345 result = ConsumeConicGradient(args, *context, kNonRepeating); 1362 result = ConsumeConicGradient(args, *context, kNonRepeating);
1346 } else if (id == CSSValueRepeatingConicGradient) { 1363 } else if (id == CSSValueRepeatingConicGradient) {
1347 result = ConsumeConicGradient(args, *context, kRepeating); 1364 result = ConsumeConicGradient(args, *context, kRepeating);
1348 } else if (id == CSSValueWebkitCrossFade) { 1365 } else if (id == CSSValueWebkitCrossFade) {
1349 result = ConsumeCrossFade(args, context); 1366 result = ConsumeCrossFade(args, context);
1350 } else if (id == CSSValuePaint) { 1367 } else if (id == CSSValuePaint) {
1351 result = RuntimeEnabledFeatures::cssPaintAPIEnabled() 1368 result = RuntimeEnabledFeatures::cssPaintAPIEnabled()
1352 ? ConsumePaint(args, context) 1369 ? ConsumePaint(args, context)
1353 : nullptr; 1370 : nullptr;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 1454
1438 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box 1455 // https://drafts.csswg.org/css-shapes-1/#typedef-shape-box
1439 CSSIdentifierValue* ConsumeShapeBox(CSSParserTokenRange& range) { 1456 CSSIdentifierValue* ConsumeShapeBox(CSSParserTokenRange& range) {
1440 return ConsumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox, 1457 return ConsumeIdent<CSSValueContentBox, CSSValuePaddingBox, CSSValueBorderBox,
1441 CSSValueMarginBox>(range); 1458 CSSValueMarginBox>(range);
1442 } 1459 }
1443 1460
1444 } // namespace CSSPropertyParserHelpers 1461 } // namespace CSSPropertyParserHelpers
1445 1462
1446 } // namespace blink 1463 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698