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 18 matching lines...) Expand all Loading... | |
29 */ | 29 */ |
30 | 30 |
31 #include "core/animation/Animation.h" | 31 #include "core/animation/Animation.h" |
32 | 32 |
33 #include "core/animation/AnimationTimeline.h" | 33 #include "core/animation/AnimationTimeline.h" |
34 #include "core/animation/CompositorPendingAnimations.h" | 34 #include "core/animation/CompositorPendingAnimations.h" |
35 #include "core/animation/KeyframeEffect.h" | 35 #include "core/animation/KeyframeEffect.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/dom/ExceptionCode.h" | 37 #include "core/dom/ExceptionCode.h" |
38 #include "core/dom/StyleChangeReason.h" | 38 #include "core/dom/StyleChangeReason.h" |
39 #include "core/dom/shadow/ShadowRoot.h" | |
39 #include "core/events/AnimationPlaybackEvent.h" | 40 #include "core/events/AnimationPlaybackEvent.h" |
40 #include "core/frame/UseCounter.h" | 41 #include "core/frame/UseCounter.h" |
41 #include "core/inspector/InspectorInstrumentation.h" | 42 #include "core/inspector/InspectorInstrumentation.h" |
42 #include "core/inspector/InspectorTraceEvents.h" | 43 #include "core/inspector/InspectorTraceEvents.h" |
43 #include "platform/RuntimeEnabledFeatures.h" | 44 #include "platform/RuntimeEnabledFeatures.h" |
44 #include "platform/TraceEvent.h" | 45 #include "platform/TraceEvent.h" |
45 #include "platform/animation/CompositorAnimationPlayer.h" | 46 #include "platform/animation/CompositorAnimationPlayer.h" |
46 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
47 #include "public/platform/WebCompositorSupport.h" | 48 #include "public/platform/WebCompositorSupport.h" |
48 #include "wtf/MathExtras.h" | 49 #include "wtf/MathExtras.h" |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1079 if (suppressed) | 1080 if (suppressed) |
1080 cancelAnimationOnCompositor(); | 1081 cancelAnimationOnCompositor(); |
1081 } | 1082 } |
1082 | 1083 |
1083 void Animation::disableCompositedAnimationForTesting() | 1084 void Animation::disableCompositedAnimationForTesting() |
1084 { | 1085 { |
1085 m_isCompositedAnimationDisabledForTesting = true; | 1086 m_isCompositedAnimationDisabledForTesting = true; |
1086 cancelAnimationOnCompositor(); | 1087 cancelAnimationOnCompositor(); |
1087 } | 1088 } |
1088 | 1089 |
1089 void Animation::invalidateKeyframeEffect() | 1090 static bool isAffectedByKeyframesFromScope(const Element& element, const TreeSco pe& treeScope) |
1091 { | |
1092 // Animated elements are affected by @keyframes rules from the same scope | |
1093 // and from their shadow sub-trees if they are shadow hosts. | |
1094 if (element.treeScope() == treeScope) | |
1095 return true; | |
1096 if (!isShadowHost(element)) | |
1097 return false; | |
1098 if (treeScope.rootNode() == treeScope.document()) | |
1099 return false; | |
1100 return toShadowRoot(treeScope.rootNode()).host() == element; | |
1101 } | |
alancutter (OOO until 2018)
2016/09/27 06:49:50
Nit: Move this static method to core/animation/css
rune
2016/09/28 21:35:57
Did you mean like patch set 4?
| |
1102 | |
1103 void Animation::invalidateKeyframeEffect(const TreeScope& treeScope) | |
1090 { | 1104 { |
1091 if (!m_content || !m_content->isKeyframeEffect()) | 1105 if (!m_content || !m_content->isKeyframeEffect()) |
1092 return; | 1106 return; |
1093 | 1107 |
1094 toKeyframeEffect(m_content.get())->target()->setNeedsStyleRecalc(LocalStyleC hange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange)) ; | 1108 Element& target = *toKeyframeEffect(m_content.get())->target(); |
1109 | |
1110 if (isAffectedByKeyframesFromScope(target, treeScope)) | |
1111 target.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing ::create(StyleChangeReason::StyleSheetChange)); | |
1095 } | 1112 } |
1096 | 1113 |
1097 DEFINE_TRACE(Animation) | 1114 DEFINE_TRACE(Animation) |
1098 { | 1115 { |
1099 visitor->trace(m_content); | 1116 visitor->trace(m_content); |
1100 visitor->trace(m_timeline); | 1117 visitor->trace(m_timeline); |
1101 visitor->trace(m_pendingFinishedEvent); | 1118 visitor->trace(m_pendingFinishedEvent); |
1102 visitor->trace(m_pendingCancelledEvent); | 1119 visitor->trace(m_pendingCancelledEvent); |
1103 visitor->trace(m_finishedPromise); | 1120 visitor->trace(m_finishedPromise); |
1104 visitor->trace(m_readyPromise); | 1121 visitor->trace(m_readyPromise); |
1105 EventTargetWithInlineData::trace(visitor); | 1122 EventTargetWithInlineData::trace(visitor); |
1106 ActiveDOMObject::trace(visitor); | 1123 ActiveDOMObject::trace(visitor); |
1107 } | 1124 } |
1108 | 1125 |
1109 } // namespace blink | 1126 } // namespace blink |
OLD | NEW |