Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 7f381978a9a9c09bdf91da623a831f7d4f3fc282..32bd9d530b0b694edbadca19d12e01bcd13f2114 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -210,6 +210,11 @@ Element::~Element() |
data->setPseudoElement(AFTER, 0); |
data->setPseudoElement(BACKDROP, 0); |
data->clearShadow(); |
+ |
+ if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { |
+ if (ActiveAnimations* activeAnimations = data->activeAnimations()) |
+ activeAnimations->cssAnimations()->cancel(); |
+ } |
} |
if (isCustomElement()) |
@@ -1367,6 +1372,11 @@ void Element::detach(const AttachContext& context) |
data->resetComputedStyle(); |
data->resetDynamicRestyleObservations(); |
data->setIsInsideRegion(false); |
+ |
+ if (RuntimeEnabledFeatures::webAnimationsCSSEnabled() && !context.performingReattach) { |
+ if (ActiveAnimations* activeAnimations = data->activeAnimations()) |
+ activeAnimations->cssAnimations()->cancel(); |
+ } |
} |
if (ElementShadow* shadow = this->shadow()) |
shadow->detach(context); |