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

Side by Side Diff: third_party/WebKit/Source/core/css/properties/CSSPropertyShapeUtils.cpp

Issue 2888283006: CSS: Use count position values with 3 parts (Closed)
Patch Set: distinct use counters Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/properties/CSSPropertyShapeUtils.h" 5 #include "core/css/properties/CSSPropertyShapeUtils.h"
6 6
7 #include "core/css/CSSBasicShapeValues.h" 7 #include "core/css/CSSBasicShapeValues.h"
8 #include "core/css/parser/CSSParserContext.h" 8 #include "core/css/parser/CSSParserContext.h"
9 #include "core/css/parser/CSSParserMode.h" 9 #include "core/css/parser/CSSParserMode.h"
10 #include "core/css/parser/CSSParserTokenRange.h" 10 #include "core/css/parser/CSSParserTokenRange.h"
(...skipping 16 matching lines...) Expand all
27 CSSParserTokenRange& args, 27 CSSParserTokenRange& args,
28 const CSSParserContext& context) { 28 const CSSParserContext& context) {
29 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes 29 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes
30 // circle( [<shape-radius>]? [at <position>]? ) 30 // circle( [<shape-radius>]? [at <position>]? )
31 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::Create(); 31 CSSBasicShapeCircleValue* shape = CSSBasicShapeCircleValue::Create();
32 if (CSSValue* radius = ConsumeShapeRadius(args, context.Mode())) 32 if (CSSValue* radius = ConsumeShapeRadius(args, context.Mode()))
33 shape->SetRadius(radius); 33 shape->SetRadius(radius);
34 if (ConsumeIdent<CSSValueAt>(args)) { 34 if (ConsumeIdent<CSSValueAt>(args)) {
35 CSSValue* center_x = nullptr; 35 CSSValue* center_x = nullptr;
36 CSSValue* center_y = nullptr; 36 CSSValue* center_y = nullptr;
37 if (!ConsumePosition(args, context.Mode(), UnitlessQuirk::kForbid, center_x, 37 if (!ConsumePosition(args, context, UnitlessQuirk::kForbid,
38 center_y)) 38 PositionSyntax::kBasicShape, center_x, center_y))
39 return nullptr; 39 return nullptr;
40 shape->SetCenterX(center_x); 40 shape->SetCenterX(center_x);
41 shape->SetCenterY(center_y); 41 shape->SetCenterY(center_y);
42 } 42 }
43 return shape; 43 return shape;
44 } 44 }
45 45
46 static CSSBasicShapeEllipseValue* ConsumeBasicShapeEllipse( 46 static CSSBasicShapeEllipseValue* ConsumeBasicShapeEllipse(
47 CSSParserTokenRange& args, 47 CSSParserTokenRange& args,
48 const CSSParserContext& context) { 48 const CSSParserContext& context) {
49 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes 49 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes
50 // ellipse( [<shape-radius>{2}]? [at <position>]? ) 50 // ellipse( [<shape-radius>{2}]? [at <position>]? )
51 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::Create(); 51 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::Create();
52 if (CSSValue* radius_x = ConsumeShapeRadius(args, context.Mode())) { 52 if (CSSValue* radius_x = ConsumeShapeRadius(args, context.Mode())) {
53 shape->SetRadiusX(radius_x); 53 shape->SetRadiusX(radius_x);
54 if (CSSValue* radius_y = ConsumeShapeRadius(args, context.Mode())) 54 if (CSSValue* radius_y = ConsumeShapeRadius(args, context.Mode()))
55 shape->SetRadiusY(radius_y); 55 shape->SetRadiusY(radius_y);
56 } 56 }
57 if (ConsumeIdent<CSSValueAt>(args)) { 57 if (ConsumeIdent<CSSValueAt>(args)) {
58 CSSValue* center_x = nullptr; 58 CSSValue* center_x = nullptr;
59 CSSValue* center_y = nullptr; 59 CSSValue* center_y = nullptr;
60 if (!ConsumePosition(args, context.Mode(), UnitlessQuirk::kForbid, center_x, 60 if (!ConsumePosition(args, context, UnitlessQuirk::kForbid,
61 center_y)) 61 PositionSyntax::kBasicShape, center_x, center_y))
62 return nullptr; 62 return nullptr;
63 shape->SetCenterX(center_x); 63 shape->SetCenterX(center_x);
64 shape->SetCenterY(center_y); 64 shape->SetCenterY(center_y);
65 } 65 }
66 return shape; 66 return shape;
67 } 67 }
68 68
69 static CSSBasicShapePolygonValue* ConsumeBasicShapePolygon( 69 static CSSBasicShapePolygonValue* ConsumeBasicShapePolygon(
70 CSSParserTokenRange& args, 70 CSSParserTokenRange& args,
71 const CSSParserContext& context) { 71 const CSSParserContext& context) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 shape = ConsumeBasicShapePolygon(args, context); 203 shape = ConsumeBasicShapePolygon(args, context);
204 else if (id == CSSValueInset) 204 else if (id == CSSValueInset)
205 shape = ConsumeBasicShapeInset(args, context); 205 shape = ConsumeBasicShapeInset(args, context);
206 if (!shape || !args.AtEnd()) 206 if (!shape || !args.AtEnd())
207 return nullptr; 207 return nullptr;
208 range = range_copy; 208 range = range_copy;
209 return shape; 209 return shape;
210 } 210 }
211 211
212 } // namespace blink 212 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698