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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 CSSRadialGradient | 45 CSSRadialGradient |
46 }; | 46 }; |
47 enum CSSGradientRepeat { NonRepeating, Repeating }; | 47 enum CSSGradientRepeat { NonRepeating, Repeating }; |
48 | 48 |
49 struct CSSGradientColorStop { | 49 struct CSSGradientColorStop { |
50 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; | 50 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; |
51 RefPtr<CSSPrimitiveValue> m_position; // percentage or length | 51 RefPtr<CSSPrimitiveValue> m_position; // percentage or length |
52 RefPtr<CSSPrimitiveValue> m_color; | 52 RefPtr<CSSPrimitiveValue> m_color; |
53 Color m_resolvedColor; | 53 Color m_resolvedColor; |
54 bool m_colorIsDerivedFromElement; | 54 bool m_colorIsDerivedFromElement; |
55 void reportMemoryUsage(MemoryObjectInfo*) const; | |
56 bool operator==(const CSSGradientColorStop& other) const | 55 bool operator==(const CSSGradientColorStop& other) const |
57 { | 56 { |
58 return compareCSSValuePtr(m_color, other.m_color) | 57 return compareCSSValuePtr(m_color, other.m_color) |
59 && compareCSSValuePtr(m_position, other.m_position); | 58 && compareCSSValuePtr(m_position, other.m_position); |
60 } | 59 } |
61 }; | 60 }; |
62 | 61 |
63 class CSSGradientValue : public CSSImageGeneratorValue { | 62 class CSSGradientValue : public CSSImageGeneratorValue { |
64 public: | 63 public: |
65 PassRefPtr<Image> image(RenderObject*, const IntSize&); | 64 PassRefPtr<Image> image(RenderObject*, const IntSize&); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 { | 112 { |
114 } | 113 } |
115 | 114 |
116 void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLen
gthForRepeat = 0); | 115 void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLen
gthForRepeat = 0); |
117 | 116 |
118 // Resolve points/radii to front end values. | 117 // Resolve points/radii to front end values. |
119 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderSty
le*, RenderStyle* rootStyle, const IntSize&); | 118 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderSty
le*, RenderStyle* rootStyle, const IntSize&); |
120 | 119 |
121 bool isCacheable() const; | 120 bool isCacheable() const; |
122 | 121 |
123 void reportBaseClassMemoryUsage(MemoryObjectInfo*) const; | |
124 | |
125 // Points. Some of these may be null. | 122 // Points. Some of these may be null. |
126 RefPtr<CSSPrimitiveValue> m_firstX; | 123 RefPtr<CSSPrimitiveValue> m_firstX; |
127 RefPtr<CSSPrimitiveValue> m_firstY; | 124 RefPtr<CSSPrimitiveValue> m_firstY; |
128 | 125 |
129 RefPtr<CSSPrimitiveValue> m_secondX; | 126 RefPtr<CSSPrimitiveValue> m_secondX; |
130 RefPtr<CSSPrimitiveValue> m_secondY; | 127 RefPtr<CSSPrimitiveValue> m_secondY; |
131 | 128 |
132 // Stops | 129 // Stops |
133 Vector<CSSGradientColorStop, 2> m_stops; | 130 Vector<CSSGradientColorStop, 2> m_stops; |
134 bool m_stopsSorted; | 131 bool m_stopsSorted; |
(...skipping 17 matching lines...) Expand all Loading... |
152 // Create the gradient for a given size. | 149 // Create the gradient for a given size. |
153 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); | 150 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); |
154 | 151 |
155 PassRefPtr<CSSLinearGradientValue> clone() const | 152 PassRefPtr<CSSLinearGradientValue> clone() const |
156 { | 153 { |
157 return adoptRef(new CSSLinearGradientValue(*this)); | 154 return adoptRef(new CSSLinearGradientValue(*this)); |
158 } | 155 } |
159 | 156 |
160 bool equals(const CSSLinearGradientValue&) const; | 157 bool equals(const CSSLinearGradientValue&) const; |
161 | 158 |
162 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
163 | |
164 private: | 159 private: |
165 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) | 160 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) |
166 : CSSGradientValue(LinearGradientClass, repeat, gradientType) | 161 : CSSGradientValue(LinearGradientClass, repeat, gradientType) |
167 { | 162 { |
168 } | 163 } |
169 | 164 |
170 CSSLinearGradientValue(const CSSLinearGradientValue& other) | 165 CSSLinearGradientValue(const CSSLinearGradientValue& other) |
171 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) | 166 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) |
172 , m_angle(other.m_angle) | 167 , m_angle(other.m_angle) |
173 { | 168 { |
(...skipping 23 matching lines...) Expand all Loading... |
197 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior
= val; } | 192 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior
= val; } |
198 | 193 |
199 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont
alSize = val; } | 194 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont
alSize = val; } |
200 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi
ze = val; } | 195 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi
ze = val; } |
201 | 196 |
202 // Create the gradient for a given size. | 197 // Create the gradient for a given size. |
203 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); | 198 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); |
204 | 199 |
205 bool equals(const CSSRadialGradientValue&) const; | 200 bool equals(const CSSRadialGradientValue&) const; |
206 | 201 |
207 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
208 | |
209 private: | 202 private: |
210 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) | 203 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) |
211 : CSSGradientValue(RadialGradientClass, repeat, gradientType) | 204 : CSSGradientValue(RadialGradientClass, repeat, gradientType) |
212 { | 205 { |
213 } | 206 } |
214 | 207 |
215 CSSRadialGradientValue(const CSSRadialGradientValue& other) | 208 CSSRadialGradientValue(const CSSRadialGradientValue& other) |
216 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) | 209 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) |
217 , m_firstRadius(other.m_firstRadius) | 210 , m_firstRadius(other.m_firstRadius) |
218 , m_secondRadius(other.m_secondRadius) | 211 , m_secondRadius(other.m_secondRadius) |
(...skipping 16 matching lines...) Expand all Loading... |
235 RefPtr<CSSPrimitiveValue> m_shape; | 228 RefPtr<CSSPrimitiveValue> m_shape; |
236 RefPtr<CSSPrimitiveValue> m_sizingBehavior; | 229 RefPtr<CSSPrimitiveValue> m_sizingBehavior; |
237 | 230 |
238 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; | 231 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; |
239 RefPtr<CSSPrimitiveValue> m_endVerticalSize; | 232 RefPtr<CSSPrimitiveValue> m_endVerticalSize; |
240 }; | 233 }; |
241 | 234 |
242 } // namespace WebCore | 235 } // namespace WebCore |
243 | 236 |
244 #endif // CSSGradientValue_h | 237 #endif // CSSGradientValue_h |
OLD | NEW |