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

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: rebase 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 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 UseCounter::kThreeValuedPositionBasicShape, center_x,
38 center_y)) 39 center_y))
39 return nullptr; 40 return nullptr;
40 shape->SetCenterX(center_x); 41 shape->SetCenterX(center_x);
41 shape->SetCenterY(center_y); 42 shape->SetCenterY(center_y);
42 } 43 }
43 return shape; 44 return shape;
44 } 45 }
45 46
46 static CSSBasicShapeEllipseValue* ConsumeBasicShapeEllipse( 47 static CSSBasicShapeEllipseValue* ConsumeBasicShapeEllipse(
47 CSSParserTokenRange& args, 48 CSSParserTokenRange& args,
48 const CSSParserContext& context) { 49 const CSSParserContext& context) {
49 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes 50 // spec: https://drafts.csswg.org/css-shapes/#supported-basic-shapes
50 // ellipse( [<shape-radius>{2}]? [at <position>]? ) 51 // ellipse( [<shape-radius>{2}]? [at <position>]? )
51 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::Create(); 52 CSSBasicShapeEllipseValue* shape = CSSBasicShapeEllipseValue::Create();
52 if (CSSValue* radius_x = ConsumeShapeRadius(args, context.Mode())) { 53 if (CSSValue* radius_x = ConsumeShapeRadius(args, context.Mode())) {
53 shape->SetRadiusX(radius_x); 54 shape->SetRadiusX(radius_x);
54 if (CSSValue* radius_y = ConsumeShapeRadius(args, context.Mode())) 55 if (CSSValue* radius_y = ConsumeShapeRadius(args, context.Mode()))
55 shape->SetRadiusY(radius_y); 56 shape->SetRadiusY(radius_y);
56 } 57 }
57 if (ConsumeIdent<CSSValueAt>(args)) { 58 if (ConsumeIdent<CSSValueAt>(args)) {
58 CSSValue* center_x = nullptr; 59 CSSValue* center_x = nullptr;
59 CSSValue* center_y = nullptr; 60 CSSValue* center_y = nullptr;
60 if (!ConsumePosition(args, context.Mode(), UnitlessQuirk::kForbid, center_x, 61 if (!ConsumePosition(args, context, UnitlessQuirk::kForbid,
62 UseCounter::kThreeValuedPositionBasicShape, center_x,
61 center_y)) 63 center_y))
62 return nullptr; 64 return nullptr;
63 shape->SetCenterX(center_x); 65 shape->SetCenterX(center_x);
64 shape->SetCenterY(center_y); 66 shape->SetCenterY(center_y);
65 } 67 }
66 return shape; 68 return shape;
67 } 69 }
68 70
69 static CSSBasicShapePolygonValue* ConsumeBasicShapePolygon( 71 static CSSBasicShapePolygonValue* ConsumeBasicShapePolygon(
70 CSSParserTokenRange& args, 72 CSSParserTokenRange& args,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 shape = ConsumeBasicShapePolygon(args, context); 205 shape = ConsumeBasicShapePolygon(args, context);
204 else if (id == CSSValueInset) 206 else if (id == CSSValueInset)
205 shape = ConsumeBasicShapeInset(args, context); 207 shape = ConsumeBasicShapeInset(args, context);
206 if (!shape || !args.AtEnd()) 208 if (!shape || !args.AtEnd())
207 return nullptr; 209 return nullptr;
208 range = range_copy; 210 range = range_copy;
209 return shape; 211 return shape;
210 } 212 }
211 213
212 } // namespace blink 214 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698