| 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 29 matching lines...) Expand all Loading... |
| 40 enum CSSGradientType { | 40 enum CSSGradientType { |
| 41 CSSDeprecatedLinearGradient, | 41 CSSDeprecatedLinearGradient, |
| 42 CSSDeprecatedRadialGradient, | 42 CSSDeprecatedRadialGradient, |
| 43 CSSPrefixedLinearGradient, | 43 CSSPrefixedLinearGradient, |
| 44 CSSPrefixedRadialGradient, | 44 CSSPrefixedRadialGradient, |
| 45 CSSLinearGradient, | 45 CSSLinearGradient, |
| 46 CSSRadialGradient | 46 CSSRadialGradient |
| 47 }; | 47 }; |
| 48 enum CSSGradientRepeat { NonRepeating, Repeating }; | 48 enum CSSGradientRepeat { NonRepeating, Repeating }; |
| 49 | 49 |
| 50 // This struct is stack allocated and allocated as part of vectors. | |
| 51 // When allocated on the stack its members are found by conservative | |
| 52 // stack scanning. When allocated as part of Vectors in heap-allocated | |
| 53 // objects its members are visited via the containing object's | |
| 54 // (CSSGradientValue) traceAfterDispatch method. | |
| 55 struct CSSGradientColorStop { | 50 struct CSSGradientColorStop { |
| 56 ALLOW_ONLY_INLINE_ALLOCATION(); | 51 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 57 public: | 52 public: |
| 58 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; | 53 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; |
| 59 RefPtr<CSSPrimitiveValue> m_position; // percentage or length | 54 RefPtr<CSSPrimitiveValue> m_position; // percentage or length |
| 60 RefPtr<CSSPrimitiveValue> m_color; | 55 RefPtr<CSSPrimitiveValue> m_color; |
| 61 Color m_resolvedColor; | 56 Color m_resolvedColor; |
| 62 bool m_colorIsDerivedFromElement; | 57 bool m_colorIsDerivedFromElement; |
| 63 bool operator==(const CSSGradientColorStop& other) const | 58 bool operator==(const CSSGradientColorStop& other) const |
| 64 { | 59 { |
| 65 return compareCSSValuePtr(m_color, other.m_color) | 60 return compareCSSValuePtr(m_color, other.m_color) |
| 66 && compareCSSValuePtr(m_position, other.m_position); | 61 && compareCSSValuePtr(m_position, other.m_position); |
| 67 } | 62 } |
| 68 | |
| 69 void trace(Visitor*); | |
| 70 }; | 63 }; |
| 71 | 64 |
| 72 } // namespace blink | 65 } // namespace blink |
| 73 | 66 |
| 74 | 67 |
| 75 // We have to declare the VectorTraits specialization before CSSGradientValue | 68 // We have to declare the VectorTraits specialization before CSSGradientValue |
| 76 // declares its inline capacity vector below. | 69 // declares its inline capacity vector below. |
| 77 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); | 70 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); |
| 78 | 71 |
| 79 namespace blink { | 72 namespace blink { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 99 | 92 |
| 100 bool isFixedSize() const { return false; } | 93 bool isFixedSize() const { return false; } |
| 101 IntSize fixedSize(const RenderObject*) const { return IntSize(); } | 94 IntSize fixedSize(const RenderObject*) const { return IntSize(); } |
| 102 | 95 |
| 103 bool isPending() const { return false; } | 96 bool isPending() const { return false; } |
| 104 bool knownToBeOpaque(const RenderObject*) const; | 97 bool knownToBeOpaque(const RenderObject*) const; |
| 105 | 98 |
| 106 void loadSubimages(ResourceFetcher*) { } | 99 void loadSubimages(ResourceFetcher*) { } |
| 107 PassRefPtr<CSSGradientValue> gradientWithStylesResolved(const TextLinkColors
&, Color currentColor); | 100 PassRefPtr<CSSGradientValue> gradientWithStylesResolved(const TextLinkColors
&, Color currentColor); |
| 108 | 101 |
| 109 void traceAfterDispatch(Visitor*); | |
| 110 | |
| 111 protected: | 102 protected: |
| 112 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT
ype gradientType) | 103 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT
ype gradientType) |
| 113 : CSSImageGeneratorValue(classType) | 104 : CSSImageGeneratorValue(classType) |
| 114 , m_stopsSorted(false) | 105 , m_stopsSorted(false) |
| 115 , m_gradientType(gradientType) | 106 , m_gradientType(gradientType) |
| 116 , m_repeating(repeat == Repeating) | 107 , m_repeating(repeat == Repeating) |
| 117 { | 108 { |
| 118 } | 109 } |
| 119 | 110 |
| 120 CSSGradientValue(const CSSGradientValue& other, ClassType classType, CSSGrad
ientType gradientType) | 111 CSSGradientValue(const CSSGradientValue& other, ClassType classType, CSSGrad
ientType gradientType) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // Create the gradient for a given size. | 159 // Create the gradient for a given size. |
| 169 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&); | 160 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&); |
| 170 | 161 |
| 171 PassRefPtr<CSSLinearGradientValue> clone() const | 162 PassRefPtr<CSSLinearGradientValue> clone() const |
| 172 { | 163 { |
| 173 return adoptRef(new CSSLinearGradientValue(*this)); | 164 return adoptRef(new CSSLinearGradientValue(*this)); |
| 174 } | 165 } |
| 175 | 166 |
| 176 bool equals(const CSSLinearGradientValue&) const; | 167 bool equals(const CSSLinearGradientValue&) const; |
| 177 | 168 |
| 178 void traceAfterDispatch(Visitor*); | |
| 179 | |
| 180 private: | 169 private: |
| 181 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) | 170 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) |
| 182 : CSSGradientValue(LinearGradientClass, repeat, gradientType) | 171 : CSSGradientValue(LinearGradientClass, repeat, gradientType) |
| 183 { | 172 { |
| 184 } | 173 } |
| 185 | 174 |
| 186 explicit CSSLinearGradientValue(const CSSLinearGradientValue& other) | 175 explicit CSSLinearGradientValue(const CSSLinearGradientValue& other) |
| 187 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) | 176 : CSSGradientValue(other, LinearGradientClass, other.gradientType()) |
| 188 , m_angle(other.m_angle) | 177 , m_angle(other.m_angle) |
| 189 { | 178 { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 215 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior
= val; } | 204 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior
= val; } |
| 216 | 205 |
| 217 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont
alSize = val; } | 206 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont
alSize = val; } |
| 218 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi
ze = val; } | 207 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi
ze = val; } |
| 219 | 208 |
| 220 // Create the gradient for a given size. | 209 // Create the gradient for a given size. |
| 221 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&); | 210 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&); |
| 222 | 211 |
| 223 bool equals(const CSSRadialGradientValue&) const; | 212 bool equals(const CSSRadialGradientValue&) const; |
| 224 | 213 |
| 225 void traceAfterDispatch(Visitor*); | |
| 226 | |
| 227 private: | 214 private: |
| 228 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) | 215 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) |
| 229 : CSSGradientValue(RadialGradientClass, repeat, gradientType) | 216 : CSSGradientValue(RadialGradientClass, repeat, gradientType) |
| 230 { | 217 { |
| 231 } | 218 } |
| 232 | 219 |
| 233 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) | 220 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) |
| 234 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) | 221 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) |
| 235 , m_firstRadius(other.m_firstRadius) | 222 , m_firstRadius(other.m_firstRadius) |
| 236 , m_secondRadius(other.m_secondRadius) | 223 , m_secondRadius(other.m_secondRadius) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 255 | 242 |
| 256 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; | 243 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; |
| 257 RefPtr<CSSPrimitiveValue> m_endVerticalSize; | 244 RefPtr<CSSPrimitiveValue> m_endVerticalSize; |
| 258 }; | 245 }; |
| 259 | 246 |
| 260 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); | 247 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); |
| 261 | 248 |
| 262 } // namespace blink | 249 } // namespace blink |
| 263 | 250 |
| 264 #endif // CSSGradientValue_h | 251 #endif // CSSGradientValue_h |
| OLD | NEW |