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

Side by Side Diff: third_party/WebKit/Source/core/style/BasicShapes.h

Issue 1743803002: Rename enums/functions that collide in chromium style in core/style/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get-names-8
Patch Set: get-names-9: rebase Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace blink { 43 namespace blink {
44 44
45 class FloatRect; 45 class FloatRect;
46 class FloatSize; 46 class FloatSize;
47 class Path; 47 class Path;
48 48
49 class CORE_EXPORT BasicShape : public RefCounted<BasicShape> { 49 class CORE_EXPORT BasicShape : public RefCounted<BasicShape> {
50 public: 50 public:
51 virtual ~BasicShape() { } 51 virtual ~BasicShape() { }
52 52
53 enum Type { 53 enum ShapeType {
54 BasicShapeEllipseType, 54 BasicShapeEllipseType,
55 BasicShapePolygonType, 55 BasicShapePolygonType,
56 BasicShapeCircleType, 56 BasicShapeCircleType,
57 BasicShapeInsetType 57 BasicShapeInsetType
58 }; 58 };
59 59
60 bool canBlend(const BasicShape*) const; 60 bool canBlend(const BasicShape*) const;
61 bool isSameType(const BasicShape& other) const { return type() == other.type (); } 61 bool isSameType(const BasicShape& other) const { return type() == other.type (); }
62 62
63 virtual void path(Path&, const FloatRect&) = 0; 63 virtual void path(Path&, const FloatRect&) = 0;
64 virtual WindRule windRule() const { return RULE_NONZERO; } 64 virtual WindRule getWindRule() const { return RULE_NONZERO; }
65 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0; 65 virtual PassRefPtr<BasicShape> blend(const BasicShape*, double) const = 0;
66 virtual bool operator==(const BasicShape&) const = 0; 66 virtual bool operator==(const BasicShape&) const = 0;
67 67
68 virtual Type type() const = 0; 68 virtual ShapeType type() const = 0;
69 69
70 protected: 70 protected:
71 BasicShape() 71 BasicShape()
72 { 72 {
73 } 73 }
74 74
75 }; 75 };
76 76
77 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \ 77 #define DEFINE_BASICSHAPE_TYPE_CASTS(thisType) \
78 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape:: thisType##Type, value.type() == BasicShape::thisType##Type) 78 DEFINE_TYPE_CASTS(thisType, BasicShape, value, value->type() == BasicShape:: thisType##Type, value.type() == BasicShape::thisType##Type)
79 79
80 class BasicShapeCenterCoordinate { 80 class BasicShapeCenterCoordinate {
81 DISALLOW_NEW(); 81 DISALLOW_NEW();
82 public: 82 public:
83 enum Direction { 83 enum Direction {
84 TopLeft, 84 TopLeft,
85 BottomRight 85 BottomRight
86 }; 86 };
87 87
88 BasicShapeCenterCoordinate(Direction direction = TopLeft, const Length& leng th = Length(0, Fixed)) 88 BasicShapeCenterCoordinate(Direction direction = TopLeft, const Length& leng th = Length(0, Fixed))
89 : m_direction(direction) 89 : m_direction(direction)
90 , m_length(length) 90 , m_length(length)
91 , m_computedLength(direction == TopLeft ? length : length.subtractFromOn eHundredPercent()) 91 , m_computedLength(direction == TopLeft ? length : length.subtractFromOn eHundredPercent())
92 { 92 {
93 } 93 }
94 94
95 BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other) 95 BasicShapeCenterCoordinate(const BasicShapeCenterCoordinate& other)
96 : m_direction(other.direction()) 96 : m_direction(other.getDirection())
97 , m_length(other.length()) 97 , m_length(other.length())
98 , m_computedLength(other.m_computedLength) 98 , m_computedLength(other.m_computedLength)
99 { 99 {
100 } 100 }
101 101
102 bool operator==(const BasicShapeCenterCoordinate& other) const { return m_di rection == other.m_direction && m_length == other.m_length && m_computedLength = = other.m_computedLength; } 102 bool operator==(const BasicShapeCenterCoordinate& other) const { return m_di rection == other.m_direction && m_length == other.m_length && m_computedLength = = other.m_computedLength; }
103 103
104 Direction direction() const { return m_direction; } 104 Direction getDirection() const { return m_direction; }
105 const Length& length() const { return m_length; } 105 const Length& length() const { return m_length; }
106 const Length& computedLength() const { return m_computedLength; } 106 const Length& computedLength() const { return m_computedLength; }
107 107
108 BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, do uble progress) const 108 BasicShapeCenterCoordinate blend(const BasicShapeCenterCoordinate& other, do uble progress) const
109 { 109 {
110 return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other. m_computedLength, progress, ValueRangeAll)); 110 return BasicShapeCenterCoordinate(TopLeft, m_computedLength.blend(other. m_computedLength, progress, ValueRangeAll));
111 } 111 }
112 112
113 private: 113 private:
114 Direction m_direction; 114 Direction m_direction;
115 Length m_length; 115 Length m_length;
116 Length m_computedLength; 116 Length m_computedLength;
117 }; 117 };
118 118
119 class BasicShapeRadius { 119 class BasicShapeRadius {
120 DISALLOW_NEW(); 120 DISALLOW_NEW();
121 public: 121 public:
122 enum Type { 122 enum RadiusType {
123 Value, 123 Value,
124 ClosestSide, 124 ClosestSide,
125 FarthestSide 125 FarthestSide
126 }; 126 };
127 BasicShapeRadius() : m_type(ClosestSide) { } 127 BasicShapeRadius() : m_type(ClosestSide) { }
128 explicit BasicShapeRadius(const Length& v) : m_value(v), m_type(Value) { } 128 explicit BasicShapeRadius(const Length& v) : m_value(v), m_type(Value) { }
129 explicit BasicShapeRadius(Type t) : m_type(t) { } 129 explicit BasicShapeRadius(RadiusType t) : m_type(t) { }
130 BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_ type(other.type()) { } 130 BasicShapeRadius(const BasicShapeRadius& other) : m_value(other.value()), m_ type(other.type()) { }
131 bool operator==(const BasicShapeRadius& other) const { return m_type == othe r.m_type && m_value == other.m_value; } 131 bool operator==(const BasicShapeRadius& other) const { return m_type == othe r.m_type && m_value == other.m_value; }
132 132
133 const Length& value() const { return m_value; } 133 const Length& value() const { return m_value; }
134 Type type() const { return m_type; } 134 RadiusType type() const { return m_type; }
135 135
136 bool canBlend(const BasicShapeRadius& other) const 136 bool canBlend(const BasicShapeRadius& other) const
137 { 137 {
138 // FIXME determine how to interpolate between keywords. See issue 330248 . 138 // FIXME determine how to interpolate between keywords. See issue 330248 .
139 return m_type == Value && other.type() == Value; 139 return m_type == Value && other.type() == Value;
140 } 140 }
141 141
142 BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const 142 BasicShapeRadius blend(const BasicShapeRadius& other, double progress) const
143 { 143 {
144 if (m_type != Value || other.type() != Value) 144 if (m_type != Value || other.type() != Value)
145 return BasicShapeRadius(other); 145 return BasicShapeRadius(other);
146 146
147 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang eNonNegative)); 147 return BasicShapeRadius(m_value.blend(other.value(), progress, ValueRang eNonNegative));
148 } 148 }
149 149
150 private: 150 private:
151 Length m_value; 151 Length m_value;
152 Type m_type; 152 RadiusType m_type;
153 153
154 }; 154 };
155 155
156 class CORE_EXPORT BasicShapeCircle final : public BasicShape { 156 class CORE_EXPORT BasicShapeCircle final : public BasicShape {
157 public: 157 public:
158 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap eCircle); } 158 static PassRefPtr<BasicShapeCircle> create() { return adoptRef(new BasicShap eCircle); }
159 159
160 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } 160 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
161 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } 161 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
162 const BasicShapeRadius& radius() const { return m_radius; } 162 const BasicShapeRadius& radius() const { return m_radius; }
163 163
164 float floatValueForRadiusInBox(FloatSize) const; 164 float floatValueForRadiusInBox(FloatSize) const;
165 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } 165 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
166 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } 166 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
167 void setRadius(BasicShapeRadius radius) { m_radius = radius; } 167 void setRadius(BasicShapeRadius radius) { m_radius = radius; }
168 168
169 void path(Path&, const FloatRect&) override; 169 void path(Path&, const FloatRect&) override;
170 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 170 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
171 bool operator==(const BasicShape&) const override; 171 bool operator==(const BasicShape&) const override;
172 172
173 Type type() const override { return BasicShapeCircleType; } 173 ShapeType type() const override { return BasicShapeCircleType; }
174 private: 174 private:
175 BasicShapeCircle() { } 175 BasicShapeCircle() { }
176 176
177 BasicShapeCenterCoordinate m_centerX; 177 BasicShapeCenterCoordinate m_centerX;
178 BasicShapeCenterCoordinate m_centerY; 178 BasicShapeCenterCoordinate m_centerY;
179 BasicShapeRadius m_radius; 179 BasicShapeRadius m_radius;
180 }; 180 };
181 181
182 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle); 182 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeCircle);
183 183
184 class BasicShapeEllipse final : public BasicShape { 184 class BasicShapeEllipse final : public BasicShape {
185 public: 185 public:
186 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); } 186 static PassRefPtr<BasicShapeEllipse> create() { return adoptRef(new BasicSha peEllipse); }
187 187
188 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; } 188 const BasicShapeCenterCoordinate& centerX() const { return m_centerX; }
189 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; } 189 const BasicShapeCenterCoordinate& centerY() const { return m_centerY; }
190 const BasicShapeRadius& radiusX() const { return m_radiusX; } 190 const BasicShapeRadius& radiusX() const { return m_radiusX; }
191 const BasicShapeRadius& radiusY() const { return m_radiusY; } 191 const BasicShapeRadius& radiusY() const { return m_radiusY; }
192 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const; 192 float floatValueForRadiusInBox(const BasicShapeRadius&, float center, float boxWidthOrHeight) const;
193 193
194 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; } 194 void setCenterX(BasicShapeCenterCoordinate centerX) { m_centerX = centerX; }
195 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; } 195 void setCenterY(BasicShapeCenterCoordinate centerY) { m_centerY = centerY; }
196 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; } 196 void setRadiusX(BasicShapeRadius radiusX) { m_radiusX = radiusX; }
197 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; } 197 void setRadiusY(BasicShapeRadius radiusY) { m_radiusY = radiusY; }
198 198
199 void path(Path&, const FloatRect&) override; 199 void path(Path&, const FloatRect&) override;
200 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 200 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
201 bool operator==(const BasicShape&) const override; 201 bool operator==(const BasicShape&) const override;
202 202
203 Type type() const override { return BasicShapeEllipseType; } 203 ShapeType type() const override { return BasicShapeEllipseType; }
204 private: 204 private:
205 BasicShapeEllipse() { } 205 BasicShapeEllipse() { }
206 206
207 BasicShapeCenterCoordinate m_centerX; 207 BasicShapeCenterCoordinate m_centerX;
208 BasicShapeCenterCoordinate m_centerY; 208 BasicShapeCenterCoordinate m_centerY;
209 BasicShapeRadius m_radiusX; 209 BasicShapeRadius m_radiusX;
210 BasicShapeRadius m_radiusY; 210 BasicShapeRadius m_radiusY;
211 }; 211 };
212 212
213 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse); 213 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeEllipse);
214 214
215 class BasicShapePolygon final : public BasicShape { 215 class BasicShapePolygon final : public BasicShape {
216 public: 216 public:
217 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); } 217 static PassRefPtr<BasicShapePolygon> create() { return adoptRef(new BasicSha pePolygon); }
218 218
219 const Vector<Length>& values() const { return m_values; } 219 const Vector<Length>& values() const { return m_values; }
220 Length getXAt(unsigned i) const { return m_values.at(2 * i); } 220 Length getXAt(unsigned i) const { return m_values.at(2 * i); }
221 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); } 221 Length getYAt(unsigned i) const { return m_values.at(2 * i + 1); }
222 222
223 void setWindRule(WindRule windRule) { m_windRule = windRule; } 223 void setWindRule(WindRule windRule) { m_windRule = windRule; }
224 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v alues.append(y); } 224 void appendPoint(const Length& x, const Length& y) { m_values.append(x); m_v alues.append(y); }
225 225
226 void path(Path&, const FloatRect&) override; 226 void path(Path&, const FloatRect&) override;
227 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 227 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
228 bool operator==(const BasicShape&) const override; 228 bool operator==(const BasicShape&) const override;
229 229
230 WindRule windRule() const override { return m_windRule; } 230 WindRule getWindRule() const override { return m_windRule; }
231 231
232 Type type() const override { return BasicShapePolygonType; } 232 ShapeType type() const override { return BasicShapePolygonType; }
233 private: 233 private:
234 BasicShapePolygon() 234 BasicShapePolygon()
235 : m_windRule(RULE_NONZERO) 235 : m_windRule(RULE_NONZERO)
236 { } 236 { }
237 237
238 WindRule m_windRule; 238 WindRule m_windRule;
239 Vector<Length> m_values; 239 Vector<Length> m_values;
240 }; 240 };
241 241
242 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon); 242 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapePolygon);
(...skipping 19 matching lines...) Expand all
262 262
263 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius; } 263 void setTopLeftRadius(const LengthSize& radius) { m_topLeftRadius = radius; }
264 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius ; } 264 void setTopRightRadius(const LengthSize& radius) { m_topRightRadius = radius ; }
265 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius = radius; } 265 void setBottomRightRadius(const LengthSize& radius) { m_bottomRightRadius = radius; }
266 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra dius; } 266 void setBottomLeftRadius(const LengthSize& radius) { m_bottomLeftRadius = ra dius; }
267 267
268 void path(Path&, const FloatRect&) override; 268 void path(Path&, const FloatRect&) override;
269 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override; 269 PassRefPtr<BasicShape> blend(const BasicShape*, double) const override;
270 bool operator==(const BasicShape&) const override; 270 bool operator==(const BasicShape&) const override;
271 271
272 Type type() const override { return BasicShapeInsetType; } 272 ShapeType type() const override { return BasicShapeInsetType; }
273 private: 273 private:
274 BasicShapeInset() { } 274 BasicShapeInset() { }
275 275
276 Length m_right; 276 Length m_right;
277 Length m_top; 277 Length m_top;
278 Length m_bottom; 278 Length m_bottom;
279 Length m_left; 279 Length m_left;
280 280
281 LengthSize m_topLeftRadius; 281 LengthSize m_topLeftRadius;
282 LengthSize m_topRightRadius; 282 LengthSize m_topRightRadius;
283 LengthSize m_bottomRightRadius; 283 LengthSize m_bottomRightRadius;
284 LengthSize m_bottomLeftRadius; 284 LengthSize m_bottomLeftRadius;
285 }; 285 };
286 286
287 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset); 287 DEFINE_BASICSHAPE_TYPE_CASTS(BasicShapeInset);
288 288
289 } // namespace blink 289 } // namespace blink
290 #endif 290 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp ('k') | third_party/WebKit/Source/core/style/BasicShapes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698