Chromium Code Reviews| Index: Source/core/animation/AnimationType.h |
| diff --git a/Source/core/animation/AnimationType.h b/Source/core/animation/AnimationType.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1e0e7bcd28b3387d02d3a373f8e6bcf47aa4942f |
| --- /dev/null |
| +++ b/Source/core/animation/AnimationType.h |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef AnimationType_h |
| +#define AnimationType_h |
| + |
| +#include "core/animation/InterpolableValue.h" |
| +#include "core/animation/InterpolationPrimitive.h" |
| +#include "core/animation/NonInterpolableValue.h" |
| +#include "core/animation/StringKeyframe.h" |
| +#include "platform/heap/Handle.h" |
| + |
| +namespace blink { |
| + |
| +class StyleResolverState; |
| + |
| +// A singleton class that provides functions for: |
|
shans
2015/06/22 11:43:21
We already know this is a class which provides fun
alancutter (OOO until 2018)
2015/06/23 05:05:33
Done.
|
| +// - Converting from animation keyframe(s) to interpolation compatible representations. |
| +// - Applying interpolation compatible representations of values to a StyleResolverState. |
|
shans
2015/06/22 11:43:21
Reference the functions that do these two things.
alancutter (OOO until 2018)
2015/06/23 05:05:33
Done.
|
| +class AnimationType { |
| +public: |
| + CSSPropertyID property() const { return m_property; } |
| + |
| + // Represents logic for determining whether a conversion decision is no longer valid given the current environment. |
| + class ConversionInvalidator : public NoBaseWillBeGarbageCollectedFinalized<ConversionInvalidator> { |
| + public: |
| + virtual ~ConversionInvalidator() { } |
| + virtual bool isInvalid(const StyleResolverState&) const = 0; |
| + DEFINE_INLINE_VIRTUAL_TRACE() { } |
| + }; |
| + using ConversionInvalidators = WillBeHeapVector<OwnPtrWillBeMember<ConversionInvalidator>>; |
| + |
| + virtual PassOwnPtrWillBeRawPtr<PairwiseInterpolationPrimitive> maybeConvertPairwise(const CSSPropertySpecificKeyframe& startKeyframe, const CSSPropertySpecificKeyframe& endKeyframe, const StyleResolverState*, ConversionInvalidators&) const |
| + { |
| + return nullptr; |
| + } |
| + |
| + PassOwnPtrWillBeRawPtr<FlipInterpolationPrimitive::Side> maybeConvertSingle(const CSSPropertySpecificKeyframe& keyframe, const StyleResolverState* state, ConversionInvalidators& conversionInvalidators) const |
| + { |
| + OwnPtrWillBeRawPtr<FlipInterpolationPrimitive::Side> result = maybeConvertSingleImpl(keyframe, state, conversionInvalidators); |
| + if (result) |
| + result->type = this; |
| + return result.release(); |
| + } |
|
shans
2015/06/22 11:43:21
nit: it's probably better just to result->type = t
alancutter (OOO until 2018)
2015/06/23 05:05:33
Done.
|
| + |
| + virtual void apply(const InterpolableValue&, const NonInterpolableValue*, StyleResolverState&) const = 0; |
| + |
| +protected: |
| + AnimationType(CSSPropertyID property) |
| + : m_property(property) |
| + { } |
| + |
| + virtual PassOwnPtrWillBeRawPtr<FlipInterpolationPrimitive::Side> maybeConvertSingleImpl(const CSSPropertySpecificKeyframe&, const StyleResolverState*, ConversionInvalidators&) const |
| + { |
| + return nullptr; |
| + } |
| + |
| + const CSSPropertyID m_property; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AnimationType_h |