| Index: third_party/WebKit/Source/core/animation/CSSOffsetRotationInterpolationType.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSOffsetRotationInterpolationType.cpp
|
| similarity index 57%
|
| rename from third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp
|
| rename to third_party/WebKit/Source/core/animation/CSSOffsetRotationInterpolationType.cpp
|
| index 3a55984b9c7617f863823e2f5efdb6867d5ce0ab..c481ca30a1fbc3f9d558146f7057c413072a71c6 100644
|
| --- a/third_party/WebKit/Source/core/animation/CSSMotionRotationInterpolationType.cpp
|
| +++ b/third_party/WebKit/Source/core/animation/CSSOffsetRotationInterpolationType.cpp
|
| @@ -2,118 +2,118 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "core/animation/CSSMotionRotationInterpolationType.h"
|
| +#include "core/animation/CSSOffsetRotationInterpolationType.h"
|
|
|
| #include "core/css/resolver/StyleBuilderConverter.h"
|
| -#include "core/style/StyleMotionRotation.h"
|
| +#include "core/style/StyleOffsetRotation.h"
|
| #include "wtf/PtrUtil.h"
|
| #include <memory>
|
|
|
| namespace blink {
|
|
|
| -class CSSMotionRotationNonInterpolableValue : public NonInterpolableValue {
|
| +class CSSOffsetRotationNonInterpolableValue : public NonInterpolableValue {
|
| public:
|
| - ~CSSMotionRotationNonInterpolableValue() {}
|
| + ~CSSOffsetRotationNonInterpolableValue() {}
|
|
|
| - static PassRefPtr<CSSMotionRotationNonInterpolableValue> create(MotionRotationType rotationType)
|
| + static PassRefPtr<CSSOffsetRotationNonInterpolableValue> create(OffsetRotationType rotationType)
|
| {
|
| - return adoptRef(new CSSMotionRotationNonInterpolableValue(rotationType));
|
| + return adoptRef(new CSSOffsetRotationNonInterpolableValue(rotationType));
|
| }
|
|
|
| - MotionRotationType rotationType() const { return m_rotationType; }
|
| + OffsetRotationType rotationType() const { return m_rotationType; }
|
|
|
| DECLARE_NON_INTERPOLABLE_VALUE_TYPE();
|
|
|
| private:
|
| - CSSMotionRotationNonInterpolableValue(MotionRotationType rotationType)
|
| + CSSOffsetRotationNonInterpolableValue(OffsetRotationType rotationType)
|
| : m_rotationType(rotationType)
|
| { }
|
|
|
| - MotionRotationType m_rotationType;
|
| + OffsetRotationType m_rotationType;
|
| };
|
|
|
| -DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSMotionRotationNonInterpolableValue);
|
| -DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSMotionRotationNonInterpolableValue);
|
| +DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSOffsetRotationNonInterpolableValue);
|
| +DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSOffsetRotationNonInterpolableValue);
|
|
|
| namespace {
|
|
|
| class UnderlyingRotationTypeChecker : public InterpolationType::ConversionChecker {
|
| public:
|
| - static std::unique_ptr<UnderlyingRotationTypeChecker> create(MotionRotationType underlyingRotationType)
|
| + static std::unique_ptr<UnderlyingRotationTypeChecker> create(OffsetRotationType underlyingRotationType)
|
| {
|
| return wrapUnique(new UnderlyingRotationTypeChecker(underlyingRotationType));
|
| }
|
|
|
| bool isValid(const InterpolationEnvironment&, const InterpolationValue& underlying) const final
|
| {
|
| - return m_underlyingRotationType == toCSSMotionRotationNonInterpolableValue(*underlying.nonInterpolableValue).rotationType();
|
| + return m_underlyingRotationType == toCSSOffsetRotationNonInterpolableValue(*underlying.nonInterpolableValue).rotationType();
|
| }
|
|
|
| private:
|
| - UnderlyingRotationTypeChecker(MotionRotationType underlyingRotationType)
|
| + UnderlyingRotationTypeChecker(OffsetRotationType underlyingRotationType)
|
| : m_underlyingRotationType(underlyingRotationType)
|
| { }
|
|
|
| - MotionRotationType m_underlyingRotationType;
|
| + OffsetRotationType m_underlyingRotationType;
|
| };
|
|
|
| class InheritedRotationTypeChecker : public InterpolationType::ConversionChecker {
|
| public:
|
| - static std::unique_ptr<InheritedRotationTypeChecker> create(MotionRotationType inheritedRotationType)
|
| + static std::unique_ptr<InheritedRotationTypeChecker> create(OffsetRotationType inheritedRotationType)
|
| {
|
| return wrapUnique(new InheritedRotationTypeChecker(inheritedRotationType));
|
| }
|
|
|
| bool isValid(const InterpolationEnvironment& environment, const InterpolationValue& underlying) const final
|
| {
|
| - return m_inheritedRotationType == environment.state().parentStyle()->motionRotation().type;
|
| + return m_inheritedRotationType == environment.state().parentStyle()->offsetRotation().type;
|
| }
|
|
|
| private:
|
| - InheritedRotationTypeChecker(MotionRotationType inheritedRotationType)
|
| + InheritedRotationTypeChecker(OffsetRotationType inheritedRotationType)
|
| : m_inheritedRotationType(inheritedRotationType)
|
| { }
|
|
|
| - MotionRotationType m_inheritedRotationType;
|
| + OffsetRotationType m_inheritedRotationType;
|
| };
|
|
|
| -InterpolationValue convertMotionRotation(const StyleMotionRotation& rotation)
|
| +InterpolationValue convertOffsetRotation(const StyleOffsetRotation& rotation)
|
| {
|
| return InterpolationValue(
|
| InterpolableNumber::create(rotation.angle),
|
| - CSSMotionRotationNonInterpolableValue::create(rotation.type));
|
| + CSSOffsetRotationNonInterpolableValue::create(rotation.type));
|
| }
|
|
|
| } // namespace
|
|
|
| -InterpolationValue CSSMotionRotationInterpolationType::maybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const
|
| +InterpolationValue CSSOffsetRotationInterpolationType::maybeConvertNeutral(const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const
|
| {
|
| - MotionRotationType underlyingRotationType = toCSSMotionRotationNonInterpolableValue(*underlying.nonInterpolableValue).rotationType();
|
| + OffsetRotationType underlyingRotationType = toCSSOffsetRotationNonInterpolableValue(*underlying.nonInterpolableValue).rotationType();
|
| conversionCheckers.append(UnderlyingRotationTypeChecker::create(underlyingRotationType));
|
| - return convertMotionRotation(StyleMotionRotation(0, underlyingRotationType));
|
| + return convertOffsetRotation(StyleOffsetRotation(0, underlyingRotationType));
|
| }
|
|
|
| -InterpolationValue CSSMotionRotationInterpolationType::maybeConvertInitial(const StyleResolverState&, ConversionCheckers& conversionCheckers) const
|
| +InterpolationValue CSSOffsetRotationInterpolationType::maybeConvertInitial(const StyleResolverState&, ConversionCheckers& conversionCheckers) const
|
| {
|
| - return convertMotionRotation(StyleMotionRotation(0, MotionRotationAuto));
|
| + return convertOffsetRotation(StyleOffsetRotation(0, OffsetRotationAuto));
|
| }
|
|
|
| -InterpolationValue CSSMotionRotationInterpolationType::maybeConvertInherit(const StyleResolverState& state, ConversionCheckers& conversionCheckers) const
|
| +InterpolationValue CSSOffsetRotationInterpolationType::maybeConvertInherit(const StyleResolverState& state, ConversionCheckers& conversionCheckers) const
|
| {
|
| - MotionRotationType inheritedRotationType = state.parentStyle()->motionRotation().type;
|
| + OffsetRotationType inheritedRotationType = state.parentStyle()->offsetRotation().type;
|
| conversionCheckers.append(InheritedRotationTypeChecker::create(inheritedRotationType));
|
| - return convertMotionRotation(state.parentStyle()->motionRotation());
|
| + return convertOffsetRotation(state.parentStyle()->offsetRotation());
|
| }
|
|
|
| -InterpolationValue CSSMotionRotationInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const
|
| +InterpolationValue CSSOffsetRotationInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const
|
| {
|
| - return convertMotionRotation(StyleBuilderConverter::convertMotionRotation(value));
|
| + return convertOffsetRotation(StyleBuilderConverter::convertOffsetRotation(value));
|
| }
|
|
|
| -PairwiseInterpolationValue CSSMotionRotationInterpolationType::maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end) const
|
| +PairwiseInterpolationValue CSSOffsetRotationInterpolationType::maybeMergeSingles(InterpolationValue&& start, InterpolationValue&& end) const
|
| {
|
| - const MotionRotationType& startType = toCSSMotionRotationNonInterpolableValue(*start.nonInterpolableValue).rotationType();
|
| - const MotionRotationType& endType = toCSSMotionRotationNonInterpolableValue(*end.nonInterpolableValue).rotationType();
|
| + const OffsetRotationType& startType = toCSSOffsetRotationNonInterpolableValue(*start.nonInterpolableValue).rotationType();
|
| + const OffsetRotationType& endType = toCSSOffsetRotationNonInterpolableValue(*end.nonInterpolableValue).rotationType();
|
| if (startType != endType)
|
| return nullptr;
|
| return PairwiseInterpolationValue(
|
| @@ -122,26 +122,26 @@ PairwiseInterpolationValue CSSMotionRotationInterpolationType::maybeMergeSingles
|
| start.nonInterpolableValue.release());
|
| }
|
|
|
| -InterpolationValue CSSMotionRotationInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
|
| +InterpolationValue CSSOffsetRotationInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
|
| {
|
| - return convertMotionRotation(environment.state().style()->motionRotation());
|
| + return convertOffsetRotation(environment.state().style()->offsetRotation());
|
| }
|
|
|
| -void CSSMotionRotationInterpolationType::composite(UnderlyingValueOwner& underlyingValueOwner, double underlyingFraction, const InterpolationValue& value, double interpolationFraction) const
|
| +void CSSOffsetRotationInterpolationType::composite(UnderlyingValueOwner& underlyingValueOwner, double underlyingFraction, const InterpolationValue& value, double interpolationFraction) const
|
| {
|
| - const MotionRotationType& underlyingType = toCSSMotionRotationNonInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue).rotationType();
|
| - const MotionRotationType& rotationType = toCSSMotionRotationNonInterpolableValue(*value.nonInterpolableValue).rotationType();
|
| + const OffsetRotationType& underlyingType = toCSSOffsetRotationNonInterpolableValue(*underlyingValueOwner.value().nonInterpolableValue).rotationType();
|
| + const OffsetRotationType& rotationType = toCSSOffsetRotationNonInterpolableValue(*value.nonInterpolableValue).rotationType();
|
| if (underlyingType == rotationType)
|
| underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(underlyingFraction, *value.interpolableValue);
|
| else
|
| underlyingValueOwner.set(*this, value);
|
| }
|
|
|
| -void CSSMotionRotationInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const
|
| +void CSSOffsetRotationInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const
|
| {
|
| - environment.state().style()->setMotionRotation(StyleMotionRotation(
|
| + environment.state().style()->setOffsetRotation(StyleOffsetRotation(
|
| toInterpolableNumber(interpolableValue).value(),
|
| - toCSSMotionRotationNonInterpolableValue(*nonInterpolableValue).rotationType()));
|
| + toCSSOffsetRotationNonInterpolableValue(*nonInterpolableValue).rotationType()));
|
| }
|
|
|
| } // namespace blink
|
|
|