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

Side by Side Diff: third_party/WebKit/Source/core/animation/CSSScaleInterpolationType.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CSSScaleInterpolationType.h" 5 #include "core/animation/CSSScaleInterpolationType.h"
6 6
7 #include "core/css/CSSPrimitiveValue.h" 7 #include "core/css/CSSPrimitiveValue.h"
8 #include "core/css/CSSValueList.h" 8 #include "core/css/CSSValueList.h"
9 #include "core/css/resolver/StyleResolverState.h" 9 #include "core/css/resolver/StyleResolverState.h"
10 #include "wtf/PtrUtil.h" 10 #include "wtf/PtrUtil.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return PairwiseInterpolationValue( 173 return PairwiseInterpolationValue(
174 std::move(start.interpolableValue), 174 std::move(start.interpolableValue),
175 std::move(end.interpolableValue), 175 std::move(end.interpolableValue),
176 CSSScaleNonInterpolableValue::merge( 176 CSSScaleNonInterpolableValue::merge(
177 toCSSScaleNonInterpolableValue(*start.nonInterpolableValue), 177 toCSSScaleNonInterpolableValue(*start.nonInterpolableValue),
178 toCSSScaleNonInterpolableValue(*end.nonInterpolableValue))); 178 toCSSScaleNonInterpolableValue(*end.nonInterpolableValue)));
179 } 179 }
180 180
181 InterpolationValue CSSScaleInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const 181 InterpolationValue CSSScaleInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
182 { 182 {
183 return InterpolationValue(Scale(environment.state().style()->scale()).create InterpolableValue()); 183 Scale scale = Scale(environment.style().scale());
184 return InterpolationValue(scale.createInterpolableValue(), CSSScaleNonInterp olableValue::create(scale, false));
184 } 185 }
185 186
186 void CSSScaleInterpolationType::composite(UnderlyingValueOwner& underlyingValueO wner, double underlyingFraction, const InterpolationValue& value, double interpo lationFraction) const 187 void CSSScaleInterpolationType::composite(UnderlyingValueOwner& underlyingValueO wner, double underlyingFraction, const InterpolationValue& value, double interpo lationFraction) const
187 { 188 {
188 const CSSScaleNonInterpolableValue& metadata = toCSSScaleNonInterpolableValu e(*value.nonInterpolableValue); 189 const CSSScaleNonInterpolableValue& metadata = toCSSScaleNonInterpolableValu e(*value.nonInterpolableValue);
189 ASSERT(metadata.isStartAdditive() || metadata.isEndAdditive()); 190 ASSERT(metadata.isStartAdditive() || metadata.isEndAdditive());
190 191
191 InterpolableList& underlyingList = toInterpolableList(*underlyingValueOwner. mutableValue().interpolableValue); 192 InterpolableList& underlyingList = toInterpolableList(*underlyingValueOwner. mutableValue().interpolableValue);
192 for (size_t i = 0; i < 3; i++) { 193 for (size_t i = 0; i < 3; i++) {
193 InterpolableNumber& underlying = toInterpolableNumber(*underlyingList.ge tMutable(i)); 194 InterpolableNumber& underlying = toInterpolableNumber(*underlyingList.ge tMutable(i));
194 double start = metadata.start().array[i] * (metadata.isStartAdditive() ? underlying.value() : 1); 195 double start = metadata.start().array[i] * (metadata.isStartAdditive() ? underlying.value() : 1);
195 double end = metadata.end().array[i] * (metadata.isEndAdditive() ? under lying.value() : 1); 196 double end = metadata.end().array[i] * (metadata.isEndAdditive() ? under lying.value() : 1);
196 underlying.set(blend(start, end, interpolationFraction)); 197 underlying.set(blend(start, end, interpolationFraction));
197 } 198 }
198 } 199 }
199 200
200 void CSSScaleInterpolationType::apply(const InterpolableValue& interpolableValue , const NonInterpolableValue*, InterpolationEnvironment& environment) const 201 void CSSScaleInterpolationType::apply(const InterpolableValue& interpolableValue , const NonInterpolableValue*, InterpolationEnvironment& environment) const
201 { 202 {
202 Scale scale(interpolableValue); 203 Scale scale(interpolableValue);
203 environment.state().style()->setScale(ScaleTransformOperation::create(scale. array[0], scale.array[1], scale.array[2], TransformOperation::Scale3D)); 204 environment.style().setScale(ScaleTransformOperation::create(scale.array[0], scale.array[1], scale.array[2], TransformOperation::Scale3D));
204 } 205 }
205 206
206 } // namespace blink 207 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698