| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 | 77 |
| 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(RenderObject*, const IntSize&); | 86 PassRefPtr<Image> image(LayoutObject*, const IntSize&); |
| 87 | 87 |
| 88 void setFirstX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstX = v
al; } | 88 void setFirstX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstX = v
al; } |
| 89 void setFirstY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstY = v
al; } | 89 void setFirstY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_firstY = v
al; } |
| 90 void setSecondX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondX =
val; } | 90 void setSecondX(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondX =
val; } |
| 91 void setSecondY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondY =
val; } | 91 void setSecondY(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_secondY =
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 void sortStopsIfNeeded(); | 99 void sortStopsIfNeeded(); |
| 100 | 100 |
| 101 bool isRepeating() const { return m_repeating; } | 101 bool isRepeating() const { return m_repeating; } |
| 102 | 102 |
| 103 CSSGradientType gradientType() const { return m_gradientType; } | 103 CSSGradientType gradientType() const { return m_gradientType; } |
| 104 | 104 |
| 105 bool isFixedSize() const { return false; } | 105 bool isFixedSize() const { return false; } |
| 106 IntSize fixedSize(const RenderObject*) const { return IntSize(); } | 106 IntSize fixedSize(const LayoutObject*) const { return IntSize(); } |
| 107 | 107 |
| 108 bool isPending() const { return false; } | 108 bool isPending() const { return false; } |
| 109 bool knownToBeOpaque(const RenderObject*) const; | 109 bool knownToBeOpaque(const LayoutObject*) const; |
| 110 | 110 |
| 111 void loadSubimages(ResourceFetcher*) { } | 111 void loadSubimages(ResourceFetcher*) { } |
| 112 | 112 |
| 113 void traceAfterDispatch(Visitor*); | 113 void traceAfterDispatch(Visitor*); |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT
ype gradientType) | 116 CSSGradientValue(ClassType classType, CSSGradientRepeat repeat, CSSGradientT
ype gradientType) |
| 117 : CSSImageGeneratorValue(classType) | 117 : CSSImageGeneratorValue(classType) |
| 118 , m_stopsSorted(false) | 118 , m_stopsSorted(false) |
| 119 , m_gradientType(gradientType) | 119 , m_gradientType(gradientType) |
| 120 , m_repeating(repeat == Repeating) | 120 , m_repeating(repeat == Repeating) |
| 121 { | 121 { |
| 122 } | 122 } |
| 123 | 123 |
| 124 CSSGradientValue(const CSSGradientValue& other, ClassType classType, CSSGrad
ientType gradientType) | 124 CSSGradientValue(const CSSGradientValue& other, ClassType classType, CSSGrad
ientType gradientType) |
| 125 : CSSImageGeneratorValue(classType) | 125 : CSSImageGeneratorValue(classType) |
| 126 , m_firstX(other.m_firstX) | 126 , m_firstX(other.m_firstX) |
| 127 , m_firstY(other.m_firstY) | 127 , m_firstY(other.m_firstY) |
| 128 , m_secondX(other.m_secondX) | 128 , m_secondX(other.m_secondX) |
| 129 , m_secondY(other.m_secondY) | 129 , m_secondY(other.m_secondY) |
| 130 , m_stops(other.m_stops) | 130 , m_stops(other.m_stops) |
| 131 , m_stopsSorted(other.m_stopsSorted) | 131 , m_stopsSorted(other.m_stopsSorted) |
| 132 , m_gradientType(gradientType) | 132 , m_gradientType(gradientType) |
| 133 , m_repeating(other.isRepeating() ? Repeating : NonRepeating) | 133 , m_repeating(other.isRepeating() ? Repeating : NonRepeating) |
| 134 { | 134 { |
| 135 } | 135 } |
| 136 | 136 |
| 137 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthFo
rRepeat, const RenderObject&); | 137 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthFo
rRepeat, const LayoutObject&); |
| 138 | 138 |
| 139 // Resolve points/radii to front end values. | 139 // Resolve points/radii to front end values. |
| 140 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSS
ToLengthConversionData&, const IntSize&); | 140 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSS
ToLengthConversionData&, const IntSize&); |
| 141 | 141 |
| 142 bool isCacheable() const; | 142 bool isCacheable() const; |
| 143 | 143 |
| 144 // Points. Some of these may be null. | 144 // Points. Some of these may be null. |
| 145 RefPtrWillBeMember<CSSPrimitiveValue> m_firstX; | 145 RefPtrWillBeMember<CSSPrimitiveValue> m_firstX; |
| 146 RefPtrWillBeMember<CSSPrimitiveValue> m_firstY; | 146 RefPtrWillBeMember<CSSPrimitiveValue> m_firstY; |
| 147 | 147 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 163 static PassRefPtrWillBeRawPtr<CSSLinearGradientValue> create(CSSGradientRepe
at repeat, CSSGradientType gradientType = CSSLinearGradient) | 163 static PassRefPtrWillBeRawPtr<CSSLinearGradientValue> create(CSSGradientRepe
at repeat, CSSGradientType gradientType = CSSLinearGradient) |
| 164 { | 164 { |
| 165 return adoptRefWillBeNoop(new CSSLinearGradientValue(repeat, gradientTyp
e)); | 165 return adoptRefWillBeNoop(new CSSLinearGradientValue(repeat, gradientTyp
e)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void setAngle(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_angle = val
; } | 168 void setAngle(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_angle = val
; } |
| 169 | 169 |
| 170 String customCSSText() const; | 170 String customCSSText() const; |
| 171 | 171 |
| 172 // Create the gradient for a given size. | 172 // Create the gradient for a given size. |
| 173 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const RenderObject&); | 173 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); |
| 174 | 174 |
| 175 PassRefPtrWillBeRawPtr<CSSLinearGradientValue> clone() const | 175 PassRefPtrWillBeRawPtr<CSSLinearGradientValue> clone() const |
| 176 { | 176 { |
| 177 return adoptRefWillBeNoop(new CSSLinearGradientValue(*this)); | 177 return adoptRefWillBeNoop(new CSSLinearGradientValue(*this)); |
| 178 } | 178 } |
| 179 | 179 |
| 180 bool equals(const CSSLinearGradientValue&) const; | 180 bool equals(const CSSLinearGradientValue&) const; |
| 181 | 181 |
| 182 void traceAfterDispatch(Visitor*); | 182 void traceAfterDispatch(Visitor*); |
| 183 | 183 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 void setFirstRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_first
Radius = val; } | 215 void setFirstRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_first
Radius = val; } |
| 216 void setSecondRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_seco
ndRadius = val; } | 216 void setSecondRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_seco
ndRadius = val; } |
| 217 | 217 |
| 218 void setShape(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_shape = val
; } | 218 void setShape(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_shape = val
; } |
| 219 void setSizingBehavior(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_si
zingBehavior = val; } | 219 void setSizingBehavior(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_si
zingBehavior = val; } |
| 220 | 220 |
| 221 void setEndHorizontalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m
_endHorizontalSize = val; } | 221 void setEndHorizontalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m
_endHorizontalSize = val; } |
| 222 void setEndVerticalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_e
ndVerticalSize = val; } | 222 void setEndVerticalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_e
ndVerticalSize = val; } |
| 223 | 223 |
| 224 // Create the gradient for a given size. | 224 // Create the gradient for a given size. |
| 225 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const RenderObject&); | 225 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const
IntSize&, const LayoutObject&); |
| 226 | 226 |
| 227 bool equals(const CSSRadialGradientValue&) const; | 227 bool equals(const CSSRadialGradientValue&) const; |
| 228 | 228 |
| 229 void traceAfterDispatch(Visitor*); | 229 void traceAfterDispatch(Visitor*); |
| 230 | 230 |
| 231 private: | 231 private: |
| 232 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) | 232 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp
e = CSSRadialGradient) |
| 233 : CSSGradientValue(RadialGradientClass, repeat, gradientType) | 233 : CSSGradientValue(RadialGradientClass, repeat, gradientType) |
| 234 { | 234 { |
| 235 } | 235 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 259 | 259 |
| 260 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize; | 260 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize; |
| 261 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize; | 261 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize; |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); | 264 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); |
| 265 | 265 |
| 266 } // namespace blink | 266 } // namespace blink |
| 267 | 267 |
| 268 #endif // CSSGradientValue_h | 268 #endif // CSSGradientValue_h |
| OLD | NEW |