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

Side by Side Diff: Source/core/animation/LengthStyleInterpolation.cpp

Issue 1249553002: CSSValue Immediates: Add move operators to CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_3_tagged_ptrs_with_copy_ops_mv_operators_ref_primvalue
Patch Set: Rebase Created 5 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/animation/LengthStyleInterpolation.h" 6 #include "core/animation/LengthStyleInterpolation.h"
7 7
8 #include "core/animation/css/CSSAnimatableValueFactory.h" 8 #include "core/animation/css/CSSAnimatableValueFactory.h"
9 #include "core/css/CSSCalculationValue.h" 9 #include "core/css/CSSCalculationValue.h"
10 #include "core/css/resolver/StyleBuilder.h" 10 #include "core/css/resolver/StyleBuilder.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 return pixelsForKeyword(property, valueID, pixels); 64 return pixelsForKeyword(property, valueID, pixels);
65 } 65 }
66 66
67 CSSPrimitiveValue::LengthUnitType type; 67 CSSPrimitiveValue::LengthUnitType type;
68 // Only returns true if the type is a primitive length unit. 68 // Only returns true if the type is a primitive length unit.
69 return CSSPrimitiveValue::unitTypeToLengthUnitType(primitiveValue.primit iveType(), type); 69 return CSSPrimitiveValue::unitTypeToLengthUnitType(primitiveValue.primit iveType(), type);
70 } 70 }
71 return value.isCalcValue(); 71 return value.isCalcValue();
72 } 72 }
73 73
74 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::toInterpolab leValue(const CSSValue value, CSSPropertyID id) 74 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::toInterpolab leValue(const CSSValue& value, CSSPropertyID id)
75 { 75 {
76 ASSERT(canCreateFrom(value, id)); 76 ASSERT(canCreateFrom(value, id));
77 OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList ::create(2); 77 OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList ::create(2);
78 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (CSSPrimitiveValue::LengthUnitTypeCount); 78 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (CSSPrimitiveValue::LengthUnitTypeCount);
79 OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create( CSSPrimitiveValue::LengthUnitTypeCount); 79 OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create( CSSPrimitiveValue::LengthUnitTypeCount);
80 80
81 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); 81 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value);
82 82
83 CSSLengthArray arrayOfValues; 83 CSSLengthArray arrayOfValues;
84 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes; 84 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (hasPixels) 271 if (hasPixels)
272 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe lsAndPercent.pixels, range)), Fixed); 272 return Length(CSSPrimitiveValue::clampToCSSLengthRange(clampToRange(pixe lsAndPercent.pixels, range)), Fixed);
273 if (hasPercent) 273 if (hasPercent)
274 return Length(clampToRange(pixelsAndPercent.percent, range), Percent); 274 return Length(clampToRange(pixelsAndPercent.percent, range), Percent);
275 ASSERT_NOT_REACHED(); 275 ASSERT_NOT_REACHED();
276 return Length(0, Fixed); 276 return Length(0, Fixed);
277 } 277 }
278 278
279 } 279 }
280 280
281 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> LengthStyleInterpolation::fromInterpol ableValue(const InterpolableValue& value, InterpolationRange range) 281 CSSPrimitiveValue LengthStyleInterpolation::fromInterpolableValue(const Interpol ableValue& value, InterpolationRange range)
282 { 282 {
283 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value); 283 const InterpolableList* listOfValuesAndTypes = toInterpolableList(&value);
284 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp es->get(0)); 284 const InterpolableList* listOfValues = toInterpolableList(listOfValuesAndTyp es->get(0));
285 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType s->get(1)); 285 const InterpolableList* listOfTypes = toInterpolableList(listOfValuesAndType s->get(1));
286 unsigned unitTypeCount = 0; 286 unsigned unitTypeCount = 0;
287 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) { 287 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) {
288 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i)); 288 const InterpolableNumber* subType = toInterpolableNumber(listOfTypes->ge t(i));
289 if (subType->value()) { 289 if (subType->value()) {
290 unitTypeCount++; 290 unitTypeCount++;
291 } 291 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 StyleBuilder::applyProperty(m_id, state, fromInterpolableValue(*m_cached Value, m_range)); 326 StyleBuilder::applyProperty(m_id, state, fromInterpolableValue(*m_cached Value, m_range));
327 } 327 }
328 } 328 }
329 329
330 DEFINE_TRACE(LengthStyleInterpolation) 330 DEFINE_TRACE(LengthStyleInterpolation)
331 { 331 {
332 StyleInterpolation::trace(visitor); 332 StyleInterpolation::trace(visitor);
333 } 333 }
334 334
335 } 335 }
OLDNEW
« no previous file with comments | « Source/core/animation/LengthStyleInterpolation.h ('k') | Source/core/animation/LengthStyleInterpolationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698