| 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/CSSTranslateInterpolationType.h" | 5 #include "core/animation/CSSTranslateInterpolationType.h" |
| 6 | 6 |
| 7 #include "core/animation/LengthInterpolationFunctions.h" | 7 #include "core/animation/LengthInterpolationFunctions.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 "platform/transforms/TranslateTransformOperation.h" | 10 #include "platform/transforms/TranslateTransformOperation.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return InterpolationValue(std::move(result)); | 137 return InterpolationValue(std::move(result)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 InterpolationValue CSSTranslateInterpolationType::maybeConvertUnderlyingValue( | 140 InterpolationValue CSSTranslateInterpolationType::maybeConvertUnderlyingValue( |
| 141 const InterpolationEnvironment& environment) const { | 141 const InterpolationEnvironment& environment) const { |
| 142 return convertTranslateOperation( | 142 return convertTranslateOperation( |
| 143 environment.state().style()->translate(), | 143 environment.state().style()->translate(), |
| 144 environment.state().style()->effectiveZoom()); | 144 environment.state().style()->effectiveZoom()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void CSSTranslateInterpolationType::apply( | 147 void CSSTranslateInterpolationType::applyStandardPropertyValue( |
| 148 const InterpolableValue& interpolableValue, | 148 const InterpolableValue& interpolableValue, |
| 149 const NonInterpolableValue*, | 149 const NonInterpolableValue*, |
| 150 InterpolationEnvironment& environment) const { | 150 StyleResolverState& state) const { |
| 151 const InterpolableList& list = toInterpolableList(interpolableValue); | 151 const InterpolableList& list = toInterpolableList(interpolableValue); |
| 152 const CSSToLengthConversionData& conversionData = | 152 const CSSToLengthConversionData& conversionData = |
| 153 environment.state().cssToLengthConversionData(); | 153 state.cssToLengthConversionData(); |
| 154 Length x = LengthInterpolationFunctions::createLength( | 154 Length x = LengthInterpolationFunctions::createLength( |
| 155 *list.get(TranslateX), nullptr, conversionData, ValueRangeAll); | 155 *list.get(TranslateX), nullptr, conversionData, ValueRangeAll); |
| 156 Length y = LengthInterpolationFunctions::createLength( | 156 Length y = LengthInterpolationFunctions::createLength( |
| 157 *list.get(TranslateY), nullptr, conversionData, ValueRangeAll); | 157 *list.get(TranslateY), nullptr, conversionData, ValueRangeAll); |
| 158 float z = LengthInterpolationFunctions::createLength( | 158 float z = LengthInterpolationFunctions::createLength( |
| 159 *list.get(TranslateZ), nullptr, conversionData, ValueRangeAll) | 159 *list.get(TranslateZ), nullptr, conversionData, ValueRangeAll) |
| 160 .pixels(); | 160 .pixels(); |
| 161 | 161 |
| 162 RefPtr<TranslateTransformOperation> result = nullptr; | 162 RefPtr<TranslateTransformOperation> result = nullptr; |
| 163 if (!x.isZero() || !y.isZero() || z != 0) | 163 if (!x.isZero() || !y.isZero() || z != 0) |
| 164 result = TranslateTransformOperation::create( | 164 result = TranslateTransformOperation::create( |
| 165 x, y, z, TransformOperation::Translate3D); | 165 x, y, z, TransformOperation::Translate3D); |
| 166 environment.state().style()->setTranslate(result.release()); | 166 state.style()->setTranslate(result.release()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 } // namespace blink | 169 } // namespace blink |
| OLD | NEW |