Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: Source/core/css/CSSGradientValue.h

Issue 767343003: Make currentColor keyword in linear-gradient work (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Resolve gradient colors later Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // When allocated on the stack its members are found by conservative 51 // When allocated on the stack its members are found by conservative
52 // stack scanning. When allocated as part of Vectors in heap-allocated 52 // stack scanning. When allocated as part of Vectors in heap-allocated
53 // objects its members are visited via the containing object's 53 // objects its members are visited via the containing object's
54 // (CSSGradientValue) traceAfterDispatch method. 54 // (CSSGradientValue) traceAfterDispatch method.
55 struct CSSGradientColorStop { 55 struct CSSGradientColorStop {
56 ALLOW_ONLY_INLINE_ALLOCATION(); 56 ALLOW_ONLY_INLINE_ALLOCATION();
57 public: 57 public:
58 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { }; 58 CSSGradientColorStop() : m_colorIsDerivedFromElement(false) { };
59 RefPtrWillBeMember<CSSPrimitiveValue> m_position; // percentage or length 59 RefPtrWillBeMember<CSSPrimitiveValue> m_position; // percentage or length
60 RefPtrWillBeMember<CSSPrimitiveValue> m_color; 60 RefPtrWillBeMember<CSSPrimitiveValue> m_color;
61 Color m_resolvedColor; 61 Color m_resolvedColor;
Timothy Loh 2014/12/03 01:10:07 I guess we can remove this now?
62 bool m_colorIsDerivedFromElement; 62 bool m_colorIsDerivedFromElement;
63 bool operator==(const CSSGradientColorStop& other) const 63 bool operator==(const CSSGradientColorStop& other) const
64 { 64 {
65 return compareCSSValuePtr(m_color, other.m_color) 65 return compareCSSValuePtr(m_color, other.m_color)
66 && compareCSSValuePtr(m_position, other.m_position); 66 && compareCSSValuePtr(m_position, other.m_position);
67 } 67 }
68 bool isHint() const 68 bool isHint() const
69 { 69 {
70 ASSERT(m_color || m_position); 70 ASSERT(m_color || m_position);
71 return !m_color; 71 return !m_color;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 , m_firstY(other.m_firstY) 128 , m_firstY(other.m_firstY)
129 , m_secondX(other.m_secondX) 129 , m_secondX(other.m_secondX)
130 , m_secondY(other.m_secondY) 130 , m_secondY(other.m_secondY)
131 , m_stops(other.m_stops) 131 , m_stops(other.m_stops)
132 , m_stopsSorted(other.m_stopsSorted) 132 , m_stopsSorted(other.m_stopsSorted)
133 , m_gradientType(gradientType) 133 , m_gradientType(gradientType)
134 , m_repeating(other.isRepeating() ? Repeating : NonRepeating) 134 , m_repeating(other.isRepeating() ? Repeating : NonRepeating)
135 { 135 {
136 } 136 }
137 137
138 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthFo rRepeat = 0); 138 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthFo rRepeat, const RenderObject&);
139 139
140 // Resolve points/radii to front end values. 140 // Resolve points/radii to front end values.
141 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSS ToLengthConversionData&, const IntSize&); 141 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSS ToLengthConversionData&, const IntSize&);
142 142
143 bool isCacheable() const; 143 bool isCacheable() const;
144 144
145 // Points. Some of these may be null. 145 // Points. Some of these may be null.
146 RefPtrWillBeMember<CSSPrimitiveValue> m_firstX; 146 RefPtrWillBeMember<CSSPrimitiveValue> m_firstX;
147 RefPtrWillBeMember<CSSPrimitiveValue> m_firstY; 147 RefPtrWillBeMember<CSSPrimitiveValue> m_firstY;
148 148
(...skipping 15 matching lines...) Expand all
164 static PassRefPtrWillBeRawPtr<CSSLinearGradientValue> create(CSSGradientRepe at repeat, CSSGradientType gradientType = CSSLinearGradient) 164 static PassRefPtrWillBeRawPtr<CSSLinearGradientValue> create(CSSGradientRepe at repeat, CSSGradientType gradientType = CSSLinearGradient)
165 { 165 {
166 return adoptRefWillBeNoop(new CSSLinearGradientValue(repeat, gradientTyp e)); 166 return adoptRefWillBeNoop(new CSSLinearGradientValue(repeat, gradientTyp e));
167 } 167 }
168 168
169 void setAngle(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_angle = val ; } 169 void setAngle(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_angle = val ; }
170 170
171 String customCSSText() const; 171 String customCSSText() const;
172 172
173 // Create the gradient for a given size. 173 // Create the gradient for a given size.
174 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&); 174 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&, const RenderObject&);
175 175
176 PassRefPtrWillBeRawPtr<CSSLinearGradientValue> clone() const 176 PassRefPtrWillBeRawPtr<CSSLinearGradientValue> clone() const
177 { 177 {
178 return adoptRefWillBeNoop(new CSSLinearGradientValue(*this)); 178 return adoptRefWillBeNoop(new CSSLinearGradientValue(*this));
179 } 179 }
180 180
181 bool equals(const CSSLinearGradientValue&) const; 181 bool equals(const CSSLinearGradientValue&) const;
182 182
183 void traceAfterDispatch(Visitor*); 183 void traceAfterDispatch(Visitor*);
184 184
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void setFirstRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_first Radius = val; } 216 void setFirstRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_first Radius = val; }
217 void setSecondRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_seco ndRadius = val; } 217 void setSecondRadius(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_seco ndRadius = val; }
218 218
219 void setShape(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_shape = val ; } 219 void setShape(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_shape = val ; }
220 void setSizingBehavior(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_si zingBehavior = val; } 220 void setSizingBehavior(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_si zingBehavior = val; }
221 221
222 void setEndHorizontalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m _endHorizontalSize = val; } 222 void setEndHorizontalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m _endHorizontalSize = val; }
223 void setEndVerticalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_e ndVerticalSize = val; } 223 void setEndVerticalSize(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_e ndVerticalSize = val; }
224 224
225 // Create the gradient for a given size. 225 // Create the gradient for a given size.
226 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&); 226 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&, const RenderObject&);
227 227
228 bool equals(const CSSRadialGradientValue&) const; 228 bool equals(const CSSRadialGradientValue&) const;
229 229
230 void traceAfterDispatch(Visitor*); 230 void traceAfterDispatch(Visitor*);
231 231
232 private: 232 private:
233 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSRadialGradient) 233 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSRadialGradient)
234 : CSSGradientValue(RadialGradientClass, repeat, gradientType) 234 : CSSGradientValue(RadialGradientClass, repeat, gradientType)
235 { 235 {
236 } 236 }
(...skipping 23 matching lines...) Expand all
260 260
261 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize; 261 RefPtrWillBeMember<CSSPrimitiveValue> m_endHorizontalSize;
262 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize; 262 RefPtrWillBeMember<CSSPrimitiveValue> m_endVerticalSize;
263 }; 263 };
264 264
265 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); 265 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue());
266 266
267 } // namespace blink 267 } // namespace blink
268 268
269 #endif // CSSGradientValue_h 269 #endif // CSSGradientValue_h
OLDNEW
« no previous file with comments | « LayoutTests/fast/css/linear-gradient-currentcolor2-expected.html ('k') | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698