OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2011 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 24 matching lines...) Expand all Loading... |
35 #include "core/css/CSSValuePair.h" | 35 #include "core/css/CSSValuePair.h" |
36 #include "platform/graphics/GraphicsTypes.h" | 36 #include "platform/graphics/GraphicsTypes.h" |
37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class CSSBasicShapeCircleValue final : public CSSValue { | 43 class CSSBasicShapeCircleValue final : public CSSValue { |
44 public: | 44 public: |
45 static RawPtr<CSSBasicShapeCircleValue> create() { return new CSSBasicShapeC
ircleValue; } | 45 static CSSBasicShapeCircleValue* create() { return new CSSBasicShapeCircleVa
lue; } |
46 | 46 |
47 String customCSSText() const; | 47 String customCSSText() const; |
48 bool equals(const CSSBasicShapeCircleValue&) const; | 48 bool equals(const CSSBasicShapeCircleValue&) const; |
49 | 49 |
50 CSSValue* centerX() const { return m_centerX.get(); } | 50 CSSValue* centerX() const { return m_centerX.get(); } |
51 CSSValue* centerY() const { return m_centerY.get(); } | 51 CSSValue* centerY() const { return m_centerY.get(); } |
52 CSSPrimitiveValue* radius() const { return m_radius.get(); } | 52 CSSPrimitiveValue* radius() const { return m_radius.get(); } |
53 | 53 |
54 // TODO(sashab): Remove these and pass them as arguments in the constructor. | 54 // TODO(sashab): Remove these and pass them as arguments in the constructor. |
55 void setCenterX(RawPtr<CSSValue> centerX) { m_centerX = centerX; } | 55 void setCenterX(CSSValue* centerX) { m_centerX = centerX; } |
56 void setCenterY(RawPtr<CSSValue> centerY) { m_centerY = centerY; } | 56 void setCenterY(CSSValue* centerY) { m_centerY = centerY; } |
57 void setRadius(RawPtr<CSSPrimitiveValue> radius) { m_radius = radius; } | 57 void setRadius(CSSPrimitiveValue* radius) { m_radius = radius; } |
58 | 58 |
59 DECLARE_TRACE_AFTER_DISPATCH(); | 59 DECLARE_TRACE_AFTER_DISPATCH(); |
60 | 60 |
61 private: | 61 private: |
62 CSSBasicShapeCircleValue() | 62 CSSBasicShapeCircleValue() |
63 : CSSValue(BasicShapeCircleClass) | 63 : CSSValue(BasicShapeCircleClass) |
64 { } | 64 { } |
65 | 65 |
66 Member<CSSValue> m_centerX; | 66 Member<CSSValue> m_centerX; |
67 Member<CSSValue> m_centerY; | 67 Member<CSSValue> m_centerY; |
68 Member<CSSPrimitiveValue> m_radius; | 68 Member<CSSPrimitiveValue> m_radius; |
69 }; | 69 }; |
70 | 70 |
71 class CSSBasicShapeEllipseValue final : public CSSValue { | 71 class CSSBasicShapeEllipseValue final : public CSSValue { |
72 public: | 72 public: |
73 static RawPtr<CSSBasicShapeEllipseValue> create() { return new CSSBasicShape
EllipseValue; } | 73 static CSSBasicShapeEllipseValue* create() { return new CSSBasicShapeEllipse
Value; } |
74 | 74 |
75 String customCSSText() const; | 75 String customCSSText() const; |
76 bool equals(const CSSBasicShapeEllipseValue&) const; | 76 bool equals(const CSSBasicShapeEllipseValue&) const; |
77 | 77 |
78 CSSValue* centerX() const { return m_centerX.get(); } | 78 CSSValue* centerX() const { return m_centerX.get(); } |
79 CSSValue* centerY() const { return m_centerY.get(); } | 79 CSSValue* centerY() const { return m_centerY.get(); } |
80 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } | 80 CSSPrimitiveValue* radiusX() const { return m_radiusX.get(); } |
81 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } | 81 CSSPrimitiveValue* radiusY() const { return m_radiusY.get(); } |
82 | 82 |
83 // TODO(sashab): Remove these and pass them as arguments in the constructor. | 83 // TODO(sashab): Remove these and pass them as arguments in the constructor. |
84 void setCenterX(RawPtr<CSSValue> centerX) { m_centerX = centerX; } | 84 void setCenterX(CSSValue* centerX) { m_centerX = centerX; } |
85 void setCenterY(RawPtr<CSSValue> centerY) { m_centerY = centerY; } | 85 void setCenterY(CSSValue* centerY) { m_centerY = centerY; } |
86 void setRadiusX(RawPtr<CSSPrimitiveValue> radiusX) { m_radiusX = radiusX; } | 86 void setRadiusX(CSSPrimitiveValue* radiusX) { m_radiusX = radiusX; } |
87 void setRadiusY(RawPtr<CSSPrimitiveValue> radiusY) { m_radiusY = radiusY; } | 87 void setRadiusY(CSSPrimitiveValue* radiusY) { m_radiusY = radiusY; } |
88 | 88 |
89 DECLARE_TRACE_AFTER_DISPATCH(); | 89 DECLARE_TRACE_AFTER_DISPATCH(); |
90 | 90 |
91 private: | 91 private: |
92 CSSBasicShapeEllipseValue() | 92 CSSBasicShapeEllipseValue() |
93 : CSSValue(BasicShapeEllipseClass) | 93 : CSSValue(BasicShapeEllipseClass) |
94 { } | 94 { } |
95 | 95 |
96 Member<CSSValue> m_centerX; | 96 Member<CSSValue> m_centerX; |
97 Member<CSSValue> m_centerY; | 97 Member<CSSValue> m_centerY; |
98 Member<CSSPrimitiveValue> m_radiusX; | 98 Member<CSSPrimitiveValue> m_radiusX; |
99 Member<CSSPrimitiveValue> m_radiusY; | 99 Member<CSSPrimitiveValue> m_radiusY; |
100 }; | 100 }; |
101 | 101 |
102 class CSSBasicShapePolygonValue final : public CSSValue { | 102 class CSSBasicShapePolygonValue final : public CSSValue { |
103 public: | 103 public: |
104 static RawPtr<CSSBasicShapePolygonValue> create() { return new CSSBasicShape
PolygonValue; } | 104 static CSSBasicShapePolygonValue* create() { return new CSSBasicShapePolygon
Value; } |
105 | 105 |
106 void appendPoint(RawPtr<CSSPrimitiveValue> x, RawPtr<CSSPrimitiveValue> y) | 106 void appendPoint(CSSPrimitiveValue* x, CSSPrimitiveValue* y) |
107 { | 107 { |
108 m_values.append(x); | 108 m_values.append(x); |
109 m_values.append(y); | 109 m_values.append(y); |
110 } | 110 } |
111 | 111 |
112 RawPtr<CSSPrimitiveValue> getXAt(unsigned i) const { return m_values.at(i *
2); } | 112 CSSPrimitiveValue* getXAt(unsigned i) const { return m_values.at(i * 2); } |
113 RawPtr<CSSPrimitiveValue> getYAt(unsigned i) const { return m_values.at(i *
2 + 1); } | 113 CSSPrimitiveValue* getYAt(unsigned i) const { return m_values.at(i * 2 + 1);
} |
114 const HeapVector<Member<CSSPrimitiveValue>>& values() const { return m_value
s; } | 114 const HeapVector<Member<CSSPrimitiveValue>>& values() const { return m_value
s; } |
115 | 115 |
116 // TODO(sashab): Remove this and pass it as an argument in the constructor. | 116 // TODO(sashab): Remove this and pass it as an argument in the constructor. |
117 void setWindRule(WindRule w) { m_windRule = w; } | 117 void setWindRule(WindRule w) { m_windRule = w; } |
118 WindRule getWindRule() const { return m_windRule; } | 118 WindRule getWindRule() const { return m_windRule; } |
119 | 119 |
120 String customCSSText() const; | 120 String customCSSText() const; |
121 bool equals(const CSSBasicShapePolygonValue&) const; | 121 bool equals(const CSSBasicShapePolygonValue&) const; |
122 | 122 |
123 DECLARE_TRACE_AFTER_DISPATCH(); | 123 DECLARE_TRACE_AFTER_DISPATCH(); |
124 | 124 |
125 private: | 125 private: |
126 CSSBasicShapePolygonValue() | 126 CSSBasicShapePolygonValue() |
127 : CSSValue(BasicShapePolygonClass), | 127 : CSSValue(BasicShapePolygonClass), |
128 m_windRule(RULE_NONZERO) | 128 m_windRule(RULE_NONZERO) |
129 { } | 129 { } |
130 | 130 |
131 HeapVector<Member<CSSPrimitiveValue>> m_values; | 131 HeapVector<Member<CSSPrimitiveValue>> m_values; |
132 WindRule m_windRule; | 132 WindRule m_windRule; |
133 }; | 133 }; |
134 | 134 |
135 class CSSBasicShapeInsetValue final : public CSSValue { | 135 class CSSBasicShapeInsetValue final : public CSSValue { |
136 public: | 136 public: |
137 static RawPtr<CSSBasicShapeInsetValue> create() { return new CSSBasicShapeIn
setValue; } | 137 static CSSBasicShapeInsetValue* create() { return new CSSBasicShapeInsetValu
e; } |
138 | 138 |
139 CSSPrimitiveValue* top() const { return m_top.get(); } | 139 CSSPrimitiveValue* top() const { return m_top.get(); } |
140 CSSPrimitiveValue* right() const { return m_right.get(); } | 140 CSSPrimitiveValue* right() const { return m_right.get(); } |
141 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } | 141 CSSPrimitiveValue* bottom() const { return m_bottom.get(); } |
142 CSSPrimitiveValue* left() const { return m_left.get(); } | 142 CSSPrimitiveValue* left() const { return m_left.get(); } |
143 | 143 |
144 CSSValuePair* topLeftRadius() const { return m_topLeftRadius.get(); } | 144 CSSValuePair* topLeftRadius() const { return m_topLeftRadius.get(); } |
145 CSSValuePair* topRightRadius() const { return m_topRightRadius.get(); } | 145 CSSValuePair* topRightRadius() const { return m_topRightRadius.get(); } |
146 CSSValuePair* bottomRightRadius() const { return m_bottomRightRadius.get();
} | 146 CSSValuePair* bottomRightRadius() const { return m_bottomRightRadius.get();
} |
147 CSSValuePair* bottomLeftRadius() const { return m_bottomLeftRadius.get(); } | 147 CSSValuePair* bottomLeftRadius() const { return m_bottomLeftRadius.get(); } |
148 | 148 |
149 // TODO(sashab): Remove these and pass them as arguments in the constructor. | 149 // TODO(sashab): Remove these and pass them as arguments in the constructor. |
150 void setTop(RawPtr<CSSPrimitiveValue> top) { m_top = top; } | 150 void setTop(CSSPrimitiveValue* top) { m_top = top; } |
151 void setRight(RawPtr<CSSPrimitiveValue> right) { m_right = right; } | 151 void setRight(CSSPrimitiveValue* right) { m_right = right; } |
152 void setBottom(RawPtr<CSSPrimitiveValue> bottom) { m_bottom = bottom; } | 152 void setBottom(CSSPrimitiveValue* bottom) { m_bottom = bottom; } |
153 void setLeft(RawPtr<CSSPrimitiveValue> left) { m_left = left; } | 153 void setLeft(CSSPrimitiveValue* left) { m_left = left; } |
154 | 154 |
155 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right
, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left) | 155 void updateShapeSize4Values(CSSPrimitiveValue* top, CSSPrimitiveValue* right
, CSSPrimitiveValue* bottom, CSSPrimitiveValue* left) |
156 { | 156 { |
157 setTop(top); | 157 setTop(top); |
158 setRight(right); | 158 setRight(right); |
159 setBottom(bottom); | 159 setBottom(bottom); |
160 setLeft(left); | 160 setLeft(left); |
161 } | 161 } |
162 | 162 |
163 void updateShapeSize1Value(CSSPrimitiveValue* value1) | 163 void updateShapeSize1Value(CSSPrimitiveValue* value1) |
164 { | 164 { |
165 updateShapeSize4Values(value1, value1, value1, value1); | 165 updateShapeSize4Values(value1, value1, value1, value1); |
166 } | 166 } |
167 | 167 |
168 void updateShapeSize2Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* v
alue2) | 168 void updateShapeSize2Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* v
alue2) |
169 { | 169 { |
170 updateShapeSize4Values(value1, value2, value1, value2); | 170 updateShapeSize4Values(value1, value2, value1, value2); |
171 } | 171 } |
172 | 172 |
173 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va
lue2, CSSPrimitiveValue* value3) | 173 void updateShapeSize3Values(CSSPrimitiveValue* value1, CSSPrimitiveValue* va
lue2, CSSPrimitiveValue* value3) |
174 { | 174 { |
175 updateShapeSize4Values(value1, value2, value3, value2); | 175 updateShapeSize4Values(value1, value2, value3, value2); |
176 } | 176 } |
177 | 177 |
178 void setTopLeftRadius(RawPtr<CSSValuePair> radius) { m_topLeftRadius = radiu
s; } | 178 void setTopLeftRadius(CSSValuePair* radius) { m_topLeftRadius = radius; } |
179 void setTopRightRadius(RawPtr<CSSValuePair> radius) { m_topRightRadius = rad
ius; } | 179 void setTopRightRadius(CSSValuePair* radius) { m_topRightRadius = radius; } |
180 void setBottomRightRadius(RawPtr<CSSValuePair> radius) { m_bottomRightRadius
= radius; } | 180 void setBottomRightRadius(CSSValuePair* radius) { m_bottomRightRadius = radi
us; } |
181 void setBottomLeftRadius(RawPtr<CSSValuePair> radius) { m_bottomLeftRadius =
radius; } | 181 void setBottomLeftRadius(CSSValuePair* radius) { m_bottomLeftRadius = radius
; } |
182 | 182 |
183 String customCSSText() const; | 183 String customCSSText() const; |
184 bool equals(const CSSBasicShapeInsetValue&) const; | 184 bool equals(const CSSBasicShapeInsetValue&) const; |
185 | 185 |
186 DECLARE_TRACE_AFTER_DISPATCH(); | 186 DECLARE_TRACE_AFTER_DISPATCH(); |
187 | 187 |
188 private: | 188 private: |
189 CSSBasicShapeInsetValue() | 189 CSSBasicShapeInsetValue() |
190 : CSSValue(BasicShapeInsetClass) | 190 : CSSValue(BasicShapeInsetClass) |
191 { } | 191 { } |
(...skipping 10 matching lines...) Expand all Loading... |
202 }; | 202 }; |
203 | 203 |
204 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeCircleValue, isBasicShapeCircleValue())
; | 204 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeCircleValue, isBasicShapeCircleValue())
; |
205 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeEllipseValue, isBasicShapeEllipseValue(
)); | 205 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeEllipseValue, isBasicShapeEllipseValue(
)); |
206 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapePolygonValue, isBasicShapePolygonValue(
)); | 206 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapePolygonValue, isBasicShapePolygonValue(
)); |
207 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeInsetValue, isBasicShapeInsetValue()); | 207 DEFINE_CSS_VALUE_TYPE_CASTS(CSSBasicShapeInsetValue, isBasicShapeInsetValue()); |
208 | 208 |
209 } // namespace blink | 209 } // namespace blink |
210 | 210 |
211 #endif // CSSBasicShapeValues_h | 211 #endif // CSSBasicShapeValues_h |
OLD | NEW |