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

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

Issue 1885353004: Add ComputedStyle constructor and getter to InterpolationEnvironment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_transformInterpolationType
Patch Set: Rebased Created 4 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 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/CSSMotionRotationInterpolationType.h" 5 #include "core/animation/CSSMotionRotationInterpolationType.h"
6 6
7 #include "core/css/resolver/StyleBuilderConverter.h" 7 #include "core/css/resolver/StyleBuilderConverter.h"
8 #include "core/style/StyleMotionRotation.h" 8 #include "core/style/StyleMotionRotation.h"
9 #include "wtf/PtrUtil.h" 9 #include "wtf/PtrUtil.h"
10 #include <memory> 10 #include <memory>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (startType != endType) 117 if (startType != endType)
118 return nullptr; 118 return nullptr;
119 return PairwiseInterpolationValue( 119 return PairwiseInterpolationValue(
120 std::move(start.interpolableValue), 120 std::move(start.interpolableValue),
121 std::move(end.interpolableValue), 121 std::move(end.interpolableValue),
122 start.nonInterpolableValue.release()); 122 start.nonInterpolableValue.release());
123 } 123 }
124 124
125 InterpolationValue CSSMotionRotationInterpolationType::maybeConvertUnderlyingVal ue(const InterpolationEnvironment& environment) const 125 InterpolationValue CSSMotionRotationInterpolationType::maybeConvertUnderlyingVal ue(const InterpolationEnvironment& environment) const
126 { 126 {
127 return convertMotionRotation(environment.state().style()->motionRotation()); 127 return convertMotionRotation(environment.style().motionRotation());
128 } 128 }
129 129
130 void CSSMotionRotationInterpolationType::composite(UnderlyingValueOwner& underly ingValueOwner, double underlyingFraction, const InterpolationValue& value, doubl e interpolationFraction) const 130 void CSSMotionRotationInterpolationType::composite(UnderlyingValueOwner& underly ingValueOwner, double underlyingFraction, const InterpolationValue& value, doubl e interpolationFraction) const
131 { 131 {
132 const MotionRotationType& underlyingType = toCSSMotionRotationNonInterpolabl eValue(*underlyingValueOwner.value().nonInterpolableValue).rotationType(); 132 const MotionRotationType& underlyingType = toCSSMotionRotationNonInterpolabl eValue(*underlyingValueOwner.value().nonInterpolableValue).rotationType();
133 const MotionRotationType& rotationType = toCSSMotionRotationNonInterpolableV alue(*value.nonInterpolableValue).rotationType(); 133 const MotionRotationType& rotationType = toCSSMotionRotationNonInterpolableV alue(*value.nonInterpolableValue).rotationType();
134 if (underlyingType == rotationType) 134 if (underlyingType == rotationType)
135 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(under lyingFraction, *value.interpolableValue); 135 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(under lyingFraction, *value.interpolableValue);
136 else 136 else
137 underlyingValueOwner.set(*this, value); 137 underlyingValueOwner.set(*this, value);
138 } 138 }
139 139
140 void CSSMotionRotationInterpolationType::apply(const InterpolableValue& interpol ableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnviro nment& environment) const 140 void CSSMotionRotationInterpolationType::apply(const InterpolableValue& interpol ableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnviro nment& environment) const
141 { 141 {
142 environment.state().style()->setMotionRotation(StyleMotionRotation( 142 environment.style().setMotionRotation(StyleMotionRotation(
143 toInterpolableNumber(interpolableValue).value(), 143 toInterpolableNumber(interpolableValue).value(),
144 toCSSMotionRotationNonInterpolableValue(*nonInterpolableValue).rotationT ype())); 144 toCSSMotionRotationNonInterpolableValue(*nonInterpolableValue).rotationT ype()));
145 } 145 }
146 146
147 } // namespace blink 147 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698