| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // We have to declare the VectorTraits specialization before CSSGradientValue | 78 // We have to declare the VectorTraits specialization before CSSGradientValue |
| 79 // declares its inline capacity vector below. | 79 // declares its inline capacity vector below. |
| 80 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); | 80 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSGradientColorStop); |
| 81 | 81 |
| 82 namespace blink { | 82 namespace blink { |
| 83 | 83 |
| 84 class CSSGradientValue : public CSSImageGeneratorValue { | 84 class CSSGradientValue : public CSSImageGeneratorValue { |
| 85 public: | 85 public: |
| 86 PassRefPtr<Image> image(LayoutObject*, const IntSize&); | 86 PassRefPtr<Image> image(LayoutObject*, const IntSize&); |
| 87 | 87 |
| 88 void setFirstX(NullableCSSValue val) { m_firstX = val; } | 88 void setFirstX(NullableCSSValue val) { m_firstX = std::move(val); } |
| 89 void setFirstY(NullableCSSValue val) { m_firstY = val; } | 89 void setFirstY(NullableCSSValue val) { m_firstY = std::move(val); } |
| 90 void setSecondX(NullableCSSValue val) { m_secondX = val; } | 90 void setSecondX(NullableCSSValue val) { m_secondX = std::move(val); } |
| 91 void setSecondY(NullableCSSValue val) { m_secondY = val; } | 91 void setSecondY(NullableCSSValue val) { m_secondY = std::move(val); } |
| 92 | 92 |
| 93 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } | 93 void addStop(const CSSGradientColorStop& stop) { m_stops.append(stop); } |
| 94 | 94 |
| 95 unsigned stopCount() const { return m_stops.size(); } | 95 unsigned stopCount() const { return m_stops.size(); } |
| 96 | 96 |
| 97 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; | 97 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; |
| 98 | 98 |
| 99 bool isRepeating() const { return m_repeating; } | 99 bool isRepeating() const { return m_repeating; } |
| 100 | 100 |
| 101 CSSGradientType gradientType() const { return m_gradientType; } | 101 CSSGradientType gradientType() const { return m_gradientType; } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 PassRefPtrWillBeRawPtr<CSSRadialGradientValue> clone() const | 207 PassRefPtrWillBeRawPtr<CSSRadialGradientValue> clone() const |
| 208 { | 208 { |
| 209 return adoptRefWillBeNoop(new CSSRadialGradientValue(*this)); | 209 return adoptRefWillBeNoop(new CSSRadialGradientValue(*this)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 String customCSSText() const; | 212 String customCSSText() const; |
| 213 | 213 |
| 214 void setFirstRadius(CSSPrimitiveValue val) { m_firstRadius = val; } | 214 void setFirstRadius(CSSPrimitiveValue val) { m_firstRadius = val; } |
| 215 void setSecondRadius(CSSPrimitiveValue val) { m_secondRadius = val; } | 215 void setSecondRadius(CSSPrimitiveValue val) { m_secondRadius = val; } |
| 216 | 216 |
| 217 void setShape(NullableCSSValue val) { m_shape = val; } | 217 void setShape(NullableCSSValue val) { m_shape = std::move(val); } |
| 218 void setSizingBehavior(NullableCSSValue val) { m_sizingBehavior = val; } | 218 void setSizingBehavior(NullableCSSValue val) { m_sizingBehavior = std::move(
val); } |
| 219 | 219 |
| 220 void setEndHorizontalSize(NullableCSSValue val) { m_endHorizontalSize = val;
} | 220 void setEndHorizontalSize(NullableCSSValue val) { m_endHorizontalSize = std:
:move(val); } |
| 221 void setEndVerticalSize(NullableCSSValue val) { m_endVerticalSize = val; } | 221 void setEndVerticalSize(NullableCSSValue val) { m_endVerticalSize = std::mov
e(val); } |
| 222 | 222 |
| 223 // Create the gradient for a given size. | 223 // Create the gradient for a given size. |
| 224 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); | 224 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); |
| 225 | 225 |
| 226 bool equals(const CSSRadialGradientValue&) const; | 226 bool equals(const CSSRadialGradientValue&) const; |
| 227 | 227 |
| 228 DECLARE_TRACE_AFTER_DISPATCH(); | 228 DECLARE_TRACE_AFTER_DISPATCH(); |
| 229 | 229 |
| 230 private: | 230 private: |
| 231 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) | 231 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) |
| 232 : CSSGradientValue(RadialGradientClass, repeat, gradientType) | 232 : CSSGradientValue(RadialGradientClass, repeat, gradientType) |
| 233 { | 233 { |
| 234 } | 234 } |
| 235 | 235 |
| 236 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) | 236 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) |
| 237 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) | 237 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) |
| 238 , m_firstRadius(other.m_firstRadius) | 238 , m_firstRadius(other.m_firstRadius) |
| 239 , m_secondRadius(other.m_secondRadius) | 239 , m_secondRadius(other.m_secondRadius) |
| 240 , m_shape(other.m_shape) | 240 , m_shape(other.m_shape) |
| 241 , m_sizingBehavior(other.m_sizingBehavior) | 241 , m_sizingBehavior(other.m_sizingBehavior) |
| 242 , m_endHorizontalSize(other.m_endHorizontalSize) | 242 , m_endHorizontalSize(other.m_endHorizontalSize) |
| 243 , m_endVerticalSize(other.m_endVerticalSize) | 243 , m_endVerticalSize(other.m_endVerticalSize) |
| 244 { | 244 { |
| 245 } | 245 } |
| 246 | 246 |
| 247 | 247 |
| 248 // Resolve points/radii to front end values. | 248 // Resolve points/radii to front end values. |
| 249 float resolveRadius(CSSPrimitiveValue, const CSSToLengthConversionData&, flo
at* widthOrHeight = 0); | 249 float resolveRadius(const CSSPrimitiveValue&, const CSSToLengthConversionDat
a&, float* widthOrHeight = 0); |
| 250 | 250 |
| 251 // These may be null for non-deprecated gradients. | 251 // These may be null for non-deprecated gradients. |
| 252 NullableCSSValue m_firstRadius; | 252 NullableCSSValue m_firstRadius; |
| 253 NullableCSSValue m_secondRadius; | 253 NullableCSSValue m_secondRadius; |
| 254 | 254 |
| 255 // The below are only used for non-deprecated gradients. Any of them may be
null. | 255 // The below are only used for non-deprecated gradients. Any of them may be
null. |
| 256 NullableCSSValue m_shape; | 256 NullableCSSValue m_shape; |
| 257 NullableCSSValue m_sizingBehavior; | 257 NullableCSSValue m_sizingBehavior; |
| 258 | 258 |
| 259 NullableCSSValue m_endHorizontalSize; | 259 NullableCSSValue m_endHorizontalSize; |
| 260 NullableCSSValue m_endVerticalSize; | 260 NullableCSSValue m_endVerticalSize; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); | 263 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); |
| 264 | 264 |
| 265 } // namespace blink | 265 } // namespace blink |
| 266 | 266 |
| 267 #endif // CSSGradientValue_h | 267 #endif // CSSGradientValue_h |
| OLD | NEW |