| Index: Source/core/animation/css/CSSAnimations.cpp
|
| diff --git a/Source/core/animation/css/CSSAnimations.cpp b/Source/core/animation/css/CSSAnimations.cpp
|
| index efed6c999a9005eb91012b7a337caacf8b739fd4..d91e9d21e94045af3d9c26931c8f9e1b533352fb 100644
|
| --- a/Source/core/animation/css/CSSAnimations.cpp
|
| +++ b/Source/core/animation/css/CSSAnimations.cpp
|
| @@ -85,7 +85,7 @@ CSSPropertyID propertyForAnimation(CSSPropertyID property)
|
| return property;
|
| }
|
|
|
| -static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframeEffect(StyleResolver* resolver, const Element* animatingElement, Element& element, const LayoutStyle& style, LayoutStyle* parentStyle,
|
| +static PassRefPtrWillBeRawPtr<StringKeyframeEffectModel> createKeyframeEffect(StyleResolver* resolver, const Element* animatingElement, Element& element, const LayoutStyle& style, LayoutStyle* parentStyle,
|
| const AtomicString& name, TimingFunction* defaultTimingFunction)
|
| {
|
| // When the animating element is null, use its parent for scoping purposes.
|
| @@ -93,7 +93,7 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| const StyleRuleKeyframes* keyframesRule = resolver->findKeyframesRule(elementForScoping, name);
|
| ASSERT(keyframesRule);
|
|
|
| - AnimatableValueKeyframeVector keyframes;
|
| + StringKeyframeVector keyframes;
|
| const WillBeHeapVector<RefPtrWillBeMember<StyleRuleKeyframe>>& styleKeyframes = keyframesRule->keyframes();
|
|
|
| // Construct and populate the style for each keyframe
|
| @@ -101,7 +101,7 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| for (size_t i = 0; i < styleKeyframes.size(); ++i) {
|
| const StyleRuleKeyframe* styleKeyframe = styleKeyframes[i].get();
|
| RefPtr<LayoutStyle> keyframeStyle = resolver->styleForKeyframe(element, style, parentStyle, styleKeyframe, name);
|
| - RefPtrWillBeRawPtr<AnimatableValueKeyframe> keyframe = AnimatableValueKeyframe::create();
|
| + RefPtrWillBeRawPtr<StringKeyframe> keyframe = StringKeyframe::create();
|
| const Vector<double>& offsets = styleKeyframe->keys();
|
| ASSERT(!offsets.isEmpty());
|
| keyframe->setOffset(offsets[0]);
|
| @@ -123,13 +123,13 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| }
|
| keyframe->setEasing(timingFunction.release());
|
| } else if (CSSPropertyMetadata::isAnimatableProperty(property)) {
|
| - keyframe->setPropertyValue(property, CSSAnimatableValueFactory::create(property, *keyframeStyle).get());
|
| + keyframe->setPropertyValue(property, properties.propertyAt(j).value());
|
| }
|
| }
|
| keyframes.append(keyframe);
|
| // The last keyframe specified at a given offset is used.
|
| for (size_t j = 1; j < offsets.size(); ++j) {
|
| - keyframes.append(toAnimatableValueKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
|
| + keyframes.append(toStringKeyframe(keyframe->cloneWithOffset(offsets[j]).get()));
|
| }
|
| }
|
|
|
| @@ -154,16 +154,16 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| keyframes.shrink(targetIndex + 1);
|
|
|
| // Add 0% and 100% keyframes if absent.
|
| - RefPtrWillBeRawPtr<AnimatableValueKeyframe> startKeyframe = keyframes.isEmpty() ? nullptr : keyframes[0];
|
| + RefPtrWillBeRawPtr<StringKeyframe> startKeyframe = keyframes.isEmpty() ? nullptr : keyframes[0];
|
| if (!startKeyframe || keyframes[0]->offset() != 0) {
|
| - startKeyframe = AnimatableValueKeyframe::create();
|
| + startKeyframe = StringKeyframe::create();
|
| startKeyframe->setOffset(0);
|
| startKeyframe->setEasing(defaultTimingFunction);
|
| keyframes.prepend(startKeyframe);
|
| }
|
| - RefPtrWillBeRawPtr<AnimatableValueKeyframe> endKeyframe = keyframes[keyframes.size() - 1];
|
| + RefPtrWillBeRawPtr<StringKeyframe> endKeyframe = keyframes[keyframes.size() - 1];
|
| if (endKeyframe->offset() != 1) {
|
| - endKeyframe = AnimatableValueKeyframe::create();
|
| + endKeyframe = StringKeyframe::create();
|
| endKeyframe->setOffset(1);
|
| endKeyframe->setEasing(defaultTimingFunction);
|
| keyframes.append(endKeyframe);
|
| @@ -172,7 +172,7 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| ASSERT(!keyframes.first()->offset());
|
| ASSERT(keyframes.last()->offset() == 1);
|
|
|
| - // Snapshot current property values for 0% and 100% if missing.
|
| + // FIXME: This is only used for use counting neutral keyframes running on the compositor.
|
| PropertySet allProperties;
|
| for (const auto& keyframe : keyframes) {
|
| for (CSSPropertyID property : keyframe->properties())
|
| @@ -188,19 +188,15 @@ static PassRefPtrWillBeRawPtr<AnimatableValueKeyframeEffectModel> createKeyframe
|
| bool endNeedsValue = missingEndValues && !endKeyframeProperties.contains(property);
|
| if (!startNeedsValue && !endNeedsValue)
|
| continue;
|
| - RefPtrWillBeRawPtr<AnimatableValue> snapshotValue = CSSAnimatableValueFactory::create(property, style);
|
| - if (startNeedsValue)
|
| - startKeyframe->setPropertyValue(property, snapshotValue.get());
|
| - if (endNeedsValue)
|
| - endKeyframe->setPropertyValue(property, snapshotValue.get());
|
| - if (property == CSSPropertyOpacity || property == CSSPropertyTransform)
|
| + if (CompositorAnimations::isCompositableProperty(property))
|
| UseCounter::count(elementForScoping->document(), UseCounter::SyntheticKeyframesInCompositedCSSAnimation);
|
| }
|
| }
|
| - ASSERT(startKeyframe->properties().size() == allProperties.size());
|
| - ASSERT(endKeyframe->properties().size() == allProperties.size());
|
|
|
| - return AnimatableValueKeyframeEffectModel::create(keyframes, &keyframes[0]->easing());
|
| + RefPtrWillBeRawPtr<StringKeyframeEffectModel> effect = StringKeyframeEffectModel::create(keyframes, &keyframes[0]->easing());
|
| + effect->snapshotCompositableProperties(animatingElement, style); // FIXME: Remove this once CompositorAnimations no longer depends on AnimatableValues
|
| + effect->forceConversionsToAnimatableValues(&element); // FIXME: Remove this once LegacyStyleInterpolation is removed from StringKeyframe
|
| + return effect;
|
| }
|
| } // namespace
|
|
|
| @@ -289,6 +285,13 @@ void CSSAnimations::calculateAnimationUpdate(CSSAnimationUpdate* update, const E
|
| update->updateAnimation(animationName, player, InertAnimation::create(
|
| createKeyframeEffect(resolver, animatingElement, element, style, parentStyle, animationName, keyframeTimingFunction.get()),
|
| timing, isPaused, player->currentTimeInternal()), specifiedTiming, keyframesRule);
|
| + } else if (!isAnimationStyleChange && player->source() && player->source()->isAnimation()) {
|
| + AnimationEffect* effect = toAnimation(player->source())->effect();
|
| + if (effect && effect->isKeyframeEffectModel()) {
|
| + KeyframeEffectModelBase* keyframeEffect = toKeyframeEffectModelBase(effect);
|
| + if (keyframeEffect->hasSyntheticKeyframes())
|
| + update->updateAnimationStyle(player, keyframeEffect, animatingElement->renderer(), style);
|
| + }
|
| }
|
|
|
| if (isPaused != player->paused()) {
|
| @@ -355,6 +358,21 @@ void CSSAnimations::maybeApplyPendingUpdate(Element* element)
|
| m_animations.find(entry.name)->value->update(entry);
|
| }
|
|
|
| + for (const auto& styleUpdate : update->animationsWithStyleUpdates()) {
|
| + styleUpdate.effect->forEachInterpolation([](Interpolation& interpolation) {
|
| + if (interpolation.isStyleInterpolation() && toStyleInterpolation(interpolation).isDeferredLegacyStyleInterpolation())
|
| + toDeferredLegacyStyleInterpolation(toStyleInterpolation(interpolation)).underlyingStyleChanged();
|
| + });
|
| +
|
| + if (styleUpdate.snapshot.opacity || styleUpdate.snapshot.transform || styleUpdate.snapshot.webkitFilter) {
|
| + styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropertyOpacity, styleUpdate.snapshot.opacity);
|
| + styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropertyTransform, styleUpdate.snapshot.transform);
|
| + styleUpdate.effect->updateNeutralKeyframeAnimatableValues(CSSPropertyWebkitFilter, styleUpdate.snapshot.webkitFilter);
|
| + styleUpdate.player->setOutdated();
|
| + styleUpdate.player->setCompositorPending(true);
|
| + }
|
| + }
|
| +
|
| for (const auto& entry : update->newAnimations()) {
|
| const InertAnimation* inertAnimation = entry.animation.get();
|
| OwnPtrWillBeRawPtr<AnimationEventDelegate> eventDelegate = adoptPtrWillBeNoop(new AnimationEventDelegate(element, entry.name));
|
|
|