| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // We have to declare the VectorTraits specialization before CSSGradientValue | 81 // We have to declare the VectorTraits specialization before CSSGradientValue |
| 82 // declares its inline capacity vector below. | 82 // declares its inline capacity vector below. |
| 83 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); | 83 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); |
| 84 | 84 |
| 85 namespace blink { | 85 namespace blink { |
| 86 | 86 |
| 87 class CSSGradientValue : public CSSImageGeneratorValue { | 87 class CSSGradientValue : public CSSImageGeneratorValue { |
| 88 public: | 88 public: |
| 89 PassRefPtr<Image> image(const LayoutObject&, const IntSize&); | 89 PassRefPtr<Image> image(const LayoutObject&, const IntSize&); |
| 90 | 90 |
| 91 void setFirstX(RawPtr<CSSValue> val) { m_firstX = val; } | 91 void setFirstX(CSSValue* val) { m_firstX = val; } |
| 92 void setFirstY(RawPtr<CSSValue> val) { m_firstY = val; } | 92 void setFirstY(CSSValue* val) { m_firstY = val; } |
| 93 void setSecondX(RawPtr<CSSValue> val) { m_secondX = val; } | 93 void setSecondX(CSSValue* val) { m_secondX = val; } |
| 94 void setSecondY(RawPtr<CSSValue> val) { m_secondY = val; } | 94 void setSecondY(CSSValue* val) { m_secondY = val; } |
| 95 | 95 |
| 96 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } | 96 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } |
| 97 | 97 |
| 98 unsigned stopCount() const { return m_stops.size(); } | 98 unsigned stopCount() const { return m_stops.size(); } |
| 99 | 99 |
| 100 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; | 100 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; |
| 101 | 101 |
| 102 bool isRepeating() const { return m_repeating; } | 102 bool isRepeating() const { return m_repeating; } |
| 103 | 103 |
| 104 CSSGradientType gradientType() const { return m_gradientType; } | 104 CSSGradientType gradientType() const { return m_gradientType; } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 bool m_stopsSorted; | 144 bool m_stopsSorted; |
| 145 CSSGradientType m_gradientType; | 145 CSSGradientType m_gradientType; |
| 146 bool m_repeating; | 146 bool m_repeating; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGradientValue, isGradientValue()); | 149 DEFINE_CSS_VALUE_TYPE_CASTS(CSSGradientValue, isGradientValue()); |
| 150 | 150 |
| 151 class CSSLinearGradientValue final : public CSSGradientValue { | 151 class CSSLinearGradientValue final : public CSSGradientValue { |
| 152 public: | 152 public: |
| 153 | 153 |
| 154 static RawPtr<CSSLinearGradientValue> create(CSSGradientRepeat repeat, CSSGr
adientType gradientType = CSSLinearGradient) | 154 static CSSLinearGradientValue* create(CSSGradientRepeat repeat, CSSGradientT
ype gradientType = CSSLinearGradient) |
| 155 { | 155 { |
| 156 return new CSSLinearGradientValue(repeat, gradientType); | 156 return new CSSLinearGradientValue(repeat, gradientType); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void setAngle(RawPtr<CSSPrimitiveValue> val) { m_angle = val; } | 159 void setAngle(CSSPrimitiveValue* val) { m_angle = val; } |
| 160 | 160 |
| 161 String customCSSText() const; | 161 String customCSSText() const; |
| 162 | 162 |
| 163 // Create the gradient for a given size. | 163 // Create the gradient for a given size. |
| 164 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); | 164 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); |
| 165 | 165 |
| 166 bool equals(const CSSLinearGradientValue&) const; | 166 bool equals(const CSSLinearGradientValue&) const; |
| 167 | 167 |
| 168 DECLARE_TRACE_AFTER_DISPATCH(); | 168 DECLARE_TRACE_AFTER_DISPATCH(); |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) | 171 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSLinearGradient) |
| 172 : CSSGradientValue(LinearGradientClass, repeat, gradientType) | 172 : CSSGradientValue(LinearGradientClass, repeat, gradientType) |
| 173 { | 173 { |
| 174 } | 174 } |
| 175 | 175 |
| 176 Member<CSSPrimitiveValue> m_angle; // may be null. | 176 Member<CSSPrimitiveValue> m_angle; // may be null. |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 DEFINE_CSS_VALUE_TYPE_CASTS(CSSLinearGradientValue, isLinearGradientValue()); | 179 DEFINE_CSS_VALUE_TYPE_CASTS(CSSLinearGradientValue, isLinearGradientValue()); |
| 180 | 180 |
| 181 class CSSRadialGradientValue final : public CSSGradientValue { | 181 class CSSRadialGradientValue final : public CSSGradientValue { |
| 182 public: | 182 public: |
| 183 static RawPtr<CSSRadialGradientValue> create(CSSGradientRepeat repeat, CSSGr
adientType gradientType = CSSRadialGradient) | 183 static CSSRadialGradientValue* create(CSSGradientRepeat repeat, CSSGradientT
ype gradientType = CSSRadialGradient) |
| 184 { | 184 { |
| 185 return new CSSRadialGradientValue(repeat, gradientType); | 185 return new CSSRadialGradientValue(repeat, gradientType); |
| 186 } | 186 } |
| 187 | 187 |
| 188 String customCSSText() const; | 188 String customCSSText() const; |
| 189 | 189 |
| 190 void setFirstRadius(RawPtr<CSSPrimitiveValue> val) { m_firstRadius = val; } | 190 void setFirstRadius(CSSPrimitiveValue* val) { m_firstRadius = val; } |
| 191 void setSecondRadius(RawPtr<CSSPrimitiveValue> val) { m_secondRadius = val;
} | 191 void setSecondRadius(CSSPrimitiveValue* val) { m_secondRadius = val; } |
| 192 | 192 |
| 193 void setShape(RawPtr<CSSPrimitiveValue> val) { m_shape = val; } | 193 void setShape(CSSPrimitiveValue* val) { m_shape = val; } |
| 194 void setSizingBehavior(RawPtr<CSSPrimitiveValue> val) { m_sizingBehavior = v
al; } | 194 void setSizingBehavior(CSSPrimitiveValue* val) { m_sizingBehavior = val; } |
| 195 | 195 |
| 196 void setEndHorizontalSize(RawPtr<CSSPrimitiveValue> val) { m_endHorizontalSi
ze = val; } | 196 void setEndHorizontalSize(CSSPrimitiveValue* val) { m_endHorizontalSize = va
l; } |
| 197 void setEndVerticalSize(RawPtr<CSSPrimitiveValue> val) { m_endVerticalSize =
val; } | 197 void setEndVerticalSize(CSSPrimitiveValue* val) { m_endVerticalSize = val; } |
| 198 | 198 |
| 199 // Create the gradient for a given size. | 199 // Create the gradient for a given size. |
| 200 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); | 200 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); |
| 201 | 201 |
| 202 bool equals(const CSSRadialGradientValue&) const; | 202 bool equals(const CSSRadialGradientValue&) const; |
| 203 | 203 |
| 204 DECLARE_TRACE_AFTER_DISPATCH(); | 204 DECLARE_TRACE_AFTER_DISPATCH(); |
| 205 | 205 |
| 206 private: | 206 private: |
| 207 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) | 207 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 222 | 222 |
| 223 Member<CSSPrimitiveValue> m_endHorizontalSize; | 223 Member<CSSPrimitiveValue> m_endHorizontalSize; |
| 224 Member<CSSPrimitiveValue> m_endVerticalSize; | 224 Member<CSSPrimitiveValue> m_endVerticalSize; |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); | 227 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); |
| 228 | 228 |
| 229 } // namespace blink | 229 } // namespace blink |
| 230 | 230 |
| 231 #endif // CSSGradientValue_h | 231 #endif // CSSGradientValue_h |
| OLD | NEW |