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

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

Issue 64293008: Wrap CSS length conversion arguments in an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: don't make it noncopyable ; clang doesn't do the RVO stuffs? Created 7 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
« no previous file with comments | « Source/core/css/CSSCalculationValueTest.cpp ('k') | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 , m_firstY(other.m_firstY) 103 , m_firstY(other.m_firstY)
104 , m_secondX(other.m_secondX) 104 , m_secondX(other.m_secondX)
105 , m_secondY(other.m_secondY) 105 , m_secondY(other.m_secondY)
106 , m_stops(other.m_stops) 106 , m_stops(other.m_stops)
107 , m_stopsSorted(other.m_stopsSorted) 107 , m_stopsSorted(other.m_stopsSorted)
108 , m_gradientType(gradientType) 108 , m_gradientType(gradientType)
109 , m_repeating(other.isRepeating() ? Repeating : NonRepeating) 109 , m_repeating(other.isRepeating() ? Repeating : NonRepeating)
110 { 110 {
111 } 111 }
112 112
113 void addStops(Gradient*, RenderObject*, RenderStyle* rootStyle, float maxLen gthForRepeat = 0); 113 void addStops(Gradient*, const CSSToLengthConversionData&, float maxLengthFo rRepeat = 0);
114 114
115 // Resolve points/radii to front end values. 115 // Resolve points/radii to front end values.
116 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, RenderSty le*, RenderStyle* rootStyle, const IntSize&); 116 FloatPoint computeEndPoint(CSSPrimitiveValue*, CSSPrimitiveValue*, const CSS ToLengthConversionData&, const IntSize&);
117 117
118 bool isCacheable() const; 118 bool isCacheable() const;
119 119
120 // Points. Some of these may be null. 120 // Points. Some of these may be null.
121 RefPtr<CSSPrimitiveValue> m_firstX; 121 RefPtr<CSSPrimitiveValue> m_firstX;
122 RefPtr<CSSPrimitiveValue> m_firstY; 122 RefPtr<CSSPrimitiveValue> m_firstY;
123 123
124 RefPtr<CSSPrimitiveValue> m_secondX; 124 RefPtr<CSSPrimitiveValue> m_secondX;
125 RefPtr<CSSPrimitiveValue> m_secondY; 125 RefPtr<CSSPrimitiveValue> m_secondY;
126 126
(...skipping 12 matching lines...) Expand all
139 static PassRefPtr<CSSLinearGradientValue> create(CSSGradientRepeat repeat, C SSGradientType gradientType = CSSLinearGradient) 139 static PassRefPtr<CSSLinearGradientValue> create(CSSGradientRepeat repeat, C SSGradientType gradientType = CSSLinearGradient)
140 { 140 {
141 return adoptRef(new CSSLinearGradientValue(repeat, gradientType)); 141 return adoptRef(new CSSLinearGradientValue(repeat, gradientType));
142 } 142 }
143 143
144 void setAngle(PassRefPtr<CSSPrimitiveValue> val) { m_angle = val; } 144 void setAngle(PassRefPtr<CSSPrimitiveValue> val) { m_angle = val; }
145 145
146 String customCSSText() const; 146 String customCSSText() const;
147 147
148 // Create the gradient for a given size. 148 // Create the gradient for a given size.
149 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); 149 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&);
150 150
151 PassRefPtr<CSSLinearGradientValue> clone() const 151 PassRefPtr<CSSLinearGradientValue> clone() const
152 { 152 {
153 return adoptRef(new CSSLinearGradientValue(*this)); 153 return adoptRef(new CSSLinearGradientValue(*this));
154 } 154 }
155 155
156 bool equals(const CSSLinearGradientValue&) const; 156 bool equals(const CSSLinearGradientValue&) const;
157 157
158 private: 158 private:
159 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSLinearGradient) 159 CSSLinearGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSLinearGradient)
(...skipping 29 matching lines...) Expand all
189 void setFirstRadius(PassRefPtr<CSSPrimitiveValue> val) { m_firstRadius = val ; } 189 void setFirstRadius(PassRefPtr<CSSPrimitiveValue> val) { m_firstRadius = val ; }
190 void setSecondRadius(PassRefPtr<CSSPrimitiveValue> val) { m_secondRadius = v al; } 190 void setSecondRadius(PassRefPtr<CSSPrimitiveValue> val) { m_secondRadius = v al; }
191 191
192 void setShape(PassRefPtr<CSSPrimitiveValue> val) { m_shape = val; } 192 void setShape(PassRefPtr<CSSPrimitiveValue> val) { m_shape = val; }
193 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior = val; } 193 void setSizingBehavior(PassRefPtr<CSSPrimitiveValue> val) { m_sizingBehavior = val; }
194 194
195 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont alSize = val; } 195 void setEndHorizontalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endHorizont alSize = val; }
196 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi ze = val; } 196 void setEndVerticalSize(PassRefPtr<CSSPrimitiveValue> val) { m_endVerticalSi ze = val; }
197 197
198 // Create the gradient for a given size. 198 // Create the gradient for a given size.
199 PassRefPtr<Gradient> createGradient(RenderObject*, const IntSize&); 199 PassRefPtr<Gradient> createGradient(const CSSToLengthConversionData&, const IntSize&);
200 200
201 bool equals(const CSSRadialGradientValue&) const; 201 bool equals(const CSSRadialGradientValue&) const;
202 202
203 private: 203 private:
204 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSRadialGradient) 204 CSSRadialGradientValue(CSSGradientRepeat repeat, CSSGradientType gradientTyp e = CSSRadialGradient)
205 : CSSGradientValue(RadialGradientClass, repeat, gradientType) 205 : CSSGradientValue(RadialGradientClass, repeat, gradientType)
206 { 206 {
207 } 207 }
208 208
209 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) 209 explicit CSSRadialGradientValue(const CSSRadialGradientValue& other)
210 : CSSGradientValue(other, RadialGradientClass, other.gradientType()) 210 : CSSGradientValue(other, RadialGradientClass, other.gradientType())
211 , m_firstRadius(other.m_firstRadius) 211 , m_firstRadius(other.m_firstRadius)
212 , m_secondRadius(other.m_secondRadius) 212 , m_secondRadius(other.m_secondRadius)
213 , m_shape(other.m_shape) 213 , m_shape(other.m_shape)
214 , m_sizingBehavior(other.m_sizingBehavior) 214 , m_sizingBehavior(other.m_sizingBehavior)
215 , m_endHorizontalSize(other.m_endHorizontalSize) 215 , m_endHorizontalSize(other.m_endHorizontalSize)
216 , m_endVerticalSize(other.m_endVerticalSize) 216 , m_endVerticalSize(other.m_endVerticalSize)
217 { 217 {
218 } 218 }
219 219
220 220
221 // Resolve points/radii to front end values. 221 // Resolve points/radii to front end values.
222 float resolveRadius(CSSPrimitiveValue*, RenderStyle*, RenderStyle* rootStyle , float* widthOrHeight = 0); 222 float resolveRadius(CSSPrimitiveValue*, const CSSToLengthConversionData&, fl oat* widthOrHeight = 0);
223 223
224 // These may be null for non-deprecated gradients. 224 // These may be null for non-deprecated gradients.
225 RefPtr<CSSPrimitiveValue> m_firstRadius; 225 RefPtr<CSSPrimitiveValue> m_firstRadius;
226 RefPtr<CSSPrimitiveValue> m_secondRadius; 226 RefPtr<CSSPrimitiveValue> m_secondRadius;
227 227
228 // The below are only used for non-deprecated gradients. Any of them may be null. 228 // The below are only used for non-deprecated gradients. Any of them may be null.
229 RefPtr<CSSPrimitiveValue> m_shape; 229 RefPtr<CSSPrimitiveValue> m_shape;
230 RefPtr<CSSPrimitiveValue> m_sizingBehavior; 230 RefPtr<CSSPrimitiveValue> m_sizingBehavior;
231 231
232 RefPtr<CSSPrimitiveValue> m_endHorizontalSize; 232 RefPtr<CSSPrimitiveValue> m_endHorizontalSize;
233 RefPtr<CSSPrimitiveValue> m_endVerticalSize; 233 RefPtr<CSSPrimitiveValue> m_endVerticalSize;
234 }; 234 };
235 235
236 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue()); 236 DEFINE_CSS_VALUE_TYPE_CASTS(CSSRadialGradientValue, isRadialGradientValue());
237 237
238 } // namespace WebCore 238 } // namespace WebCore
239 239
240 #endif // CSSGradientValue_h 240 #endif // CSSGradientValue_h
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValueTest.cpp ('k') | Source/core/css/CSSGradientValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698