OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void setFirstY(PassRefPtr<CSSPrimitiveValue> val) { m_firstY = val; } | 68 void setFirstY(PassRefPtr<CSSPrimitiveValue> val) { m_firstY = val; } |
69 void setSecondX(PassRefPtr<CSSPrimitiveValue> val) { m_secondX = val; } | 69 void setSecondX(PassRefPtr<CSSPrimitiveValue> val) { m_secondX = val; } |
70 void setSecondY(PassRefPtr<CSSPrimitiveValue> val) { m_secondY = val; } | 70 void setSecondY(PassRefPtr<CSSPrimitiveValue> val) { m_secondY = val; } |
71 | 71 |
72 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } | 72 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } |
73 | 73 |
74 unsigned stopCount() const { return m_stops.size(); } | 74 unsigned stopCount() const { return m_stops.size(); } |
75 | 75 |
76 void sortStopsIfNeeded(); | 76 void sortStopsIfNeeded(); |
77 | 77 |
78 bool isLinearGradient() const { return classType() == LinearGradientClass; } | |
79 bool isRadialGradient() const { return classType() == RadialGradientClass; } | |
80 | |
81 bool isRepeating() const { return m_repeating; } | 78 bool isRepeating() const { return m_repeating; } |
82 | 79 |
83 CSSGradientType gradientType() const { return m_gradientType; } | 80 CSSGradientType gradientType() const { return m_gradientType; } |
84 | 81 |
85 bool isFixedSize() const { return false; } | 82 bool isFixedSize() const { return false; } |
86 IntSize fixedSize(const RenderObject*) const { return IntSize(); } | 83 IntSize fixedSize(const RenderObject*) const { return IntSize(); } |
87 | 84 |
88 bool isPending() const { return false; } | 85 bool isPending() const { return false; } |
89 bool knownToBeOpaque(const RenderObject*) const; | 86 bool knownToBeOpaque(const RenderObject*) const; |
90 | 87 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 RefPtr<CSSPrimitiveValue> m_secondX; | 124 RefPtr<CSSPrimitiveValue> m_secondX; |
128 RefPtr<CSSPrimitiveValue> m_secondY; | 125 RefPtr<CSSPrimitiveValue> m_secondY; |
129 | 126 |
130 // Stops | 127 // Stops |
131 Vector<CSSGradientColorStop, 2> m_stops; | 128 Vector<CSSGradientColorStop, 2> m_stops; |
132 bool m_stopsSorted; | 129 bool m_stopsSorted; |
133 CSSGradientType m_gradientType; | 130 CSSGradientType m_gradientType; |
134 bool m_repeating; | 131 bool m_repeating; |
135 }; | 132 }; |
136 | 133 |
| 134 DEFINE_CSS_VALUE_TYPE_CASTS(GradientValue); |
137 | 135 |
138 class CSSLinearGradientValue : public CSSGradientValue { | 136 class CSSLinearGradientValue : public CSSGradientValue { |
139 public: | 137 public: |
140 | 138 |
141 static PassRefPtr<CSSLinearGradientValue> create(CSSGradientRepeat repeat, C
SSGradientType gradientType = CSSLinearGradient) | 139 static PassRefPtr<CSSLinearGradientValue> create(CSSGradientRepeat repeat, C
SSGradientType gradientType = CSSLinearGradient) |
142 { | 140 { |
143 return adoptRef(new CSSLinearGradientValue(repeat, gradientType)); | 141 return adoptRef(new CSSLinearGradientValue(repeat, gradientType)); |
144 } | 142 } |
145 | 143 |
146 void setAngle(PassRefPtr<CSSPrimitiveValue> val) { m_angle = val; } | 144 void setAngle(PassRefPtr<CSSPrimitiveValue> val) { m_angle = val; } |
(...skipping 18 matching lines...) Expand all Loading... |
165 | 163 |
166 explicit CSSLinearGradientValue(const CSSLinearGradientValue& other) | 164 explicit CSSLinearGradientValue(const CSSLinearGradientValue& other) |
167 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) | 165 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) |
168 , m_angle(other.m_angle) | 166 , m_angle(other.m_angle) |
169 { | 167 { |
170 } | 168 } |
171 | 169 |
172 RefPtr<CSSPrimitiveValue> m_angle; // may be null. | 170 RefPtr<CSSPrimitiveValue> m_angle; // may be null. |
173 }; | 171 }; |
174 | 172 |
| 173 DEFINE_CSS_VALUE_TYPE_CASTS(LinearGradientValue); |
| 174 |
175 class CSSRadialGradientValue : public CSSGradientValue { | 175 class CSSRadialGradientValue : public CSSGradientValue { |
176 public: | 176 public: |
177 static PassRefPtr<CSSRadialGradientValue> create(CSSGradientRepeat repeat, C
SSGradientType gradientType = CSSRadialGradient) | 177 static PassRefPtr<CSSRadialGradientValue> create(CSSGradientRepeat repeat, C
SSGradientType gradientType = CSSRadialGradient) |
178 { | 178 { |
179 return adoptRef(new CSSRadialGradientValue(repeat, gradientType)); | 179 return adoptRef(new CSSRadialGradientValue(repeat, gradientType)); |
180 } | 180 } |
181 | 181 |
182 PassRefPtr<CSSRadialGradientValue> clone() const | 182 PassRefPtr<CSSRadialGradientValue> clone() const |
183 { | 183 { |
184 return adoptRef(new CSSRadialGradientValue(*this)); | 184 return adoptRef(new CSSRadialGradientValue(*this)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 RefPtr<CSSPrimitiveValue> m_secondRadius; | 226 RefPtr<CSSPrimitiveValue> m_secondRadius; |
227 | 227 |
228 // The below are only used for non-deprecated gradients. Any of them may be
null. | 228 // The below are only used for non-deprecated gradients. Any of them may be
null. |
229 RefPtr<CSSPrimitiveValue> m_shape; | 229 RefPtr<CSSPrimitiveValue> m_shape; |
230 RefPtr<CSSPrimitiveValue> m_sizingBehavior; | 230 RefPtr<CSSPrimitiveValue> m_sizingBehavior; |
231 | 231 |
232 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; | 232 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; |
233 RefPtr<CSSPrimitiveValue> m_endVerticalSize; | 233 RefPtr<CSSPrimitiveValue> m_endVerticalSize; |
234 }; | 234 }; |
235 | 235 |
| 236 DEFINE_CSS_VALUE_TYPE_CASTS(RadialGradientValue); |
| 237 |
236 } // namespace WebCore | 238 } // namespace WebCore |
237 | 239 |
238 #endif // CSSGradientValue_h | 240 #endif // CSSGradientValue_h |
OLD | NEW |