OLD | NEW |
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/CSSRotateInterpolationType.h" | 5 #include "core/animation/CSSRotateInterpolationType.h" |
6 | 6 |
7 #include "core/css/resolver/StyleBuilderConverter.h" | 7 #include "core/css/resolver/StyleBuilderConverter.h" |
8 #include "platform/transforms/RotateTransformOperation.h" | 8 #include "platform/transforms/RotateTransformOperation.h" |
9 #include "platform/transforms/Rotation.h" | 9 #include "platform/transforms/Rotation.h" |
10 #include "wtf/PtrUtil.h" | 10 #include "wtf/PtrUtil.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return PairwiseInterpolationValue( | 150 return PairwiseInterpolationValue( |
151 InterpolableNumber::create(0), | 151 InterpolableNumber::create(0), |
152 InterpolableNumber::create(1), | 152 InterpolableNumber::create(1), |
153 CSSRotateNonInterpolableValue::create( | 153 CSSRotateNonInterpolableValue::create( |
154 toCSSRotateNonInterpolableValue(*start.nonInterpolableValue), | 154 toCSSRotateNonInterpolableValue(*start.nonInterpolableValue), |
155 toCSSRotateNonInterpolableValue(*end.nonInterpolableValue))); | 155 toCSSRotateNonInterpolableValue(*end.nonInterpolableValue))); |
156 } | 156 } |
157 | 157 |
158 InterpolationValue CSSRotateInterpolationType::maybeConvertUnderlyingValue(const
InterpolationEnvironment& environment) const | 158 InterpolationValue CSSRotateInterpolationType::maybeConvertUnderlyingValue(const
InterpolationEnvironment& environment) const |
159 { | 159 { |
160 return convertRotation(getRotation(*environment.state().style())); | 160 return convertRotation(getRotation(environment.style())); |
161 } | 161 } |
162 | 162 |
163 void CSSRotateInterpolationType::composite(UnderlyingValueOwner& underlyingValue
Owner, double underlyingFraction, const InterpolationValue& value, double interp
olationFraction) const | 163 void CSSRotateInterpolationType::composite(UnderlyingValueOwner& underlyingValue
Owner, double underlyingFraction, const InterpolationValue& value, double interp
olationFraction) const |
164 { | 164 { |
165 CSSRotateNonInterpolableValue& underlyingNonInterpolableValue = toCSSRotateN
onInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue); | 165 CSSRotateNonInterpolableValue& underlyingNonInterpolableValue = toCSSRotateN
onInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue); |
166 const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonIn
terpolableValue(*value.nonInterpolableValue); | 166 const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonIn
terpolableValue(*value.nonInterpolableValue); |
167 double progress = toInterpolableNumber(*value.interpolableValue).value(); | 167 double progress = toInterpolableNumber(*value.interpolableValue).value(); |
168 underlyingValueOwner.mutableValue().nonInterpolableValue = underlyingNonInte
rpolableValue.composite(nonInterpolableValue, progress); | 168 underlyingValueOwner.mutableValue().nonInterpolableValue = underlyingNonInte
rpolableValue.composite(nonInterpolableValue, progress); |
169 } | 169 } |
170 | 170 |
171 void CSSRotateInterpolationType::apply(const InterpolableValue& interpolableValu
e, const NonInterpolableValue* untypedNonInterpolableValue, InterpolationEnviron
ment& environment) const | 171 void CSSRotateInterpolationType::apply(const InterpolableValue& interpolableValu
e, const NonInterpolableValue* untypedNonInterpolableValue, InterpolationEnviron
ment& environment) const |
172 { | 172 { |
173 double progress = toInterpolableNumber(interpolableValue).value(); | 173 double progress = toInterpolableNumber(interpolableValue).value(); |
174 const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonIn
terpolableValue(*untypedNonInterpolableValue); | 174 const CSSRotateNonInterpolableValue& nonInterpolableValue = toCSSRotateNonIn
terpolableValue(*untypedNonInterpolableValue); |
175 Rotation rotation = nonInterpolableValue.slerpedRotation(progress); | 175 Rotation rotation = nonInterpolableValue.slerpedRotation(progress); |
176 environment.state().style()->setRotate(RotateTransformOperation::create(rota
tion, TransformOperation::Rotate3D)); | 176 environment.style().setRotate(RotateTransformOperation::create(rotation, Tra
nsformOperation::Rotate3D)); |
177 } | 177 } |
178 | 178 |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
OLD | NEW |