| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 const ElementAnimations* element_animations = | 284 const ElementAnimations* element_animations = |
| 285 animating_element ? animating_element->GetElementAnimations() : nullptr; | 285 animating_element ? animating_element->GetElementAnimations() : nullptr; |
| 286 | 286 |
| 287 bool is_animation_style_change = | 287 bool is_animation_style_change = |
| 288 element_animations && element_animations->IsAnimationStyleChange(); | 288 element_animations && element_animations->IsAnimationStyleChange(); |
| 289 | 289 |
| 290 #if !DCHECK_IS_ON() | 290 #if !DCHECK_IS_ON() |
| 291 // If we're in an animation style change, no animations can have started, been | 291 // If we're in an animation style change, no animations can have started, been |
| 292 // cancelled or changed play state. When DCHECK is enabled, we verify this | 292 // cancelled or changed play state. When DCHECK is enabled, we verify this |
| 293 // optimization. | 293 // optimization. |
| 294 if (is_animation_style_change) { | 294 if (isAnimationStyleChange) { |
| 295 CalculateAnimationActiveInterpolations(update, animating_element); | 295 calculateAnimationActiveInterpolations(update, animatingElement); |
| 296 return; | 296 return; |
| 297 } | 297 } |
| 298 #endif | 298 #endif |
| 299 | 299 |
| 300 const CSSAnimationData* animation_data = style.Animations(); | 300 const CSSAnimationData* animation_data = style.Animations(); |
| 301 const CSSAnimations* css_animations = | 301 const CSSAnimations* css_animations = |
| 302 element_animations ? &element_animations->CssAnimations() : nullptr; | 302 element_animations ? &element_animations->CssAnimations() : nullptr; |
| 303 const Element* element_for_scoping = | 303 const Element* element_for_scoping = |
| 304 animating_element ? animating_element : &element; | 304 animating_element ? animating_element : &element; |
| 305 | 305 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 snapshot(new_animation.effect.Get()); | 426 snapshot(new_animation.effect.Get()); |
| 427 | 427 |
| 428 for (const auto& updated_animation : update.AnimationsWithUpdates()) | 428 for (const auto& updated_animation : update.AnimationsWithUpdates()) |
| 429 snapshot(updated_animation.effect.Get()); | 429 snapshot(updated_animation.effect.Get()); |
| 430 | 430 |
| 431 for (const auto& new_transition : update.NewTransitions()) | 431 for (const auto& new_transition : update.NewTransitions()) |
| 432 snapshot(new_transition.value.effect.Get()); | 432 snapshot(new_transition.value.effect.Get()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void CSSAnimations::MaybeApplyPendingUpdate(Element* element) { | 435 void CSSAnimations::MaybeApplyPendingUpdate(Element* element) { |
| 436 previous_active_interpolations_for_animations_.Clear(); | 436 previous_active_interpolations_for_custom_animations_.Clear(); |
| 437 previous_active_interpolations_for_standard_animations_.Clear(); |
| 437 if (pending_update_.IsEmpty()) | 438 if (pending_update_.IsEmpty()) |
| 438 return; | 439 return; |
| 439 | 440 |
| 440 previous_active_interpolations_for_animations_.Swap( | 441 previous_active_interpolations_for_custom_animations_.Swap( |
| 441 pending_update_.ActiveInterpolationsForAnimations()); | 442 pending_update_.ActiveInterpolationsForCustomAnimations()); |
| 443 previous_active_interpolations_for_standard_animations_.Swap( |
| 444 pending_update_.ActiveInterpolationsForStandardAnimations()); |
| 442 | 445 |
| 443 // FIXME: cancelling, pausing, unpausing animations all query | 446 // FIXME: cancelling, pausing, unpausing animations all query |
| 444 // compositingState, which is not necessarily up to date here | 447 // compositingState, which is not necessarily up to date here |
| 445 // since we call this from recalc style. | 448 // since we call this from recalc style. |
| 446 // https://code.google.com/p/chromium/issues/detail?id=339847 | 449 // https://code.google.com/p/chromium/issues/detail?id=339847 |
| 447 DisableCompositingQueryAsserts disabler; | 450 DisableCompositingQueryAsserts disabler; |
| 448 | 451 |
| 449 for (size_t paused_index : | 452 for (size_t paused_index : |
| 450 pending_update_.AnimationIndicesWithPauseToggled()) { | 453 pending_update_.AnimationIndicesWithPauseToggled()) { |
| 451 Animation& animation = *running_animations_[paused_index]->animation; | 454 Animation& animation = *running_animations_[paused_index]->animation; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 630 |
| 628 void CSSAnimations::CalculateTransitionUpdateForProperty( | 631 void CSSAnimations::CalculateTransitionUpdateForProperty( |
| 629 TransitionUpdateState& state, | 632 TransitionUpdateState& state, |
| 630 const PropertyHandle& property, | 633 const PropertyHandle& property, |
| 631 size_t transition_index) { | 634 size_t transition_index) { |
| 632 state.listed_properties.insert(property); | 635 state.listed_properties.insert(property); |
| 633 | 636 |
| 634 // FIXME: We should transition if an !important property changes even when an | 637 // FIXME: We should transition if an !important property changes even when an |
| 635 // animation is running, but this is a bit hard to do with the current | 638 // animation is running, but this is a bit hard to do with the current |
| 636 // applyMatchedProperties system. | 639 // applyMatchedProperties system. |
| 637 if (state.update.ActiveInterpolationsForAnimations().Contains(property) || | 640 if (property.IsCSSCustomProperty()) { |
| 638 (state.animating_element->GetElementAnimations() && | 641 if (state.update.ActiveInterpolationsForCustomAnimations().Contains( |
| 639 state.animating_element->GetElementAnimations() | 642 property) || |
| 640 ->CssAnimations() | 643 (state.animating_element->GetElementAnimations() && |
| 641 .previous_active_interpolations_for_animations_.Contains( | 644 state.animating_element->GetElementAnimations() |
| 642 property))) { | 645 ->CssAnimations() |
| 646 .previous_active_interpolations_for_custom_animations_.Contains( |
| 647 property))) { |
| 648 return; |
| 649 } |
| 650 } else if (state.update.ActiveInterpolationsForStandardAnimations().Contains( |
| 651 property) || |
| 652 (state.animating_element->GetElementAnimations() && |
| 653 state.animating_element->GetElementAnimations() |
| 654 ->CssAnimations() |
| 655 .previous_active_interpolations_for_standard_animations_ |
| 656 .Contains(property))) { |
| 643 return; | 657 return; |
| 644 } | 658 } |
| 645 | 659 |
| 646 RefPtr<AnimatableValue> to = nullptr; | 660 RefPtr<AnimatableValue> to = nullptr; |
| 647 const RunningTransition* interrupted_transition = nullptr; | 661 const RunningTransition* interrupted_transition = nullptr; |
| 648 if (state.active_transitions) { | 662 if (state.active_transitions) { |
| 649 TransitionMap::const_iterator active_transition_iter = | 663 TransitionMap::const_iterator active_transition_iter = |
| 650 state.active_transitions->Find(property); | 664 state.active_transitions->Find(property); |
| 651 if (active_transition_iter != state.active_transitions->end()) { | 665 if (active_transition_iter != state.active_transitions->end()) { |
| 652 const RunningTransition* running_transition = | 666 const RunningTransition* running_transition = |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 for (const auto& entry : transitions_) { | 940 for (const auto& entry : transitions_) { |
| 927 entry.value.animation->cancel(); | 941 entry.value.animation->cancel(); |
| 928 entry.value.animation->Update(kTimingUpdateOnDemand); | 942 entry.value.animation->Update(kTimingUpdateOnDemand); |
| 929 } | 943 } |
| 930 | 944 |
| 931 running_animations_.Clear(); | 945 running_animations_.Clear(); |
| 932 transitions_.Clear(); | 946 transitions_.Clear(); |
| 933 ClearPendingUpdate(); | 947 ClearPendingUpdate(); |
| 934 } | 948 } |
| 935 | 949 |
| 950 static bool IsCustomPropertyHandle(const PropertyHandle& property) { |
| 951 return property.IsCSSCustomProperty(); |
| 952 } |
| 953 |
| 936 // TODO(alancutter): CSS properties and presentation attributes may have | 954 // TODO(alancutter): CSS properties and presentation attributes may have |
| 937 // identical effects. By grouping them in the same set we introduce a bug where | 955 // identical effects. By grouping them in the same set we introduce a bug where |
| 938 // arbitrary hash iteration will determine the order the apply in and thus which | 956 // arbitrary hash iteration will determine the order the apply in and thus which |
| 939 // one "wins". We should be more deliberate about the order of application in | 957 // one "wins". We should be more deliberate about the order of application in |
| 940 // the case of effect collisions. | 958 // the case of effect collisions. |
| 941 // Example: Both 'color' and 'svg-color' set the color on ComputedStyle but are | 959 // Example: Both 'color' and 'svg-color' set the color on ComputedStyle but are |
| 942 // considered distinct properties in the ActiveInterpolationsMap. | 960 // considered distinct properties in the ActiveInterpolationsMap. |
| 943 static bool IsStylePropertyHandle(const PropertyHandle& property_handle) { | 961 static bool IsStandardPropertyHandle(const PropertyHandle& property) { |
| 944 return property_handle.IsCSSProperty() || | 962 return (property.IsCSSProperty() && !property.IsCSSCustomProperty()) || |
| 945 property_handle.IsPresentationAttribute(); | 963 property.IsPresentationAttribute(); |
| 946 } | 964 } |
| 947 | 965 |
| 948 void CSSAnimations::CalculateAnimationActiveInterpolations( | 966 void CSSAnimations::CalculateAnimationActiveInterpolations( |
| 949 CSSAnimationUpdate& update, | 967 CSSAnimationUpdate& update, |
| 950 const Element* animating_element) { | 968 const Element* animating_element) { |
| 951 ElementAnimations* element_animations = | 969 ElementAnimations* element_animations = |
| 952 animating_element ? animating_element->GetElementAnimations() : nullptr; | 970 animating_element ? animating_element->GetElementAnimations() : nullptr; |
| 953 EffectStack* effect_stack = | 971 EffectStack* effect_stack = |
| 954 element_animations ? &element_animations->GetEffectStack() : nullptr; | 972 element_animations ? &element_animations->GetEffectStack() : nullptr; |
| 955 | 973 |
| 956 if (update.NewAnimations().IsEmpty() && | 974 if (update.NewAnimations().IsEmpty() && |
| 957 update.SuppressedAnimations().IsEmpty()) { | 975 update.SuppressedAnimations().IsEmpty()) { |
| 958 ActiveInterpolationsMap active_interpolations_for_animations( | 976 ActiveInterpolationsMap active_interpolations_for_custom_animations( |
| 959 EffectStack::ActiveInterpolations( | 977 EffectStack::ActiveInterpolations( |
| 960 effect_stack, nullptr, nullptr, | 978 effect_stack, nullptr, nullptr, |
| 961 KeyframeEffectReadOnly::kDefaultPriority, IsStylePropertyHandle)); | 979 KeyframeEffectReadOnly::kDefaultPriority, IsCustomPropertyHandle)); |
| 962 update.AdoptActiveInterpolationsForAnimations( | 980 update.AdoptActiveInterpolationsForCustomAnimations( |
| 963 active_interpolations_for_animations); | 981 active_interpolations_for_custom_animations); |
| 982 ActiveInterpolationsMap active_interpolations_for_standard_animations( |
| 983 EffectStack::ActiveInterpolations( |
| 984 effect_stack, nullptr, nullptr, |
| 985 KeyframeEffectReadOnly::kDefaultPriority, |
| 986 IsStandardPropertyHandle)); |
| 987 update.AdoptActiveInterpolationsForStandardAnimations( |
| 988 active_interpolations_for_standard_animations); |
| 964 return; | 989 return; |
| 965 } | 990 } |
| 966 | 991 |
| 967 HeapVector<Member<const InertEffect>> new_effects; | 992 HeapVector<Member<const InertEffect>> new_effects; |
| 968 for (const auto& new_animation : update.NewAnimations()) | 993 for (const auto& new_animation : update.NewAnimations()) |
| 969 new_effects.push_back(new_animation.effect); | 994 new_effects.push_back(new_animation.effect); |
| 970 | 995 |
| 971 // Animations with updates use a temporary InertEffect for the current frame. | 996 // Animations with updates use a temporary InertEffect for the current frame. |
| 972 for (const auto& updated_animation : update.AnimationsWithUpdates()) | 997 for (const auto& updated_animation : update.AnimationsWithUpdates()) |
| 973 new_effects.push_back(updated_animation.effect); | 998 new_effects.push_back(updated_animation.effect); |
| 974 | 999 |
| 975 ActiveInterpolationsMap active_interpolations_for_animations( | 1000 ActiveInterpolationsMap active_interpolations_for_custom_animations( |
| 976 EffectStack::ActiveInterpolations( | 1001 EffectStack::ActiveInterpolations( |
| 977 effect_stack, &new_effects, &update.SuppressedAnimations(), | 1002 effect_stack, &new_effects, &update.SuppressedAnimations(), |
| 978 KeyframeEffectReadOnly::kDefaultPriority, IsStylePropertyHandle)); | 1003 KeyframeEffectReadOnly::kDefaultPriority, IsCustomPropertyHandle)); |
| 979 update.AdoptActiveInterpolationsForAnimations( | 1004 update.AdoptActiveInterpolationsForCustomAnimations( |
| 980 active_interpolations_for_animations); | 1005 active_interpolations_for_custom_animations); |
| 1006 ActiveInterpolationsMap active_interpolations_for_standard_animations( |
| 1007 EffectStack::ActiveInterpolations( |
| 1008 effect_stack, &new_effects, &update.SuppressedAnimations(), |
| 1009 KeyframeEffectReadOnly::kDefaultPriority, IsStandardPropertyHandle)); |
| 1010 update.AdoptActiveInterpolationsForStandardAnimations( |
| 1011 active_interpolations_for_standard_animations); |
| 981 } | 1012 } |
| 982 | 1013 |
| 983 static bool IsCustomStylePropertyHandle(const PropertyHandle& property) { | 1014 static EffectStack::PropertyHandleFilter PropertyFilter( |
| 984 return property.IsCSSCustomProperty(); | |
| 985 } | |
| 986 | |
| 987 static bool IsStandardStylePropertyHandle(const PropertyHandle& property) { | |
| 988 return IsStylePropertyHandle(property) && !property.IsCSSCustomProperty(); | |
| 989 } | |
| 990 | |
| 991 static EffectStack::PropertyHandleFilter StylePropertyFilter( | |
| 992 CSSAnimations::PropertyPass property_pass) { | 1015 CSSAnimations::PropertyPass property_pass) { |
| 993 if (property_pass == CSSAnimations::PropertyPass::kCustom) { | 1016 if (property_pass == CSSAnimations::PropertyPass::kCustom) { |
| 994 return IsCustomStylePropertyHandle; | 1017 return IsCustomPropertyHandle; |
| 995 } | 1018 } |
| 996 DCHECK_EQ(property_pass, CSSAnimations::PropertyPass::kStandard); | 1019 DCHECK_EQ(property_pass, CSSAnimations::PropertyPass::kStandard); |
| 997 return IsStandardStylePropertyHandle; | 1020 return IsStandardPropertyHandle; |
| 998 } | 1021 } |
| 999 | 1022 |
| 1000 void CSSAnimations::CalculateTransitionActiveInterpolations( | 1023 void CSSAnimations::CalculateTransitionActiveInterpolations( |
| 1001 CSSAnimationUpdate& update, | 1024 CSSAnimationUpdate& update, |
| 1002 PropertyPass property_pass, | 1025 PropertyPass property_pass, |
| 1003 const Element* animating_element) { | 1026 const Element* animating_element) { |
| 1004 ElementAnimations* element_animations = | 1027 ElementAnimations* element_animations = |
| 1005 animating_element ? animating_element->GetElementAnimations() : nullptr; | 1028 animating_element ? animating_element->GetElementAnimations() : nullptr; |
| 1006 EffectStack* effect_stack = | 1029 EffectStack* effect_stack = |
| 1007 element_animations ? &element_animations->GetEffectStack() : nullptr; | 1030 element_animations ? &element_animations->GetEffectStack() : nullptr; |
| 1008 | 1031 |
| 1009 ActiveInterpolationsMap active_interpolations_for_transitions; | 1032 ActiveInterpolationsMap active_interpolations_for_transitions; |
| 1010 if (update.NewTransitions().IsEmpty() && | 1033 if (update.NewTransitions().IsEmpty() && |
| 1011 update.CancelledTransitions().IsEmpty()) { | 1034 update.CancelledTransitions().IsEmpty()) { |
| 1012 active_interpolations_for_transitions = EffectStack::ActiveInterpolations( | 1035 active_interpolations_for_transitions = EffectStack::ActiveInterpolations( |
| 1013 effect_stack, nullptr, nullptr, | 1036 effect_stack, nullptr, nullptr, |
| 1014 KeyframeEffectReadOnly::kTransitionPriority, | 1037 KeyframeEffectReadOnly::kTransitionPriority, |
| 1015 StylePropertyFilter(property_pass)); | 1038 PropertyFilter(property_pass)); |
| 1016 } else { | 1039 } else { |
| 1017 HeapVector<Member<const InertEffect>> new_transitions; | 1040 HeapVector<Member<const InertEffect>> new_transitions; |
| 1018 for (const auto& entry : update.NewTransitions()) | 1041 for (const auto& entry : update.NewTransitions()) |
| 1019 new_transitions.push_back(entry.value.effect.Get()); | 1042 new_transitions.push_back(entry.value.effect.Get()); |
| 1020 | 1043 |
| 1021 HeapHashSet<Member<const Animation>> cancelled_animations; | 1044 HeapHashSet<Member<const Animation>> cancelled_animations; |
| 1022 if (!update.CancelledTransitions().IsEmpty()) { | 1045 if (!update.CancelledTransitions().IsEmpty()) { |
| 1023 DCHECK(element_animations); | 1046 DCHECK(element_animations); |
| 1024 const TransitionMap& transition_map = | 1047 const TransitionMap& transition_map = |
| 1025 element_animations->CssAnimations().transitions_; | 1048 element_animations->CssAnimations().transitions_; |
| 1026 for (const PropertyHandle& property : update.CancelledTransitions()) { | 1049 for (const PropertyHandle& property : update.CancelledTransitions()) { |
| 1027 DCHECK(transition_map.Contains(property)); | 1050 DCHECK(transition_map.Contains(property)); |
| 1028 cancelled_animations.insert( | 1051 cancelled_animations.insert( |
| 1029 transition_map.at(property).animation.Get()); | 1052 transition_map.at(property).animation.Get()); |
| 1030 } | 1053 } |
| 1031 } | 1054 } |
| 1032 | 1055 |
| 1033 active_interpolations_for_transitions = EffectStack::ActiveInterpolations( | 1056 active_interpolations_for_transitions = EffectStack::ActiveInterpolations( |
| 1034 effect_stack, &new_transitions, &cancelled_animations, | 1057 effect_stack, &new_transitions, &cancelled_animations, |
| 1035 KeyframeEffectReadOnly::kTransitionPriority, | 1058 KeyframeEffectReadOnly::kTransitionPriority, |
| 1036 StylePropertyFilter(property_pass)); | 1059 PropertyFilter(property_pass)); |
| 1037 } | 1060 } |
| 1038 | 1061 |
| 1062 const ActiveInterpolationsMap& animations = |
| 1063 property_pass == PropertyPass::kCustom |
| 1064 ? update.ActiveInterpolationsForCustomAnimations() |
| 1065 : update.ActiveInterpolationsForStandardAnimations(); |
| 1039 // Properties being animated by animations don't get values from transitions | 1066 // Properties being animated by animations don't get values from transitions |
| 1040 // applied. | 1067 // applied. |
| 1041 if (!update.ActiveInterpolationsForAnimations().IsEmpty() && | 1068 if (!animations.IsEmpty() && |
| 1042 !active_interpolations_for_transitions.IsEmpty()) { | 1069 !active_interpolations_for_transitions.IsEmpty()) { |
| 1043 for (const auto& entry : update.ActiveInterpolationsForAnimations()) | 1070 for (const auto& entry : animations) |
| 1044 active_interpolations_for_transitions.erase(entry.key); | 1071 active_interpolations_for_transitions.erase(entry.key); |
| 1045 } | 1072 } |
| 1046 | 1073 |
| 1047 if (property_pass == PropertyPass::kCustom) { | 1074 if (property_pass == PropertyPass::kCustom) { |
| 1048 update.AdoptActiveInterpolationsForCustomTransitions( | 1075 update.AdoptActiveInterpolationsForCustomTransitions( |
| 1049 active_interpolations_for_transitions); | 1076 active_interpolations_for_transitions); |
| 1050 } else { | 1077 } else { |
| 1051 DCHECK_EQ(property_pass, PropertyPass::kStandard); | 1078 DCHECK_EQ(property_pass, PropertyPass::kStandard); |
| 1052 update.AdoptActiveInterpolationsForStandardTransitions( | 1079 update.AdoptActiveInterpolationsForStandardTransitions( |
| 1053 active_interpolations_for_transitions); | 1080 active_interpolations_for_transitions); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1064 double elapsed_time) { | 1091 double elapsed_time) { |
| 1065 if (animation_target_->GetDocument().HasListenerType(listener_type)) { | 1092 if (animation_target_->GetDocument().HasListenerType(listener_type)) { |
| 1066 AnimationEvent* event = | 1093 AnimationEvent* event = |
| 1067 AnimationEvent::Create(event_name, name_, elapsed_time); | 1094 AnimationEvent::Create(event_name, name_, elapsed_time); |
| 1068 event->SetTarget(GetEventTarget()); | 1095 event->SetTarget(GetEventTarget()); |
| 1069 GetDocument().EnqueueAnimationFrameEvent(event); | 1096 GetDocument().EnqueueAnimationFrameEvent(event); |
| 1070 } | 1097 } |
| 1071 } | 1098 } |
| 1072 | 1099 |
| 1073 bool CSSAnimations::AnimationEventDelegate::RequiresIterationEvents( | 1100 bool CSSAnimations::AnimationEventDelegate::RequiresIterationEvents( |
| 1074 const AnimationEffectReadOnly& animation_node) { | 1101 const AnimationEffectReadOnly& animationNode) { |
| 1075 return GetDocument().HasListenerType(Document::ANIMATIONITERATION_LISTENER); | 1102 return GetDocument().HasListenerType(Document::ANIMATIONITERATION_LISTENER); |
| 1076 } | 1103 } |
| 1077 | 1104 |
| 1078 void CSSAnimations::AnimationEventDelegate::OnEventCondition( | 1105 void CSSAnimations::AnimationEventDelegate::OnEventCondition( |
| 1079 const AnimationEffectReadOnly& animation_node) { | 1106 const AnimationEffectReadOnly& animation_node) { |
| 1080 const AnimationEffectReadOnly::Phase current_phase = | 1107 const AnimationEffectReadOnly::Phase current_phase = |
| 1081 animation_node.GetPhase(); | 1108 animation_node.GetPhase(); |
| 1082 const double current_iteration = animation_node.CurrentIteration(); | 1109 const double current_iteration = animation_node.CurrentIteration(); |
| 1083 | 1110 |
| 1084 if (previous_phase_ != current_phase && | 1111 if (previous_phase_ != current_phase && |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 case CSSPropertyTransitionDelay: | 1222 case CSSPropertyTransitionDelay: |
| 1196 case CSSPropertyTransitionDuration: | 1223 case CSSPropertyTransitionDuration: |
| 1197 case CSSPropertyTransitionProperty: | 1224 case CSSPropertyTransitionProperty: |
| 1198 case CSSPropertyTransitionTimingFunction: | 1225 case CSSPropertyTransitionTimingFunction: |
| 1199 return true; | 1226 return true; |
| 1200 default: | 1227 default: |
| 1201 return false; | 1228 return false; |
| 1202 } | 1229 } |
| 1203 } | 1230 } |
| 1204 | 1231 |
| 1205 bool CSSAnimations::IsAffectedByKeyframesFromScope( | 1232 bool CSSAnimations::IsAffectedByKeyframesFromScope(const Element& element, |
| 1206 const Element& element, | 1233 const TreeScope& treeScope) { |
| 1207 const TreeScope& tree_scope) { | |
| 1208 // Animated elements are affected by @keyframes rules from the same scope | 1234 // Animated elements are affected by @keyframes rules from the same scope |
| 1209 // and from their shadow sub-trees if they are shadow hosts. | 1235 // and from their shadow sub-trees if they are shadow hosts. |
| 1210 if (element.GetTreeScope() == tree_scope) | 1236 if (element.GetTreeScope() == treeScope) |
| 1211 return true; | 1237 return true; |
| 1212 if (!IsShadowHost(element)) | 1238 if (!IsShadowHost(element)) |
| 1213 return false; | 1239 return false; |
| 1214 if (tree_scope.RootNode() == tree_scope.GetDocument()) | 1240 if (treeScope.RootNode() == treeScope.GetDocument()) |
| 1215 return false; | 1241 return false; |
| 1216 return ToShadowRoot(tree_scope.RootNode()).host() == element; | 1242 return ToShadowRoot(treeScope.RootNode()).host() == element; |
| 1217 } | |
| 1218 | |
| 1219 bool CSSAnimations::IsCustomPropertyHandle(const PropertyHandle& property) { | |
| 1220 return property.IsCSSProperty() && | |
| 1221 property.CssProperty() == CSSPropertyVariable; | |
| 1222 } | 1243 } |
| 1223 | 1244 |
| 1224 bool CSSAnimations::IsAnimatingCustomProperties( | 1245 bool CSSAnimations::IsAnimatingCustomProperties( |
| 1225 const ElementAnimations* element_animations) { | 1246 const ElementAnimations* elementAnimations) { |
| 1226 return element_animations && | 1247 return elementAnimations && |
| 1227 element_animations->GetEffectStack().AffectsProperties( | 1248 elementAnimations->GetEffectStack().AffectsProperties( |
| 1228 IsCustomPropertyHandle); | 1249 IsCustomPropertyHandle); |
| 1229 } | 1250 } |
| 1230 | 1251 |
| 1231 DEFINE_TRACE(CSSAnimations) { | 1252 DEFINE_TRACE(CSSAnimations) { |
| 1232 visitor->Trace(transitions_); | 1253 visitor->Trace(transitions_); |
| 1233 visitor->Trace(pending_update_); | 1254 visitor->Trace(pending_update_); |
| 1234 visitor->Trace(running_animations_); | 1255 visitor->Trace(running_animations_); |
| 1235 } | 1256 } |
| 1236 | 1257 |
| 1237 } // namespace blink | 1258 } // namespace blink |
| OLD | NEW |