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 <memory> | 7 #include <memory> |
8 #include "core/css/resolver/StyleBuilderConverter.h" | 8 #include "core/css/resolver/StyleBuilderConverter.h" |
9 #include "platform/transforms/RotateTransformOperation.h" | 9 #include "platform/transforms/RotateTransformOperation.h" |
10 #include "platform/transforms/Rotation.h" | 10 #include "platform/transforms/Rotation.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return OptionalRotation(); | 143 return OptionalRotation(); |
144 return OptionalRotation( | 144 return OptionalRotation( |
145 Rotation(style.Rotate()->Axis(), style.Rotate()->Angle())); | 145 Rotation(style.Rotate()->Axis(), style.Rotate()->Angle())); |
146 } | 146 } |
147 | 147 |
148 InterpolationValue ConvertRotation(const OptionalRotation& rotation) { | 148 InterpolationValue ConvertRotation(const OptionalRotation& rotation) { |
149 return InterpolationValue(InterpolableNumber::Create(0), | 149 return InterpolationValue(InterpolableNumber::Create(0), |
150 CSSRotateNonInterpolableValue::Create(rotation)); | 150 CSSRotateNonInterpolableValue::Create(rotation)); |
151 } | 151 } |
152 | 152 |
153 class InheritedRotationChecker : public InterpolationType::ConversionChecker { | 153 class InheritedRotationChecker |
| 154 : public CSSInterpolationType::CSSConversionChecker { |
154 public: | 155 public: |
155 static std::unique_ptr<InheritedRotationChecker> Create( | 156 static std::unique_ptr<InheritedRotationChecker> Create( |
156 const OptionalRotation& inherited_rotation) { | 157 const OptionalRotation& inherited_rotation) { |
157 return WTF::WrapUnique(new InheritedRotationChecker(inherited_rotation)); | 158 return WTF::WrapUnique(new InheritedRotationChecker(inherited_rotation)); |
158 } | 159 } |
159 | 160 |
160 bool IsValid(const InterpolationEnvironment& environment, | 161 bool IsValid(const StyleResolverState& state, |
161 const InterpolationValue& underlying) const final { | 162 const InterpolationValue& underlying) const final { |
162 OptionalRotation inherited_rotation = | 163 OptionalRotation inherited_rotation = GetRotation(*state.ParentStyle()); |
163 GetRotation(*environment.GetState().ParentStyle()); | |
164 if (inherited_rotation_.IsNone() || inherited_rotation.IsNone()) | 164 if (inherited_rotation_.IsNone() || inherited_rotation.IsNone()) |
165 return inherited_rotation.IsNone() == inherited_rotation.IsNone(); | 165 return inherited_rotation.IsNone() == inherited_rotation.IsNone(); |
166 return inherited_rotation_.GetRotation().axis == | 166 return inherited_rotation_.GetRotation().axis == |
167 inherited_rotation.GetRotation().axis && | 167 inherited_rotation.GetRotation().axis && |
168 inherited_rotation_.GetRotation().angle == | 168 inherited_rotation_.GetRotation().angle == |
169 inherited_rotation.GetRotation().angle; | 169 inherited_rotation.GetRotation().angle; |
170 } | 170 } |
171 | 171 |
172 private: | 172 private: |
173 InheritedRotationChecker(const OptionalRotation& inherited_rotation) | 173 InheritedRotationChecker(const OptionalRotation& inherited_rotation) |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 OptionalRotation rotation = non_interpolable_value.SlerpedRotation(progress); | 259 OptionalRotation rotation = non_interpolable_value.SlerpedRotation(progress); |
260 if (rotation.IsNone()) { | 260 if (rotation.IsNone()) { |
261 state.Style()->SetRotate(nullptr); | 261 state.Style()->SetRotate(nullptr); |
262 return; | 262 return; |
263 } | 263 } |
264 state.Style()->SetRotate(RotateTransformOperation::Create( | 264 state.Style()->SetRotate(RotateTransformOperation::Create( |
265 rotation.GetRotation(), TransformOperation::kRotate3D)); | 265 rotation.GetRotation(), TransformOperation::kRotate3D)); |
266 } | 266 } |
267 | 267 |
268 } // namespace blink | 268 } // namespace blink |
OLD | NEW |