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

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

Issue 1276183004: Oilpan: Unship oilpan from temporary animation objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 | Annotate | Revision Log
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 if (primitiveValue.isValueID()) { 63 if (primitiveValue.isValueID()) {
64 CSSValueID valueID = primitiveValue.getValueID(); 64 CSSValueID valueID = primitiveValue.getValueID();
65 double pixels; 65 double pixels;
66 return pixelsForKeyword(property, valueID, pixels); 66 return pixelsForKeyword(property, valueID, pixels);
67 } 67 }
68 68
69 return primitiveValue.isLength() || primitiveValue.isPercentage() || primiti veValue.isCalculatedPercentageWithLength(); 69 return primitiveValue.isLength() || primitiveValue.isPercentage() || primiti veValue.isCalculatedPercentageWithLength();
70 } 70 }
71 71
72 PassOwnPtrWillBeRawPtr<InterpolableValue> LengthStyleInterpolation::toInterpolab leValue(const CSSValue& value, CSSPropertyID id) 72 PassOwnPtr<InterpolableValue> LengthStyleInterpolation::toInterpolableValue(cons t CSSValue& value, CSSPropertyID id)
73 { 73 {
74 ASSERT(canCreateFrom(value, id)); 74 ASSERT(canCreateFrom(value, id));
75 OwnPtrWillBeRawPtr<InterpolableList> listOfValuesAndTypes = InterpolableList ::create(2); 75 OwnPtr<InterpolableList> listOfValuesAndTypes = InterpolableList::create(2);
76 OwnPtrWillBeRawPtr<InterpolableList> listOfValues = InterpolableList::create (CSSPrimitiveValue::LengthUnitTypeCount); 76 OwnPtr<InterpolableList> listOfValues = InterpolableList::create(CSSPrimitiv eValue::LengthUnitTypeCount);
77 OwnPtrWillBeRawPtr<InterpolableList> listOfTypes = InterpolableList::create( CSSPrimitiveValue::LengthUnitTypeCount); 77 OwnPtr<InterpolableList> listOfTypes = InterpolableList::create(CSSPrimitive Value::LengthUnitTypeCount);
78 78
79 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); 79 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value);
80 80
81 CSSLengthArray arrayOfValues; 81 CSSLengthArray arrayOfValues;
82 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes; 82 CSSPrimitiveValue::CSSLengthTypeArray arrayOfTypes;
83 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++) 83 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; i++)
84 arrayOfValues.append(0); 84 arrayOfValues.append(0);
85 85
86 arrayOfTypes.ensureSize(CSSPrimitiveValue::LengthUnitTypeCount); 86 arrayOfTypes.ensureSize(CSSPrimitiveValue::LengthUnitTypeCount);
87 if (primitive.isValueID()) { 87 if (primitive.isValueID()) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ValueRange valueRange = (range == RangeNonNegative) ? ValueRangeNonNegat ive : ValueRangeAll; 308 ValueRange valueRange = (range == RangeNonNegative) ? ValueRangeNonNegat ive : ValueRangeAll;
309 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(listOfValuesAndTypes), valueRange)); 309 return CSSPrimitiveValue::create(CSSCalcValue::create(constructCalcExpre ssion(listOfValuesAndTypes), valueRange));
310 } 310 }
311 } 311 }
312 312
313 void LengthStyleInterpolation::applyInterpolableValue(CSSPropertyID property, co nst InterpolableValue& value, InterpolationRange range, StyleResolverState& stat e, LengthSetter lengthSetter) 313 void LengthStyleInterpolation::applyInterpolableValue(CSSPropertyID property, co nst InterpolableValue& value, InterpolationRange range, StyleResolverState& stat e, LengthSetter lengthSetter)
314 { 314 {
315 if (lengthSetter && isPixelsOrPercentOnly(value)) { 315 if (lengthSetter && isPixelsOrPercentOnly(value)) {
316 (state.style()->*lengthSetter)(lengthFromInterpolableValue(value, range, state.style()->effectiveZoom())); 316 (state.style()->*lengthSetter)(lengthFromInterpolableValue(value, range, state.style()->effectiveZoom()));
317 #if ENABLE(ASSERT) 317 #if ENABLE(ASSERT)
318 RefPtrWillBeRawPtr<AnimatableValue> before = CSSAnimatableValueFactory:: create(property, *state.style()); 318 RefPtr<AnimatableValue> before = CSSAnimatableValueFactory::create(prope rty, *state.style());
319 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value , range).get()); 319 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value , range).get());
320 RefPtrWillBeRawPtr<AnimatableValue> after = CSSAnimatableValueFactory::c reate(property, *state.style()); 320 RefPtr<AnimatableValue> after = CSSAnimatableValueFactory::create(proper ty, *state.style());
321 ASSERT(before->equals(*after)); 321 ASSERT(before->equals(*after));
322 #endif 322 #endif
323 } else { 323 } else {
324 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value , range).get()); 324 StyleBuilder::applyProperty(property, state, fromInterpolableValue(value , range).get());
325 } 325 }
326 } 326 }
327 327
328 void LengthStyleInterpolation::apply(StyleResolverState& state) const 328 void LengthStyleInterpolation::apply(StyleResolverState& state) const
329 { 329 {
330 applyInterpolableValue(m_id, *m_cachedValue, m_range, state, m_lengthSetter) ; 330 applyInterpolableValue(m_id, *m_cachedValue, m_range, state, m_lengthSetter) ;
331 } 331 }
332 332
333 DEFINE_TRACE(LengthStyleInterpolation)
334 {
335 StyleInterpolation::trace(visitor);
336 } 333 }
337
338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698