Title: [230594] trunk
Revision
230594
Author
grao...@webkit.org
Date
2018-04-12 14:23:48 -0700 (Thu, 12 Apr 2018)

Log Message

[Web Animations] Only cancel declarative animations upon element removal
https://bugs.webkit.org/show_bug.cgi?id=184553

Reviewed by Dean Jackson.

LayoutTests/imported/w3c:

Make some WPT tests opt into the CSS Animations and CSS Transtions as Web Animations flag.

* web-platform-tests/web-animations/interfaces/Animation/ready.html:
* web-platform-tests/web-animations/timing-model/animations/playing-an-animation.html:
* web-platform-tests/web-animations/timing-model/animations/reversing-an-animation.html:

Source/WebCore:

Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
the ready promise and produce spurious logging from WPT tests.

* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
(WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
* animation/AnimationTimeline.h:
* dom/Element.cpp:
(WebCore::Element::removedFromAncestor):
* dom/PseudoElement.cpp:
(WebCore::PseudoElement::clearHostElement):
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (230593 => 230594)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1,3 +1,16 @@
+2018-04-12  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Only cancel declarative animations upon element removal
+        https://bugs.webkit.org/show_bug.cgi?id=184553
+
+        Reviewed by Dean Jackson.
+
+        Make some WPT tests opt into the CSS Animations and CSS Transtions as Web Animations flag.
+
+        * web-platform-tests/web-animations/interfaces/Animation/ready.html:
+        * web-platform-tests/web-animations/timing-model/animations/playing-an-animation.html:
+        * web-platform-tests/web-animations/timing-model/animations/reversing-an-animation.html:
+
 2018-04-11  Antoine Quint  <grao...@apple.com>
 
         [Web Animations] Enable seeking for hardware animations

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html (230593 => 230594)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/interfaces/Animation/ready.html	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <meta charset=utf-8>
 <title>Animation.ready</title>
 <link rel="help" href=""

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/playing-an-animation.html (230593 => 230594)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/playing-an-animation.html	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/playing-an-animation.html	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <meta charset=utf-8>
 <title>Playing an animation</title>
 <link rel="help"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/reversing-an-animation.html (230593 => 230594)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/reversing-an-animation.html	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/reversing-an-animation.html	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <meta charset=utf-8>
 <title>Reverse an animation</title>
 <link rel="help"

Modified: trunk/Source/WebCore/ChangeLog (230593 => 230594)


--- trunk/Source/WebCore/ChangeLog	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/ChangeLog	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1,3 +1,24 @@
+2018-04-12  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Only cancel declarative animations upon element removal
+        https://bugs.webkit.org/show_bug.cgi?id=184553
+
+        Reviewed by Dean Jackson.
+
+        Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
+        the ready promise and produce spurious logging from WPT tests.
+
+        * animation/AnimationTimeline.cpp:
+        (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
+        (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
+        * animation/AnimationTimeline.h:
+        * dom/Element.cpp:
+        (WebCore::Element::removedFromAncestor):
+        * dom/PseudoElement.cpp:
+        (WebCore::PseudoElement::clearHostElement):
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::tearDownRenderers):
+
 2018-04-12  Ryan Haddad  <ryanhad...@apple.com>
 
         Unreviewed, rolling out r230554.

Modified: trunk/Source/WebCore/animation/AnimationTimeline.cpp (230593 => 230594)


--- trunk/Source/WebCore/animation/AnimationTimeline.cpp	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/animation/AnimationTimeline.cpp	2018-04-12 21:23:48 UTC (rev 230594)
@@ -127,10 +127,12 @@
     return animations;
 }
 
-void AnimationTimeline::cancelAnimationsForElement(Element& element)
+void AnimationTimeline::cancelDeclarativeAnimationsForElement(Element& element)
 {
-    for (const auto& animation : animationsForElement(element))
-        animation->cancel();
+    for (const auto& animation : animationsForElement(element)) {
+        if (is<DeclarativeAnimation>(animation))
+            animation->cancel();
+    }
 }
 
 void AnimationTimeline::updateCSSAnimationsForElement(Element& element, const RenderStyle& newStyle, const RenderStyle* oldStyle)

Modified: trunk/Source/WebCore/animation/AnimationTimeline.h (230593 => 230594)


--- trunk/Source/WebCore/animation/AnimationTimeline.h	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/animation/AnimationTimeline.h	2018-04-12 21:23:48 UTC (rev 230594)
@@ -59,7 +59,7 @@
 
     const ListHashSet<RefPtr<WebAnimation>>& animations() const { return m_animations; }
     Vector<RefPtr<WebAnimation>> animationsForElement(Element&) const;
-    void cancelAnimationsForElement(Element&);
+    void cancelDeclarativeAnimationsForElement(Element&);
     void animationWasAddedToElement(WebAnimation&, Element&);
     void animationWasRemovedFromElement(WebAnimation&, Element&);
 

Modified: trunk/Source/WebCore/dom/Element.cpp (230593 => 230594)


--- trunk/Source/WebCore/dom/Element.cpp	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/dom/Element.cpp	2018-04-12 21:23:48 UTC (rev 230594)
@@ -1797,7 +1797,7 @@
     RefPtr<Frame> frame = document().frame();
     if (RuntimeEnabledFeatures::sharedFeatures().cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled()) {
         if (auto* timeline = document().existingTimeline())
-            timeline->cancelAnimationsForElement(*this);
+            timeline->cancelDeclarativeAnimationsForElement(*this);
     } else if (frame)
         frame->animation().cancelAnimations(*this);
 

Modified: trunk/Source/WebCore/dom/PseudoElement.cpp (230593 => 230594)


--- trunk/Source/WebCore/dom/PseudoElement.cpp	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/dom/PseudoElement.cpp	2018-04-12 21:23:48 UTC (rev 230594)
@@ -92,7 +92,7 @@
 
     if (RuntimeEnabledFeatures::sharedFeatures().cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled()) {
         if (auto* timeline = document().existingTimeline())
-            timeline->cancelAnimationsForElement(*this);
+            timeline->cancelDeclarativeAnimationsForElement(*this);
     } else if (auto* frame = document().frame())
         frame->animation().cancelAnimations(*this);
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (230593 => 230594)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2018-04-12 20:48:09 UTC (rev 230593)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2018-04-12 21:23:48 UTC (rev 230594)
@@ -555,7 +555,7 @@
             if (teardownType == TeardownType::Full || teardownType == TeardownType::RendererUpdateCancelingAnimations) {
                 if (RuntimeEnabledFeatures::sharedFeatures().cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled()) {
                     if (timeline)
-                        timeline->cancelAnimationsForElement(element);
+                        timeline->cancelDeclarativeAnimationsForElement(element);
                 } else
                     animationController.cancelAnimations(element);
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to