| Index: Source/core/animation/KeyframeEffectModel.cpp
|
| diff --git a/Source/core/animation/KeyframeEffectModel.cpp b/Source/core/animation/KeyframeEffectModel.cpp
|
| index fc1f34f527f23625c0e39c8a4883b41ff85e1b13..9356b8701f6b3409f7a4bf1a4108f9acb53e0e26 100644
|
| --- a/Source/core/animation/KeyframeEffectModel.cpp
|
| +++ b/Source/core/animation/KeyframeEffectModel.cpp
|
| @@ -33,6 +33,9 @@
|
|
|
| #include "core/StylePropertyShorthand.h"
|
| #include "core/animation/AnimationNode.h"
|
| +#include "core/animation/css/CSSAnimatableValueFactory.h"
|
| +#include "core/animation/css/CSSPropertyEquality.h"
|
| +#include "core/css/resolver/StyleResolver.h"
|
| #include "platform/animation/AnimationUtilities.h"
|
| #include "platform/geometry/FloatBox.h"
|
| #include "platform/transforms/TransformationMatrix.h"
|
| @@ -60,6 +63,50 @@ void KeyframeEffectModelBase::sample(int iteration, double fraction, double iter
|
| return m_interpolationEffect->getActiveInterpolations(fraction, iterationDuration, result);
|
| }
|
|
|
| +void KeyframeEffectModelBase::snapshotCompositableProperties(const Element* element, const RenderStyle& style)
|
| +{
|
| + if (affects(CSSPropertyOpacity))
|
| + snapshotCompositableProperty(CSSPropertyOpacity, element, style);
|
| + if (affects(CSSPropertyTransform))
|
| + snapshotCompositableProperty(CSSPropertyTransform, element, style);
|
| + if (affects(CSSPropertyWebkitFilter))
|
| + snapshotCompositableProperty(CSSPropertyWebkitFilter, element, style);
|
| +}
|
| +
|
| +bool KeyframeEffectModelBase::snapshotCompositablePropertiesIfNeeded(const Element* element, const RenderStyle& oldStyle, const RenderStyle& newStyle)
|
| +{
|
| + bool changed = false;
|
| +
|
| + if (!CSSPropertyEquality::propertiesEqual(CSSPropertyOpacity, oldStyle, newStyle) && affects(CSSPropertyOpacity)) {
|
| + snapshotCompositableProperty(CSSPropertyOpacity, element, newStyle);
|
| + changed = true;
|
| + }
|
| +
|
| + if (!CSSPropertyEquality::propertiesEqual(CSSPropertyTransform, oldStyle, newStyle) && affects(CSSPropertyTransform)) {
|
| + snapshotCompositableProperty(CSSPropertyTransform, element, newStyle);
|
| + changed = true;
|
| + }
|
| +
|
| + if (!CSSPropertyEquality::propertiesEqual(CSSPropertyWebkitFilter, oldStyle, newStyle) && affects(CSSPropertyWebkitFilter)) {
|
| + snapshotCompositableProperty(CSSPropertyWebkitFilter, element, newStyle);
|
| + changed = true;
|
| + }
|
| +
|
| + return changed;
|
| +}
|
| +
|
| +void KeyframeEffectModelBase::snapshotCompositableProperty(CSSPropertyID property, const Element* element, const RenderStyle& style)
|
| +{
|
| + auto& keyframes = m_keyframeGroups->get(property)->m_keyframes;
|
| + for (size_t i = 0; i < keyframes.size(); i++) {
|
| + auto& keyframe = toStringPropertySpecificKeyframe(*keyframes[i]);
|
| + if (!keyframe.value())
|
| + keyframe.setAnimatableValue(CSSAnimatableValueFactory::create(property, style));
|
| + else if (!keyframe.getAnimatableValue())
|
| + keyframe.setAnimatableValue(StyleResolver::createAnimatableValueSnapshot(const_cast<Element&>(*element), property, *keyframe.value()));
|
| + }
|
| +}
|
| +
|
| KeyframeEffectModelBase::KeyframeVector KeyframeEffectModelBase::normalizedKeyframes(const KeyframeVector& keyframes)
|
| {
|
| double lastOffset = 0;
|
| @@ -140,9 +187,9 @@ void KeyframeEffectModelBase::ensureInterpolationEffect(Element* element) const
|
|
|
| for (const auto& entry : *m_keyframeGroups) {
|
| const PropertySpecificKeyframeVector& keyframes = entry.value->keyframes();
|
| - ASSERT(keyframes[0]->composite() == AnimationEffect::CompositeReplace);
|
| + ASSERT(keyframes[0]->composite() == AnimationEffect::CompositeReplace || keyframes[0]->composite() == AnimationEffect::CompositeAdd);
|
| for (size_t i = 0; i < keyframes.size() - 1; i++) {
|
| - ASSERT(keyframes[i + 1]->composite() == AnimationEffect::CompositeReplace);
|
| + ASSERT(keyframes[i + 1]->composite() == AnimationEffect::CompositeReplace || keyframes[i + 1]->composite() == AnimationEffect::CompositeAdd);
|
| double applyFrom = i ? keyframes[i]->offset() : (-std::numeric_limits<double>::infinity());
|
| double applyTo = i == keyframes.size() - 2 ? std::numeric_limits<double>::infinity() : keyframes[i + 1]->offset();
|
| if (applyTo == 1)
|
|
|