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

Side by Side Diff: third_party/WebKit/Source/core/animation/BasicShapeInterpolationFunctions.cpp

Issue 1977763002: Remove OwnPtr::release() calls in core/ (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/BasicShapeInterpolationFunctions.h" 5 #include "core/animation/BasicShapeInterpolationFunctions.h"
6 6
7 #include "core/animation/CSSLengthInterpolationType.h" 7 #include "core/animation/CSSLengthInterpolationType.h"
8 #include "core/animation/CSSPositionAxisListInterpolationType.h" 8 #include "core/animation/CSSPositionAxisListInterpolationType.h"
9 #include "core/css/CSSBasicShapeValues.h" 9 #include "core/css/CSSBasicShapeValues.h"
10 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 }; 68 };
69 69
70 DEFINE_NON_INTERPOLABLE_VALUE_TYPE(BasicShapeNonInterpolableValue); 70 DEFINE_NON_INTERPOLABLE_VALUE_TYPE(BasicShapeNonInterpolableValue);
71 DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(BasicShapeNonInterpolableValue); 71 DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(BasicShapeNonInterpolableValue);
72 72
73 namespace { 73 namespace {
74 74
75 PassOwnPtr<InterpolableValue> unwrap(InterpolationValue&& value) 75 PassOwnPtr<InterpolableValue> unwrap(InterpolationValue&& value)
76 { 76 {
77 ASSERT(value.interpolableValue); 77 ASSERT(value.interpolableValue);
78 return value.interpolableValue.release(); 78 return std::move(value.interpolableValue);
79 } 79 }
80 80
81 PassOwnPtr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate) 81 PassOwnPtr<InterpolableValue> convertCSSCoordinate(const CSSValue* coordinate)
82 { 82 {
83 if (coordinate) 83 if (coordinate)
84 return unwrap(CSSPositionAxisListInterpolationType::convertPositionAxisC SSValue(*coordinate)); 84 return unwrap(CSSPositionAxisListInterpolationType::convertPositionAxisC SSValue(*coordinate));
85 return unwrap(CSSLengthInterpolationType::maybeConvertLength(Length(50, Perc ent), 1)); 85 return unwrap(CSSLengthInterpolationType::maybeConvertLength(Length(50, Perc ent), 1));
86 } 86 }
87 87
88 PassOwnPtr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate & coordinate, double zoom) 88 PassOwnPtr<InterpolableValue> convertCoordinate(const BasicShapeCenterCoordinate & coordinate, double zoom)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle) 167 InterpolationValue convertCSSValue(const CSSBasicShapeCircleValue& circle)
168 { 168 {
169 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount); 169 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount);
170 list->set(CircleCenterXIndex, convertCSSCoordinate(circle.centerX())); 170 list->set(CircleCenterXIndex, convertCSSCoordinate(circle.centerX()));
171 list->set(CircleCenterYIndex, convertCSSCoordinate(circle.centerY())); 171 list->set(CircleCenterYIndex, convertCSSCoordinate(circle.centerY()));
172 172
173 OwnPtr<InterpolableValue> radius; 173 OwnPtr<InterpolableValue> radius;
174 if (!(radius = convertCSSRadius(circle.radius()))) 174 if (!(radius = convertCSSRadius(circle.radius())))
175 return nullptr; 175 return nullptr;
176 list->set(CircleRadiusIndex, radius.release()); 176 list->set(CircleRadiusIndex, std::move(radius));
177 177
178 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeCircleType)); 178 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeCircleType));
179 } 179 }
180 180
181 InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom ) 181 InterpolationValue convertBasicShape(const BasicShapeCircle& circle, double zoom )
182 { 182 {
183 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount); 183 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount);
184 list->set(CircleCenterXIndex, convertCoordinate(circle.centerX(), zoom)); 184 list->set(CircleCenterXIndex, convertCoordinate(circle.centerX(), zoom));
185 list->set(CircleCenterYIndex, convertCoordinate(circle.centerY(), zoom)); 185 list->set(CircleCenterYIndex, convertCoordinate(circle.centerY(), zoom));
186 186
187 OwnPtr<InterpolableValue> radius; 187 OwnPtr<InterpolableValue> radius;
188 if (!(radius = convertRadius(circle.radius(), zoom))) 188 if (!(radius = convertRadius(circle.radius(), zoom)))
189 return nullptr; 189 return nullptr;
190 list->set(CircleRadiusIndex, radius.release()); 190 list->set(CircleRadiusIndex, std::move(radius));
191 191
192 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeCircleType)); 192 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeCircleType));
193 } 193 }
194 194
195 PassOwnPtr<InterpolableValue> createNeutralValue() 195 PassOwnPtr<InterpolableValue> createNeutralValue()
196 { 196 {
197 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount); 197 OwnPtr<InterpolableList> list = InterpolableList::create(CircleComponentInde xCount);
198 list->set(CircleCenterXIndex, createNeutralInterpolableCoordinate()); 198 list->set(CircleCenterXIndex, createNeutralInterpolableCoordinate());
199 list->set(CircleCenterYIndex, createNeutralInterpolableCoordinate()); 199 list->set(CircleCenterYIndex, createNeutralInterpolableCoordinate());
200 list->set(CircleRadiusIndex, createNeutralInterpolableRadius()); 200 list->set(CircleRadiusIndex, createNeutralInterpolableRadius());
201 return list.release(); 201 return static_pointer_cast<InterpolableValue>(std::move(list));
tzik 2016/05/16 02:32:37 Can we just "return std::move(list);" here? It mig
202 } 202 }
203 203
204 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData) 204 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData)
205 { 205 {
206 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create(); 206 RefPtr<BasicShapeCircle> circle = BasicShapeCircle::create();
207 const InterpolableList& list = toInterpolableList(interpolableValue); 207 const InterpolableList& list = toInterpolableList(interpolableValue);
208 circle->setCenterX(createCoordinate(*list.get(CircleCenterXIndex), conversio nData)); 208 circle->setCenterX(createCoordinate(*list.get(CircleCenterXIndex), conversio nData));
209 circle->setCenterY(createCoordinate(*list.get(CircleCenterYIndex), conversio nData)); 209 circle->setCenterY(createCoordinate(*list.get(CircleCenterYIndex), conversio nData));
210 circle->setRadius(createRadius(*list.get(CircleRadiusIndex), conversionData) ); 210 circle->setRadius(createRadius(*list.get(CircleRadiusIndex), conversionData) );
211 return circle.release(); 211 return circle.release();
(...skipping 13 matching lines...) Expand all
225 225
226 InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse) 226 InterpolationValue convertCSSValue(const CSSBasicShapeEllipseValue& ellipse)
227 { 227 {
228 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount); 228 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount);
229 list->set(EllipseCenterXIndex, convertCSSCoordinate(ellipse.centerX())); 229 list->set(EllipseCenterXIndex, convertCSSCoordinate(ellipse.centerX()));
230 list->set(EllipseCenterYIndex, convertCSSCoordinate(ellipse.centerY())); 230 list->set(EllipseCenterYIndex, convertCSSCoordinate(ellipse.centerY()));
231 231
232 OwnPtr<InterpolableValue> radius; 232 OwnPtr<InterpolableValue> radius;
233 if (!(radius = convertCSSRadius(ellipse.radiusX()))) 233 if (!(radius = convertCSSRadius(ellipse.radiusX())))
234 return nullptr; 234 return nullptr;
235 list->set(EllipseRadiusXIndex, radius.release()); 235 list->set(EllipseRadiusXIndex, std::move(radius));
236 if (!(radius = convertCSSRadius(ellipse.radiusY()))) 236 if (!(radius = convertCSSRadius(ellipse.radiusY())))
237 return nullptr; 237 return nullptr;
238 list->set(EllipseRadiusYIndex, radius.release()); 238 list->set(EllipseRadiusYIndex, std::move(radius));
239 239
240 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeEllipseType)); 240 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeEllipseType));
241 } 241 }
242 242
243 InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zo om) 243 InterpolationValue convertBasicShape(const BasicShapeEllipse& ellipse, double zo om)
244 { 244 {
245 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount); 245 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount);
246 list->set(EllipseCenterXIndex, convertCoordinate(ellipse.centerX(), zoom)); 246 list->set(EllipseCenterXIndex, convertCoordinate(ellipse.centerX(), zoom));
247 list->set(EllipseCenterYIndex, convertCoordinate(ellipse.centerY(), zoom)); 247 list->set(EllipseCenterYIndex, convertCoordinate(ellipse.centerY(), zoom));
248 248
249 OwnPtr<InterpolableValue> radius; 249 OwnPtr<InterpolableValue> radius;
250 if (!(radius = convertRadius(ellipse.radiusX(), zoom))) 250 if (!(radius = convertRadius(ellipse.radiusX(), zoom)))
251 return nullptr; 251 return nullptr;
252 list->set(EllipseRadiusXIndex, radius.release()); 252 list->set(EllipseRadiusXIndex, std::move(radius));
253 if (!(radius = convertRadius(ellipse.radiusY(), zoom))) 253 if (!(radius = convertRadius(ellipse.radiusY(), zoom)))
254 return nullptr; 254 return nullptr;
255 list->set(EllipseRadiusYIndex, radius.release()); 255 list->set(EllipseRadiusYIndex, std::move(radius));
256 256
257 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeEllipseType)); 257 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeEllipseType));
258 } 258 }
259 259
260 PassOwnPtr<InterpolableValue> createNeutralValue() 260 PassOwnPtr<InterpolableValue> createNeutralValue()
261 { 261 {
262 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount); 262 OwnPtr<InterpolableList> list = InterpolableList::create(EllipseComponentInd exCount);
263 list->set(EllipseCenterXIndex, createNeutralInterpolableCoordinate()); 263 list->set(EllipseCenterXIndex, createNeutralInterpolableCoordinate());
264 list->set(EllipseCenterYIndex, createNeutralInterpolableCoordinate()); 264 list->set(EllipseCenterYIndex, createNeutralInterpolableCoordinate());
265 list->set(EllipseRadiusXIndex, createNeutralInterpolableRadius()); 265 list->set(EllipseRadiusXIndex, createNeutralInterpolableRadius());
266 list->set(EllipseRadiusYIndex, createNeutralInterpolableRadius()); 266 list->set(EllipseRadiusYIndex, createNeutralInterpolableRadius());
267 return list.release(); 267 return static_pointer_cast<InterpolableValue>(std::move(list));
268 } 268 }
269 269
270 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData) 270 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData)
271 { 271 {
272 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create(); 272 RefPtr<BasicShapeEllipse> ellipse = BasicShapeEllipse::create();
273 const InterpolableList& list = toInterpolableList(interpolableValue); 273 const InterpolableList& list = toInterpolableList(interpolableValue);
274 ellipse->setCenterX(createCoordinate(*list.get(EllipseCenterXIndex), convers ionData)); 274 ellipse->setCenterX(createCoordinate(*list.get(EllipseCenterXIndex), convers ionData));
275 ellipse->setCenterY(createCoordinate(*list.get(EllipseCenterYIndex), convers ionData)); 275 ellipse->setCenterY(createCoordinate(*list.get(EllipseCenterYIndex), convers ionData));
276 ellipse->setRadiusX(createRadius(*list.get(EllipseRadiusXIndex), conversionD ata)); 276 ellipse->setRadiusX(createRadius(*list.get(EllipseRadiusXIndex), conversionD ata));
277 ellipse->setRadiusY(createRadius(*list.get(EllipseRadiusYIndex), conversionD ata)); 277 ellipse->setRadiusY(createRadius(*list.get(EllipseRadiusYIndex), conversionD ata));
(...skipping 29 matching lines...) Expand all
307 list->set(InsetLeftIndex, convertCSSLength(inset.left())); 307 list->set(InsetLeftIndex, convertCSSLength(inset.left()));
308 308
309 list->set(InsetBorderTopLeftWidthIndex, convertCSSBorderRadiusWidth(inset.to pLeftRadius())); 309 list->set(InsetBorderTopLeftWidthIndex, convertCSSBorderRadiusWidth(inset.to pLeftRadius()));
310 list->set(InsetBorderTopLeftHeightIndex, convertCSSBorderRadiusHeight(inset. topLeftRadius())); 310 list->set(InsetBorderTopLeftHeightIndex, convertCSSBorderRadiusHeight(inset. topLeftRadius()));
311 list->set(InsetBorderTopRightWidthIndex, convertCSSBorderRadiusWidth(inset.t opRightRadius())); 311 list->set(InsetBorderTopRightWidthIndex, convertCSSBorderRadiusWidth(inset.t opRightRadius()));
312 list->set(InsetBorderTopRightHeightIndex, convertCSSBorderRadiusHeight(inset .topRightRadius())); 312 list->set(InsetBorderTopRightHeightIndex, convertCSSBorderRadiusHeight(inset .topRightRadius()));
313 list->set(InsetBorderBottomRightWidthIndex, convertCSSBorderRadiusWidth(inse t.bottomRightRadius())); 313 list->set(InsetBorderBottomRightWidthIndex, convertCSSBorderRadiusWidth(inse t.bottomRightRadius()));
314 list->set(InsetBorderBottomRightHeightIndex, convertCSSBorderRadiusHeight(in set.bottomRightRadius())); 314 list->set(InsetBorderBottomRightHeightIndex, convertCSSBorderRadiusHeight(in set.bottomRightRadius()));
315 list->set(InsetBorderBottomLeftWidthIndex, convertCSSBorderRadiusWidth(inset .bottomLeftRadius())); 315 list->set(InsetBorderBottomLeftWidthIndex, convertCSSBorderRadiusWidth(inset .bottomLeftRadius()));
316 list->set(InsetBorderBottomLeftHeightIndex, convertCSSBorderRadiusHeight(ins et.bottomLeftRadius())); 316 list->set(InsetBorderBottomLeftHeightIndex, convertCSSBorderRadiusHeight(ins et.bottomLeftRadius()));
317 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeInsetType)); 317 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeInsetType));
318 } 318 }
319 319
320 InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom) 320 InterpolationValue convertBasicShape(const BasicShapeInset& inset, double zoom)
321 { 321 {
322 OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndex Count); 322 OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndex Count);
323 list->set(InsetTopIndex, convertLength(inset.top(), zoom)); 323 list->set(InsetTopIndex, convertLength(inset.top(), zoom));
324 list->set(InsetRightIndex, convertLength(inset.right(), zoom)); 324 list->set(InsetRightIndex, convertLength(inset.right(), zoom));
325 list->set(InsetBottomIndex, convertLength(inset.bottom(), zoom)); 325 list->set(InsetBottomIndex, convertLength(inset.bottom(), zoom));
326 list->set(InsetLeftIndex, convertLength(inset.left(), zoom)); 326 list->set(InsetLeftIndex, convertLength(inset.left(), zoom));
327 327
328 list->set(InsetBorderTopLeftWidthIndex, convertLength(inset.topLeftRadius(). width(), zoom)); 328 list->set(InsetBorderTopLeftWidthIndex, convertLength(inset.topLeftRadius(). width(), zoom));
329 list->set(InsetBorderTopLeftHeightIndex, convertLength(inset.topLeftRadius() .height(), zoom)); 329 list->set(InsetBorderTopLeftHeightIndex, convertLength(inset.topLeftRadius() .height(), zoom));
330 list->set(InsetBorderTopRightWidthIndex, convertLength(inset.topRightRadius( ).width(), zoom)); 330 list->set(InsetBorderTopRightWidthIndex, convertLength(inset.topRightRadius( ).width(), zoom));
331 list->set(InsetBorderTopRightHeightIndex, convertLength(inset.topRightRadius ().height(), zoom)); 331 list->set(InsetBorderTopRightHeightIndex, convertLength(inset.topRightRadius ().height(), zoom));
332 list->set(InsetBorderBottomRightWidthIndex, convertLength(inset.bottomRightR adius().width(), zoom)); 332 list->set(InsetBorderBottomRightWidthIndex, convertLength(inset.bottomRightR adius().width(), zoom));
333 list->set(InsetBorderBottomRightHeightIndex, convertLength(inset.bottomRight Radius().height(), zoom)); 333 list->set(InsetBorderBottomRightHeightIndex, convertLength(inset.bottomRight Radius().height(), zoom));
334 list->set(InsetBorderBottomLeftWidthIndex, convertLength(inset.bottomLeftRad ius().width(), zoom)); 334 list->set(InsetBorderBottomLeftWidthIndex, convertLength(inset.bottomLeftRad ius().width(), zoom));
335 list->set(InsetBorderBottomLeftHeightIndex, convertLength(inset.bottomLeftRa dius().height(), zoom)); 335 list->set(InsetBorderBottomLeftHeightIndex, convertLength(inset.bottomLeftRa dius().height(), zoom));
336 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eate(BasicShape::BasicShapeInsetType)); 336 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reate(BasicShape::BasicShapeInsetType));
337 } 337 }
338 338
339 PassOwnPtr<InterpolableValue> createNeutralValue() 339 PassOwnPtr<InterpolableValue> createNeutralValue()
340 { 340 {
341 OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndex Count); 341 OwnPtr<InterpolableList> list = InterpolableList::create(InsetComponentIndex Count);
342 list->set(InsetTopIndex, CSSLengthInterpolationType::createNeutralInterpolab leValue()); 342 list->set(InsetTopIndex, CSSLengthInterpolationType::createNeutralInterpolab leValue());
343 list->set(InsetRightIndex, CSSLengthInterpolationType::createNeutralInterpol ableValue()); 343 list->set(InsetRightIndex, CSSLengthInterpolationType::createNeutralInterpol ableValue());
344 list->set(InsetBottomIndex, CSSLengthInterpolationType::createNeutralInterpo lableValue()); 344 list->set(InsetBottomIndex, CSSLengthInterpolationType::createNeutralInterpo lableValue());
345 list->set(InsetLeftIndex, CSSLengthInterpolationType::createNeutralInterpola bleValue()); 345 list->set(InsetLeftIndex, CSSLengthInterpolationType::createNeutralInterpola bleValue());
346 346
347 list->set(InsetBorderTopLeftWidthIndex, CSSLengthInterpolationType::createNe utralInterpolableValue()); 347 list->set(InsetBorderTopLeftWidthIndex, CSSLengthInterpolationType::createNe utralInterpolableValue());
348 list->set(InsetBorderTopLeftHeightIndex, CSSLengthInterpolationType::createN eutralInterpolableValue()); 348 list->set(InsetBorderTopLeftHeightIndex, CSSLengthInterpolationType::createN eutralInterpolableValue());
349 list->set(InsetBorderTopRightWidthIndex, CSSLengthInterpolationType::createN eutralInterpolableValue()); 349 list->set(InsetBorderTopRightWidthIndex, CSSLengthInterpolationType::createN eutralInterpolableValue());
350 list->set(InsetBorderTopRightHeightIndex, CSSLengthInterpolationType::create NeutralInterpolableValue()); 350 list->set(InsetBorderTopRightHeightIndex, CSSLengthInterpolationType::create NeutralInterpolableValue());
351 list->set(InsetBorderBottomRightWidthIndex, CSSLengthInterpolationType::crea teNeutralInterpolableValue()); 351 list->set(InsetBorderBottomRightWidthIndex, CSSLengthInterpolationType::crea teNeutralInterpolableValue());
352 list->set(InsetBorderBottomRightHeightIndex, CSSLengthInterpolationType::cre ateNeutralInterpolableValue()); 352 list->set(InsetBorderBottomRightHeightIndex, CSSLengthInterpolationType::cre ateNeutralInterpolableValue());
353 list->set(InsetBorderBottomLeftWidthIndex, CSSLengthInterpolationType::creat eNeutralInterpolableValue()); 353 list->set(InsetBorderBottomLeftWidthIndex, CSSLengthInterpolationType::creat eNeutralInterpolableValue());
354 list->set(InsetBorderBottomLeftHeightIndex, CSSLengthInterpolationType::crea teNeutralInterpolableValue()); 354 list->set(InsetBorderBottomLeftHeightIndex, CSSLengthInterpolationType::crea teNeutralInterpolableValue());
355 return list.release(); 355 return static_pointer_cast<InterpolableValue>(std::move(list));
356 } 356 }
357 357
358 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData) 358 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const CSSToLengthConversionData& conversionData)
359 { 359 {
360 RefPtr<BasicShapeInset> inset = BasicShapeInset::create(); 360 RefPtr<BasicShapeInset> inset = BasicShapeInset::create();
361 const InterpolableList& list = toInterpolableList(interpolableValue); 361 const InterpolableList& list = toInterpolableList(interpolableValue);
362 inset->setTop(CSSLengthInterpolationType::resolveInterpolableLength(*list.ge t(InsetTopIndex), nullptr, conversionData)); 362 inset->setTop(CSSLengthInterpolationType::resolveInterpolableLength(*list.ge t(InsetTopIndex), nullptr, conversionData));
363 inset->setRight(CSSLengthInterpolationType::resolveInterpolableLength(*list. get(InsetRightIndex), nullptr, conversionData)); 363 inset->setRight(CSSLengthInterpolationType::resolveInterpolableLength(*list. get(InsetRightIndex), nullptr, conversionData));
364 inset->setBottom(CSSLengthInterpolationType::resolveInterpolableLength(*list .get(InsetBottomIndex), nullptr, conversionData)); 364 inset->setBottom(CSSLengthInterpolationType::resolveInterpolableLength(*list .get(InsetBottomIndex), nullptr, conversionData));
365 inset->setLeft(CSSLengthInterpolationType::resolveInterpolableLength(*list.g et(InsetLeftIndex), nullptr, conversionData)); 365 inset->setLeft(CSSLengthInterpolationType::resolveInterpolableLength(*list.g et(InsetLeftIndex), nullptr, conversionData));
366 366
367 inset->setTopLeftRadius(createBorderRadius(*list.get(InsetBorderTopLeftWidth Index), *list.get(InsetBorderTopLeftHeightIndex), conversionData)); 367 inset->setTopLeftRadius(createBorderRadius(*list.get(InsetBorderTopLeftWidth Index), *list.get(InsetBorderTopLeftHeightIndex), conversionData));
368 inset->setTopRightRadius(createBorderRadius(*list.get(InsetBorderTopRightWid thIndex), *list.get(InsetBorderTopRightHeightIndex), conversionData)); 368 inset->setTopRightRadius(createBorderRadius(*list.get(InsetBorderTopRightWid thIndex), *list.get(InsetBorderTopRightHeightIndex), conversionData));
369 inset->setBottomRightRadius(createBorderRadius(*list.get(InsetBorderBottomRi ghtWidthIndex), *list.get(InsetBorderBottomRightHeightIndex), conversionData)); 369 inset->setBottomRightRadius(createBorderRadius(*list.get(InsetBorderBottomRi ghtWidthIndex), *list.get(InsetBorderBottomRightHeightIndex), conversionData));
370 inset->setBottomLeftRadius(createBorderRadius(*list.get(InsetBorderBottomLef tWidthIndex), *list.get(InsetBorderBottomLeftHeightIndex), conversionData)); 370 inset->setBottomLeftRadius(createBorderRadius(*list.get(InsetBorderBottomLef tWidthIndex), *list.get(InsetBorderBottomLeftHeightIndex), conversionData));
371 return inset.release(); 371 return inset.release();
372 } 372 }
373 373
374 } // namespace InsetFunctions 374 } // namespace InsetFunctions
375 375
376 namespace PolygonFunctions { 376 namespace PolygonFunctions {
377 377
378 InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon) 378 InterpolationValue convertCSSValue(const CSSBasicShapePolygonValue& polygon)
379 { 379 {
380 size_t size = polygon.values().size(); 380 size_t size = polygon.values().size();
381 OwnPtr<InterpolableList> list = InterpolableList::create(size); 381 OwnPtr<InterpolableList> list = InterpolableList::create(size);
382 for (size_t i = 0; i < size; i++) 382 for (size_t i = 0; i < size; i++)
383 list->set(i, convertCSSLength(polygon.values()[i].get())); 383 list->set(i, convertCSSLength(polygon.values()[i].get()));
384 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eatePolygon(polygon.getWindRule(), size)); 384 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reatePolygon(polygon.getWindRule(), size));
385 } 385 }
386 386
387 InterpolationValue convertBasicShape(const BasicShapePolygon& polygon, double zo om) 387 InterpolationValue convertBasicShape(const BasicShapePolygon& polygon, double zo om)
388 { 388 {
389 size_t size = polygon.values().size(); 389 size_t size = polygon.values().size();
390 OwnPtr<InterpolableList> list = InterpolableList::create(size); 390 OwnPtr<InterpolableList> list = InterpolableList::create(size);
391 for (size_t i = 0; i < size; i++) 391 for (size_t i = 0; i < size; i++)
392 list->set(i, convertLength(polygon.values()[i], zoom)); 392 list->set(i, convertLength(polygon.values()[i], zoom));
393 return InterpolationValue(list.release(), BasicShapeNonInterpolableValue::cr eatePolygon(polygon.getWindRule(), size)); 393 return InterpolationValue(std::move(list), BasicShapeNonInterpolableValue::c reatePolygon(polygon.getWindRule(), size));
394 } 394 }
395 395
396 PassOwnPtr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolable Value& nonInterpolableValue) 396 PassOwnPtr<InterpolableValue> createNeutralValue(const BasicShapeNonInterpolable Value& nonInterpolableValue)
397 { 397 {
398 OwnPtr<InterpolableList> list = InterpolableList::create(nonInterpolableValu e.size()); 398 OwnPtr<InterpolableList> list = InterpolableList::create(nonInterpolableValu e.size());
399 for (size_t i = 0; i < nonInterpolableValue.size(); i++) 399 for (size_t i = 0; i < nonInterpolableValue.size(); i++)
400 list->set(i, CSSLengthInterpolationType::createNeutralInterpolableValue( )); 400 list->set(i, CSSLengthInterpolationType::createNeutralInterpolableValue( ));
401 return list.release(); 401 return static_pointer_cast<InterpolableValue>(std::move(list));
402 } 402 }
403 403
404 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const BasicShapeNonInterpolableValue& nonInterpolableValue, const CSSToLengt hConversionData& conversionData) 404 PassRefPtr<BasicShape> createBasicShape(const InterpolableValue& interpolableVal ue, const BasicShapeNonInterpolableValue& nonInterpolableValue, const CSSToLengt hConversionData& conversionData)
405 { 405 {
406 RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create(); 406 RefPtr<BasicShapePolygon> polygon = BasicShapePolygon::create();
407 polygon->setWindRule(nonInterpolableValue.windRule()); 407 polygon->setWindRule(nonInterpolableValue.windRule());
408 const InterpolableList& list = toInterpolableList(interpolableValue); 408 const InterpolableList& list = toInterpolableList(interpolableValue);
409 size_t size = nonInterpolableValue.size(); 409 size_t size = nonInterpolableValue.size();
410 ASSERT(list.length() == size); 410 ASSERT(list.length() == size);
411 ASSERT(size % 2 == 0); 411 ASSERT(size % 2 == 0);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 return InsetFunctions::createBasicShape(interpolableValue, conversionDat a); 488 return InsetFunctions::createBasicShape(interpolableValue, conversionDat a);
489 case BasicShape::BasicShapePolygonType: 489 case BasicShape::BasicShapePolygonType:
490 return PolygonFunctions::createBasicShape(interpolableValue, nonInterpol ableValue, conversionData); 490 return PolygonFunctions::createBasicShape(interpolableValue, nonInterpol ableValue, conversionData);
491 default: 491 default:
492 ASSERT_NOT_REACHED(); 492 ASSERT_NOT_REACHED();
493 return nullptr; 493 return nullptr;
494 } 494 }
495 } 495 }
496 496
497 } // namespace blink 497 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698