| Index: third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
|
| index 3c8a0f93014821d3910284442dfdd0a2f587c8f6..3488af35a0fc2a341823f36df72e2ed02483871e 100644
|
| --- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
|
| +++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
|
| @@ -291,8 +291,8 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
|
| // If we're in an animation style change, no animations can have started, been
|
| // cancelled or changed play state. When DCHECK is enabled, we verify this
|
| // optimization.
|
| - if (is_animation_style_change) {
|
| - CalculateAnimationActiveInterpolations(update, animating_element);
|
| + if (isAnimationStyleChange) {
|
| + calculateAnimationActiveInterpolations(update, animatingElement);
|
| return;
|
| }
|
| #endif
|
| @@ -433,12 +433,15 @@ void CSSAnimations::SnapshotCompositorKeyframes(
|
| }
|
|
|
| void CSSAnimations::MaybeApplyPendingUpdate(Element* element) {
|
| - previous_active_interpolations_for_animations_.Clear();
|
| + previous_active_interpolations_for_custom_animations_.Clear();
|
| + previous_active_interpolations_for_standard_animations_.Clear();
|
| if (pending_update_.IsEmpty())
|
| return;
|
|
|
| - previous_active_interpolations_for_animations_.Swap(
|
| - pending_update_.ActiveInterpolationsForAnimations());
|
| + previous_active_interpolations_for_custom_animations_.Swap(
|
| + pending_update_.ActiveInterpolationsForCustomAnimations());
|
| + previous_active_interpolations_for_standard_animations_.Swap(
|
| + pending_update_.ActiveInterpolationsForStandardAnimations());
|
|
|
| // FIXME: cancelling, pausing, unpausing animations all query
|
| // compositingState, which is not necessarily up to date here
|
| @@ -634,12 +637,23 @@ void CSSAnimations::CalculateTransitionUpdateForProperty(
|
| // FIXME: We should transition if an !important property changes even when an
|
| // animation is running, but this is a bit hard to do with the current
|
| // applyMatchedProperties system.
|
| - if (state.update.ActiveInterpolationsForAnimations().Contains(property) ||
|
| - (state.animating_element->GetElementAnimations() &&
|
| - state.animating_element->GetElementAnimations()
|
| - ->CssAnimations()
|
| - .previous_active_interpolations_for_animations_.Contains(
|
| - property))) {
|
| + if (property.IsCSSCustomProperty()) {
|
| + if (state.update.ActiveInterpolationsForCustomAnimations().Contains(
|
| + property) ||
|
| + (state.animating_element->GetElementAnimations() &&
|
| + state.animating_element->GetElementAnimations()
|
| + ->CssAnimations()
|
| + .previous_active_interpolations_for_custom_animations_.Contains(
|
| + property))) {
|
| + return;
|
| + }
|
| + } else if (state.update.ActiveInterpolationsForStandardAnimations().Contains(
|
| + property) ||
|
| + (state.animating_element->GetElementAnimations() &&
|
| + state.animating_element->GetElementAnimations()
|
| + ->CssAnimations()
|
| + .previous_active_interpolations_for_standard_animations_
|
| + .Contains(property))) {
|
| return;
|
| }
|
|
|
| @@ -933,6 +947,10 @@ void CSSAnimations::Cancel() {
|
| ClearPendingUpdate();
|
| }
|
|
|
| +static bool IsCustomPropertyHandle(const PropertyHandle& property) {
|
| + return property.IsCSSCustomProperty();
|
| +}
|
| +
|
| // TODO(alancutter): CSS properties and presentation attributes may have
|
| // identical effects. By grouping them in the same set we introduce a bug where
|
| // arbitrary hash iteration will determine the order the apply in and thus which
|
| @@ -940,9 +958,9 @@ void CSSAnimations::Cancel() {
|
| // the case of effect collisions.
|
| // Example: Both 'color' and 'svg-color' set the color on ComputedStyle but are
|
| // considered distinct properties in the ActiveInterpolationsMap.
|
| -static bool IsStylePropertyHandle(const PropertyHandle& property_handle) {
|
| - return property_handle.IsCSSProperty() ||
|
| - property_handle.IsPresentationAttribute();
|
| +static bool IsStandardPropertyHandle(const PropertyHandle& property) {
|
| + return (property.IsCSSProperty() && !property.IsCSSCustomProperty()) ||
|
| + property.IsPresentationAttribute();
|
| }
|
|
|
| void CSSAnimations::CalculateAnimationActiveInterpolations(
|
| @@ -955,12 +973,19 @@ void CSSAnimations::CalculateAnimationActiveInterpolations(
|
|
|
| if (update.NewAnimations().IsEmpty() &&
|
| update.SuppressedAnimations().IsEmpty()) {
|
| - ActiveInterpolationsMap active_interpolations_for_animations(
|
| + ActiveInterpolationsMap active_interpolations_for_custom_animations(
|
| + EffectStack::ActiveInterpolations(
|
| + effect_stack, nullptr, nullptr,
|
| + KeyframeEffectReadOnly::kDefaultPriority, IsCustomPropertyHandle));
|
| + update.AdoptActiveInterpolationsForCustomAnimations(
|
| + active_interpolations_for_custom_animations);
|
| + ActiveInterpolationsMap active_interpolations_for_standard_animations(
|
| EffectStack::ActiveInterpolations(
|
| effect_stack, nullptr, nullptr,
|
| - KeyframeEffectReadOnly::kDefaultPriority, IsStylePropertyHandle));
|
| - update.AdoptActiveInterpolationsForAnimations(
|
| - active_interpolations_for_animations);
|
| + KeyframeEffectReadOnly::kDefaultPriority,
|
| + IsStandardPropertyHandle));
|
| + update.AdoptActiveInterpolationsForStandardAnimations(
|
| + active_interpolations_for_standard_animations);
|
| return;
|
| }
|
|
|
| @@ -972,29 +997,27 @@ void CSSAnimations::CalculateAnimationActiveInterpolations(
|
| for (const auto& updated_animation : update.AnimationsWithUpdates())
|
| new_effects.push_back(updated_animation.effect);
|
|
|
| - ActiveInterpolationsMap active_interpolations_for_animations(
|
| + ActiveInterpolationsMap active_interpolations_for_custom_animations(
|
| EffectStack::ActiveInterpolations(
|
| effect_stack, &new_effects, &update.SuppressedAnimations(),
|
| - KeyframeEffectReadOnly::kDefaultPriority, IsStylePropertyHandle));
|
| - update.AdoptActiveInterpolationsForAnimations(
|
| - active_interpolations_for_animations);
|
| -}
|
| -
|
| -static bool IsCustomStylePropertyHandle(const PropertyHandle& property) {
|
| - return property.IsCSSCustomProperty();
|
| -}
|
| -
|
| -static bool IsStandardStylePropertyHandle(const PropertyHandle& property) {
|
| - return IsStylePropertyHandle(property) && !property.IsCSSCustomProperty();
|
| + KeyframeEffectReadOnly::kDefaultPriority, IsCustomPropertyHandle));
|
| + update.AdoptActiveInterpolationsForCustomAnimations(
|
| + active_interpolations_for_custom_animations);
|
| + ActiveInterpolationsMap active_interpolations_for_standard_animations(
|
| + EffectStack::ActiveInterpolations(
|
| + effect_stack, &new_effects, &update.SuppressedAnimations(),
|
| + KeyframeEffectReadOnly::kDefaultPriority, IsStandardPropertyHandle));
|
| + update.AdoptActiveInterpolationsForStandardAnimations(
|
| + active_interpolations_for_standard_animations);
|
| }
|
|
|
| -static EffectStack::PropertyHandleFilter StylePropertyFilter(
|
| +static EffectStack::PropertyHandleFilter PropertyFilter(
|
| CSSAnimations::PropertyPass property_pass) {
|
| if (property_pass == CSSAnimations::PropertyPass::kCustom) {
|
| - return IsCustomStylePropertyHandle;
|
| + return IsCustomPropertyHandle;
|
| }
|
| DCHECK_EQ(property_pass, CSSAnimations::PropertyPass::kStandard);
|
| - return IsStandardStylePropertyHandle;
|
| + return IsStandardPropertyHandle;
|
| }
|
|
|
| void CSSAnimations::CalculateTransitionActiveInterpolations(
|
| @@ -1012,7 +1035,7 @@ void CSSAnimations::CalculateTransitionActiveInterpolations(
|
| active_interpolations_for_transitions = EffectStack::ActiveInterpolations(
|
| effect_stack, nullptr, nullptr,
|
| KeyframeEffectReadOnly::kTransitionPriority,
|
| - StylePropertyFilter(property_pass));
|
| + PropertyFilter(property_pass));
|
| } else {
|
| HeapVector<Member<const InertEffect>> new_transitions;
|
| for (const auto& entry : update.NewTransitions())
|
| @@ -1033,14 +1056,18 @@ void CSSAnimations::CalculateTransitionActiveInterpolations(
|
| active_interpolations_for_transitions = EffectStack::ActiveInterpolations(
|
| effect_stack, &new_transitions, &cancelled_animations,
|
| KeyframeEffectReadOnly::kTransitionPriority,
|
| - StylePropertyFilter(property_pass));
|
| + PropertyFilter(property_pass));
|
| }
|
|
|
| + const ActiveInterpolationsMap& animations =
|
| + property_pass == PropertyPass::kCustom
|
| + ? update.ActiveInterpolationsForCustomAnimations()
|
| + : update.ActiveInterpolationsForStandardAnimations();
|
| // Properties being animated by animations don't get values from transitions
|
| // applied.
|
| - if (!update.ActiveInterpolationsForAnimations().IsEmpty() &&
|
| + if (!animations.IsEmpty() &&
|
| !active_interpolations_for_transitions.IsEmpty()) {
|
| - for (const auto& entry : update.ActiveInterpolationsForAnimations())
|
| + for (const auto& entry : animations)
|
| active_interpolations_for_transitions.erase(entry.key);
|
| }
|
|
|
| @@ -1071,7 +1098,7 @@ void CSSAnimations::AnimationEventDelegate::MaybeDispatch(
|
| }
|
|
|
| bool CSSAnimations::AnimationEventDelegate::RequiresIterationEvents(
|
| - const AnimationEffectReadOnly& animation_node) {
|
| + const AnimationEffectReadOnly& animationNode) {
|
| return GetDocument().HasListenerType(Document::ANIMATIONITERATION_LISTENER);
|
| }
|
|
|
| @@ -1202,29 +1229,23 @@ bool CSSAnimations::IsAnimationAffectingProperty(CSSPropertyID property) {
|
| }
|
| }
|
|
|
| -bool CSSAnimations::IsAffectedByKeyframesFromScope(
|
| - const Element& element,
|
| - const TreeScope& tree_scope) {
|
| +bool CSSAnimations::IsAffectedByKeyframesFromScope(const Element& element,
|
| + const TreeScope& treeScope) {
|
| // Animated elements are affected by @keyframes rules from the same scope
|
| // and from their shadow sub-trees if they are shadow hosts.
|
| - if (element.GetTreeScope() == tree_scope)
|
| + if (element.GetTreeScope() == treeScope)
|
| return true;
|
| if (!IsShadowHost(element))
|
| return false;
|
| - if (tree_scope.RootNode() == tree_scope.GetDocument())
|
| + if (treeScope.RootNode() == treeScope.GetDocument())
|
| return false;
|
| - return ToShadowRoot(tree_scope.RootNode()).host() == element;
|
| -}
|
| -
|
| -bool CSSAnimations::IsCustomPropertyHandle(const PropertyHandle& property) {
|
| - return property.IsCSSProperty() &&
|
| - property.CssProperty() == CSSPropertyVariable;
|
| + return ToShadowRoot(treeScope.RootNode()).host() == element;
|
| }
|
|
|
| bool CSSAnimations::IsAnimatingCustomProperties(
|
| - const ElementAnimations* element_animations) {
|
| - return element_animations &&
|
| - element_animations->GetEffectStack().AffectsProperties(
|
| + const ElementAnimations* elementAnimations) {
|
| + return elementAnimations &&
|
| + elementAnimations->GetEffectStack().AffectsProperties(
|
| IsCustomPropertyHandle);
|
| }
|
|
|
|
|