Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 class Color; | 37 class Color; |
| 38 class FloatPoint; | 38 class FloatPoint; |
| 39 class Gradient; | 39 class Gradient; |
| 40 | 40 |
| 41 enum CSSGradientType { | 41 enum CSSGradientType { |
| 42 CSSDeprecatedLinearGradient, | 42 CSSDeprecatedLinearGradient, |
| 43 CSSDeprecatedRadialGradient, | 43 CSSDeprecatedRadialGradient, |
| 44 CSSPrefixedLinearGradient, | 44 CSSPrefixedLinearGradient, |
| 45 CSSPrefixedRadialGradient, | 45 CSSPrefixedRadialGradient, |
| 46 CSSLinearGradient, | 46 CSSLinearGradient, |
| 47 CSSRadialGradient | 47 CSSRadialGradient, |
| 48 CSSConicGradient | |
| 48 }; | 49 }; |
| 49 enum CSSGradientRepeat { NonRepeating, Repeating }; | 50 enum CSSGradientRepeat { NonRepeating, Repeating }; |
| 50 | 51 |
| 51 // This struct is stack allocated and allocated as part of vectors. | 52 // This struct is stack allocated and allocated as part of vectors. |
| 52 // When allocated on the stack its members are found by conservative | 53 // When allocated on the stack its members are found by conservative |
| 53 // stack scanning. When allocated as part of Vectors in heap-allocated | 54 // stack scanning. When allocated as part of Vectors in heap-allocated |
| 54 // objects its members are visited via the containing object's | 55 // objects its members are visited via the containing object's |
| 55 // (CSSGradientValue) traceAfterDispatch method. | 56 // (CSSGradientValue) traceAfterDispatch method. |
| 56 // | 57 // |
| 57 // http://www.w3.org/TR/css3-images/#color-stop-syntax | 58 // http://www.w3.org/TR/css3-images/#color-stop-syntax |
| 58 struct CSSGradientColorStop { | 59 struct CSSGradientColorStop { |
| 59 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 60 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 60 | 61 |
| 61 public: | 62 public: |
| 62 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) {} | 63 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) {} |
| 63 Member<CSSPrimitiveValue> m_position; // percentage or length | 64 Member<CSSPrimitiveValue> m_position; // percentage | length | angle |
|
fs
2017/03/28 15:59:20
(I sense that "m_offsetValue" or somesuch might be
f(malita)
2017/03/28 17:16:45
Ack, that would touch a bunch of code.
| |
| 64 Member<CSSValue> m_color; | 65 Member<CSSValue> m_color; |
| 65 bool m_colorIsDerivedFromElement; | 66 bool m_colorIsDerivedFromElement; |
| 66 bool operator==(const CSSGradientColorStop& other) const { | 67 bool operator==(const CSSGradientColorStop& other) const { |
| 67 return dataEquivalent(m_color, other.m_color) && | 68 return dataEquivalent(m_color, other.m_color) && |
| 68 dataEquivalent(m_position, other.m_position); | 69 dataEquivalent(m_position, other.m_position); |
| 69 } | 70 } |
| 70 bool isHint() const { | 71 bool isHint() const { |
| 71 ASSERT(m_color || m_position); | 72 ASSERT(m_color || m_position); |
| 72 return !m_color; | 73 return !m_color; |
| 73 } | 74 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 89 | 90 |
| 90 void setFirstX(CSSValue* val) { m_firstX = val; } | 91 void setFirstX(CSSValue* val) { m_firstX = val; } |
| 91 void setFirstY(CSSValue* val) { m_firstY = val; } | 92 void setFirstY(CSSValue* val) { m_firstY = val; } |
| 92 void setSecondX(CSSValue* val) { m_secondX = val; } | 93 void setSecondX(CSSValue* val) { m_secondX = val; } |
| 93 void setSecondY(CSSValue* val) { m_secondY = val; } | 94 void setSecondY(CSSValue* val) { m_secondY = val; } |
| 94 | 95 |
| 95 void addStop(const CSSGradientColorStop& stop) { m_stops.push_back(stop); } | 96 void addStop(const CSSGradientColorStop& stop) { m_stops.push_back(stop); } |
| 96 | 97 |
| 97 unsigned stopCount() const { return m_stops.size(); } | 98 unsigned stopCount() const { return m_stops.size(); } |
| 98 | 99 |
| 99 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; | |
| 100 | |
| 101 bool isRepeating() const { return m_repeating; } | 100 bool isRepeating() const { return m_repeating; } |
| 102 | 101 |
| 103 CSSGradientType gradientType() const { return m_gradientType; } | 102 CSSGradientType gradientType() const { return m_gradientType; } |
| 104 | 103 |
| 105 bool isFixedSize() const { return false; } | 104 bool isFixedSize() const { return false; } |
| 106 IntSize fixedSize(const LayoutObject&) const { return IntSize(); } | 105 IntSize fixedSize(const LayoutObject&) const { return IntSize(); } |
| 107 | 106 |
| 108 bool isPending() const { return false; } | 107 bool isPending() const { return false; } |
| 109 bool knownToBeOpaque(const LayoutObject&) const; | 108 bool knownToBeOpaque(const LayoutObject&) const; |
| 110 | 109 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 131 void addDeprecatedStops(GradientDesc&, const LayoutObject&); | 130 void addDeprecatedStops(GradientDesc&, const LayoutObject&); |
| 132 | 131 |
| 133 // Resolve points/radii to front end values. | 132 // Resolve points/radii to front end values. |
| 134 FloatPoint computeEndPoint(CSSValue*, | 133 FloatPoint computeEndPoint(CSSValue*, |
| 135 CSSValue*, | 134 CSSValue*, |
| 136 const CSSToLengthConversionData&, | 135 const CSSToLengthConversionData&, |
| 137 const IntSize&); | 136 const IntSize&); |
| 138 | 137 |
| 139 bool isCacheable() const; | 138 bool isCacheable() const; |
| 140 | 139 |
| 140 void appendCSSTextForColorStops(StringBuilder&, bool requiresSeparator) const; | |
| 141 void appendCSSTextForDeprecatedColorStops(StringBuilder&) const; | |
| 142 | |
| 141 // Points. Some of these may be null. | 143 // Points. Some of these may be null. |
| 142 Member<CSSValue> m_firstX; | 144 Member<CSSValue> m_firstX; |
| 143 Member<CSSValue> m_firstY; | 145 Member<CSSValue> m_firstY; |
| 144 | 146 |
| 145 Member<CSSValue> m_secondX; | 147 Member<CSSValue> m_secondX; |
| 146 Member<CSSValue> m_secondY; | 148 Member<CSSValue> m_secondY; |
| 147 | 149 |
| 148 // Stops | 150 // Stops |
| 149 HeapVector<CSSGradientColorStop, 2> m_stops; | 151 HeapVector<CSSGradientColorStop, 2> m_stops; |
| 150 bool m_stopsSorted; | 152 bool m_stopsSorted; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 // null. | 235 // null. |
| 234 Member<CSSIdentifierValue> m_shape; | 236 Member<CSSIdentifierValue> m_shape; |
| 235 Member<CSSIdentifierValue> m_sizingBehavior; | 237 Member<CSSIdentifierValue> m_sizingBehavior; |
| 236 | 238 |
| 237 Member<CSSPrimitiveValue> m_endHorizontalSize; | 239 Member<CSSPrimitiveValue> m_endHorizontalSize; |
| 238 Member<CSSPrimitiveValue> m_endVerticalSize; | 240 Member<CSSPrimitiveValue> m_endVerticalSize; |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); | 243 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); |
| 242 | 244 |
| 245 class CSSConicGradientValue final : public CSSGradientValue { | |
| 246 public: | |
| 247 static CSSConicGradientValue* create(CSSGradientRepeat repeat) { | |
| 248 return new CSSConicGradientValue(repeat); | |
| 249 } | |
| 250 | |
| 251 String customCSSText() const; | |
| 252 | |
| 253 // Create the gradient for a given size. | |
| 254 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, | |
| 255 const IntSize&, | |
| 256 const LayoutObject&); | |
| 257 | |
| 258 void setFromAngle(CSSPrimitiveValue* val) { m_fromAngle = val; } | |
| 259 | |
| 260 bool equals(const CSSConicGradientValue&) const; | |
| 261 | |
| 262 DECLARE_TRACE_AFTER_DISPATCH(); | |
| 263 | |
| 264 private: | |
| 265 CSSConicGradientValue(CSSGradientRepeat repeat) | |
| 266 : CSSGradientValue(ConicGradientClass, repeat, CSSConicGradient) {} | |
| 267 | |
| 268 Member<CSSPrimitiveValue> m_fromAngle; | |
| 269 }; | |
| 270 | |
| 271 DEFINE_CSS_VALUE_TYPE_CASTS(CSSConicGradientValue, isConicGradientValue()); | |
| 272 | |
| 243 } // namespace blink | 273 } // namespace blink |
| 244 | 274 |
| 245 #endif // CSSGradientValue_h | 275 #endif // CSSGradientValue_h |
| OLD | NEW |