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

Side by Side Diff: Source/core/animation/DoubleStyleInterpolation.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/DoubleStyleInterpolation.h" 6 #include "core/animation/DoubleStyleInterpolation.h"
7 7
8 #include "core/css/CSSCalculationValue.h" 8 #include "core/css/CSSCalculationValue.h"
9 #include "core/css/resolver/StyleBuilder.h" 9 #include "core/css/resolver/StyleBuilder.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 bool DoubleStyleInterpolation::canCreateFrom(const CSSValue& value) 13 bool DoubleStyleInterpolation::canCreateFrom(const CSSValue& value)
14 { 14 {
15 return value.isPrimitiveValue() && (toCSSPrimitiveValue(value).isNumber() || toCSSPrimitiveValue(value).isAngle()); 15 return value.isPrimitiveValue() && (toCSSPrimitiveValue(value).isNumber() || toCSSPrimitiveValue(value).isAngle());
16 } 16 }
17 17
18 PassOwnPtrWillBeRawPtr<InterpolableValue> DoubleStyleInterpolation::doubleToInte rpolableValue(const CSSValue& value) 18 PassOwnPtr<InterpolableValue> DoubleStyleInterpolation::doubleToInterpolableValu e(const CSSValue& value)
19 { 19 {
20 ASSERT(canCreateFrom(value)); 20 ASSERT(canCreateFrom(value));
21 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value); 21 const CSSPrimitiveValue& primitive = toCSSPrimitiveValue(value);
22 if (primitive.isNumber()) 22 if (primitive.isNumber())
23 return InterpolableNumber::create(primitive.getDoubleValue()); 23 return InterpolableNumber::create(primitive.getDoubleValue());
24 if (primitive.isAngle()) 24 if (primitive.isAngle())
25 return InterpolableNumber::create(primitive.computeDegrees()); 25 return InterpolableNumber::create(primitive.computeDegrees());
26 ASSERT_NOT_REACHED(); 26 ASSERT_NOT_REACHED();
27 return nullptr; 27 return nullptr;
28 } 28 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void DoubleStyleInterpolation::apply(StyleResolverState& state) const 66 void DoubleStyleInterpolation::apply(StyleResolverState& state) const
67 { 67 {
68 if (m_id != CSSPropertyMotionRotation) { 68 if (m_id != CSSPropertyMotionRotation) {
69 StyleBuilder::applyProperty(m_id, state, interpolableValueToDouble(m_cac hedValue.get(), m_isNumber, m_clamp).get()); 69 StyleBuilder::applyProperty(m_id, state, interpolableValueToDouble(m_cac hedValue.get(), m_isNumber, m_clamp).get());
70 return; 70 return;
71 } 71 }
72 72
73 StyleBuilder::applyProperty(m_id, state, interpolableValueToMotionRotation(m _cachedValue.get(), m_flag).get()); 73 StyleBuilder::applyProperty(m_id, state, interpolableValueToMotionRotation(m _cachedValue.get(), m_flag).get());
74 } 74 }
75 75
76 DEFINE_TRACE(DoubleStyleInterpolation) 76 PassOwnPtr<InterpolableValue> DoubleStyleInterpolation::toInterpolableValue(cons t CSSValue& value, CSSPropertyID property)
77 {
78 StyleInterpolation::trace(visitor);
79 }
80
81 PassOwnPtrWillBeRawPtr<InterpolableValue> DoubleStyleInterpolation::toInterpolab leValue(const CSSValue& value, CSSPropertyID property)
82 { 77 {
83 ASSERT(canCreateFrom(value)); 78 ASSERT(canCreateFrom(value));
84 return doubleToInterpolableValue(value); 79 return doubleToInterpolableValue(value);
85 } 80 }
86 81
87 PassRefPtrWillBeRawPtr<CSSValue> DoubleStyleInterpolation::fromInterpolableValue (const InterpolableValue& value, InterpolationRange range) 82 PassRefPtrWillBeRawPtr<CSSValue> DoubleStyleInterpolation::fromInterpolableValue (const InterpolableValue& value, InterpolationRange range)
88 { 83 {
89 return interpolableValueToDouble(&value, true, range); 84 return interpolableValueToDouble(&value, true, range);
90 } 85 }
91 86
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 PassRefPtrWillBeRawPtr<CSSValue> DoubleStyleInterpolation::interpolableValueToMo tionRotation(InterpolableValue* value, bool flag) 120 PassRefPtrWillBeRawPtr<CSSValue> DoubleStyleInterpolation::interpolableValueToMo tionRotation(InterpolableValue* value, bool flag)
126 { 121 {
127 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 122 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
128 if (flag) 123 if (flag)
129 list->append(CSSPrimitiveValue::createIdentifier(CSSValueAuto)); 124 list->append(CSSPrimitiveValue::createIdentifier(CSSValueAuto));
130 ASSERT(value->isNumber()); 125 ASSERT(value->isNumber());
131 list->append(CSSPrimitiveValue::create(toInterpolableNumber(value)->value(), CSSPrimitiveValue::UnitType::Degrees)); 126 list->append(CSSPrimitiveValue::create(toInterpolableNumber(value)->value(), CSSPrimitiveValue::UnitType::Degrees));
132 return list.release(); 127 return list.release();
133 } 128 }
134 129
135 PassOwnPtrWillBeRawPtr<InterpolableValue> DoubleStyleInterpolation::motionRotati onToInterpolableValue(const CSSValue& value) 130 PassOwnPtr<InterpolableValue> DoubleStyleInterpolation::motionRotationToInterpol ableValue(const CSSValue& value)
136 { 131 {
137 float rotation; 132 float rotation;
138 MotionRotationType rotationType; 133 MotionRotationType rotationType;
139 extractMotionRotation(value, &rotation, &rotationType); 134 extractMotionRotation(value, &rotation, &rotationType);
140 135
141 return InterpolableNumber::create(rotation); 136 return InterpolableNumber::create(rotation);
142 } 137 }
143 138
144 PassRefPtrWillBeRawPtr<DoubleStyleInterpolation> DoubleStyleInterpolation::maybe CreateFromMotionRotation(const CSSValue& start, const CSSValue& end, CSSProperty ID id) 139 PassRefPtr<DoubleStyleInterpolation> DoubleStyleInterpolation::maybeCreateFromMo tionRotation(const CSSValue& start, const CSSValue& end, CSSPropertyID id)
145 { 140 {
146 float startRotation, endRotation; 141 float startRotation, endRotation;
147 MotionRotationType startRotationType, endRotationType; 142 MotionRotationType startRotationType, endRotationType;
148 143
149 if (!extractMotionRotation(start, &startRotation, &startRotationType) 144 if (!extractMotionRotation(start, &startRotation, &startRotationType)
150 || !extractMotionRotation(end, &endRotation, &endRotationType) 145 || !extractMotionRotation(end, &endRotation, &endRotationType)
151 || startRotationType != endRotationType) 146 || startRotationType != endRotationType)
152 return nullptr; 147 return nullptr;
153 148
154 return adoptRefWillBeNoop(new DoubleStyleInterpolation( 149 return adoptRef(new DoubleStyleInterpolation(
155 motionRotationToInterpolableValue(start), 150 motionRotationToInterpolableValue(start),
156 motionRotationToInterpolableValue(end), 151 motionRotationToInterpolableValue(end),
157 id, true, InterpolationRange::RangeAll, startRotationType == MotionRotat ionAuto)); 152 id, true, InterpolationRange::RangeAll, startRotationType == MotionRotat ionAuto));
158 } 153 }
159 154
160 } 155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698