Title: [275280] trunk/Source/WebCore
Revision
275280
Author
[email protected]
Date
2021-03-31 08:38:00 -0700 (Wed, 31 Mar 2021)

Log Message

Remove the Silently argument to WebAnimation::cancel()
https://bugs.webkit.org/show_bug.cgi?id=223992

Reviewed by Frédéric Wang.

The recent commit r275228 removed the use of the Silently argument in
AnimationTimeline::cancelDeclarativeAnimationsForStyleable(), which
was the only function that would eventually call into WebAnimation::cancel()
with a value other than the default, Silently::No.

So we remove that argument to WebAnimation::cancel(), its call sites and
WebAnimation::resetPendingTasks() which was called from it.

And since the Silently enum is no longer used outside of WebAnimation.cpp,
we move it to be private.

* animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::elementWasRemoved):
(WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable):
* animation/AnimationTimeline.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::cancel):
* animation/DeclarativeAnimation.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::cancel):
(WebCore::WebAnimation::resetPendingTasks):
* animation/WebAnimation.h:
* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::tearDownRenderers):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275279 => 275280)


--- trunk/Source/WebCore/ChangeLog	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/ChangeLog	2021-03-31 15:38:00 UTC (rev 275280)
@@ -1,3 +1,35 @@
+2021-03-31  Antoine Quint  <[email protected]>
+
+        Remove the Silently argument to WebAnimation::cancel()
+        https://bugs.webkit.org/show_bug.cgi?id=223992
+
+        Reviewed by Frédéric Wang.
+
+        The recent commit r275228 removed the use of the Silently argument in
+        AnimationTimeline::cancelDeclarativeAnimationsForStyleable(), which
+        was the only function that would eventually call into WebAnimation::cancel()
+        with a value other than the default, Silently::No.
+
+        So we remove that argument to WebAnimation::cancel(), its call sites and
+        WebAnimation::resetPendingTasks() which was called from it.
+
+        And since the Silently enum is no longer used outside of WebAnimation.cpp,
+        we move it to be private.
+
+        * animation/AnimationTimeline.cpp:
+        (WebCore::AnimationTimeline::elementWasRemoved):
+        (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForStyleable):
+        * animation/AnimationTimeline.h:
+        * animation/DeclarativeAnimation.cpp:
+        (WebCore::DeclarativeAnimation::cancel):
+        * animation/DeclarativeAnimation.h:
+        * animation/WebAnimation.cpp:
+        (WebCore::WebAnimation::cancel):
+        (WebCore::WebAnimation::resetPendingTasks):
+        * animation/WebAnimation.h:
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::tearDownRenderers):
+
 2021-03-31  Antti Koivisto  <[email protected]>
 
         Use :is() instead of :matches() on UA stylesheet

Modified: trunk/Source/WebCore/animation/AnimationTimeline.cpp (275279 => 275280)


--- trunk/Source/WebCore/animation/AnimationTimeline.cpp	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/AnimationTimeline.cpp	2021-03-31 15:38:00 UTC (rev 275280)
@@ -159,7 +159,7 @@
 
 void AnimationTimeline::elementWasRemoved(const Styleable& styleable)
 {
-    cancelDeclarativeAnimationsForStyleable(styleable, WebAnimation::Silently::Yes);
+    cancelDeclarativeAnimationsForStyleable(styleable);
 }
 
 void AnimationTimeline::willChangeRendererForStyleable(const Styleable& styleable)
@@ -170,7 +170,7 @@
     }
 }
 
-void AnimationTimeline::cancelDeclarativeAnimationsForStyleable(const Styleable& styleable, WebAnimation::Silently)
+void AnimationTimeline::cancelDeclarativeAnimationsForStyleable(const Styleable& styleable)
 {
     if (auto* animations = styleable.animations()) {
         for (auto& animation : *animations) {

Modified: trunk/Source/WebCore/animation/AnimationTimeline.h (275279 => 275280)


--- trunk/Source/WebCore/animation/AnimationTimeline.h	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/AnimationTimeline.h	2021-03-31 15:38:00 UTC (rev 275280)
@@ -64,7 +64,7 @@
     void elementWasRemoved(const Styleable&);
 
     void willChangeRendererForStyleable(const Styleable&);
-    void cancelDeclarativeAnimationsForStyleable(const Styleable&, WebAnimation::Silently);
+    void cancelDeclarativeAnimationsForStyleable(const Styleable&);
 
     void animationWasAddedToStyleable(WebAnimation&, const Styleable&);
     void animationWasRemovedFromStyleable(WebAnimation&, const Styleable&);

Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.cpp (275279 => 275280)


--- trunk/Source/WebCore/animation/DeclarativeAnimation.cpp	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.cpp	2021-03-31 15:38:00 UTC (rev 275280)
@@ -215,7 +215,7 @@
     WebAnimation::setTimeline(WTFMove(newTimeline));
 }
 
-void DeclarativeAnimation::cancel(Silently silently)
+void DeclarativeAnimation::cancel()
 {
     auto cancelationTime = 0_s;
     if (auto* animationEffect = effect()) {
@@ -223,7 +223,7 @@
             cancelationTime = *activeTime;
     }
 
-    WebAnimation::cancel(silently);
+    WebAnimation::cancel();
 
     invalidateDOMEvents(cancelationTime);
 }

Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.h (275279 => 275280)


--- trunk/Source/WebCore/animation/DeclarativeAnimation.h	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.h	2021-03-31 15:38:00 UTC (rev 275280)
@@ -64,7 +64,7 @@
     ExceptionOr<void> bindingsPause() override;
 
     void setTimeline(RefPtr<AnimationTimeline>&&) final;
-    void cancel(Silently = Silently::No) final;
+    void cancel() final;
 
     void tick() override;
 

Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (275279 => 275280)


--- trunk/Source/WebCore/animation/WebAnimation.cpp	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp	2021-03-31 15:38:00 UTC (rev 275280)
@@ -620,9 +620,9 @@
     return m_effect ? m_effect->endTime() : 0_s;
 }
 
-void WebAnimation::cancel(Silently silently)
+void WebAnimation::cancel()
 {
-    LOG_WITH_STREAM(Animations, stream << "WebAnimation " << this << " cancel(silently " << (silently == Silently::Yes) << ") (current time is " << currentTime() << ")");
+    LOG_WITH_STREAM(Animations, stream << "WebAnimation " << this << " cancel() (current time is " << currentTime() << ")");
 
     // 3.4.16. Canceling an animation
     // https://drafts.csswg.org/web-animations-1/#canceling-an-animation-section
@@ -634,11 +634,11 @@
     // 1. If animation's play state is not idle, perform the following steps:
     if (playState() != PlayState::Idle) {
         // 1. Run the procedure to reset an animation's pending tasks on animation.
-        resetPendingTasks(silently);
+        resetPendingTasks();
 
         // 2. Reject the current finished promise with a DOMException named "AbortError".
         // 3. Set the [[PromiseIsHandled]] internal slot of the current finished promise to true.
-        if (silently == Silently::No && !m_finishedPromise->isFulfilled())
+        if (!m_finishedPromise->isFulfilled())
             m_finishedPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
 
         // 4. Let current finished promise be a new (pending) Promise object.
@@ -655,8 +655,7 @@
         //    to origin-relative time, let the scheduled event time be the result of applying that procedure to timeline time. Otherwise, the
         //    scheduled event time is an unresolved time value.
         // Otherwise, queue a task to dispatch cancelEvent at animation. The task source for this task is the DOM manipulation task source.
-        if (silently == Silently::No)
-            enqueueAnimationPlaybackEvent(eventNames().cancelEvent, WTF::nullopt, m_timeline ? m_timeline->currentTime() : WTF::nullopt);
+        enqueueAnimationPlaybackEvent(eventNames().cancelEvent, WTF::nullopt, m_timeline ? m_timeline->currentTime() : WTF::nullopt);
     }
 
     // 2. Make animation's hold time unresolved.
@@ -701,7 +700,7 @@
     }
 }
 
-void WebAnimation::resetPendingTasks(Silently silently)
+void WebAnimation::resetPendingTasks()
 {
     // The procedure to reset an animation's pending tasks for animation is as follows:
     // https://drafts.csswg.org/web-animations-1/#reset-an-animations-pending-tasks
@@ -723,8 +722,7 @@
 
     // 5. Reject animation's current ready promise with a DOMException named "AbortError".
     // 6. Set the [[PromiseIsHandled]] internal slot of animation’s current ready promise to true.
-    if (silently == Silently::No)
-        m_readyPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
+    m_readyPromise->reject(Exception { AbortError }, RejectAsHandled::Yes);
 
     // 7. Let animation's current ready promise be the result of creating a new resolved Promise object.
     m_readyPromise = makeUniqueRef<ReadyPromise>(*this, &WebAnimation::readyPromiseResolve);

Modified: trunk/Source/WebCore/animation/WebAnimation.h (275279 => 275280)


--- trunk/Source/WebCore/animation/WebAnimation.h	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/animation/WebAnimation.h	2021-03-31 15:38:00 UTC (rev 275280)
@@ -75,7 +75,6 @@
     Optional<Seconds> currentTime(Optional<Seconds> = WTF::nullopt) const;
     ExceptionOr<void> setCurrentTime(Optional<Seconds>);
 
-    enum class Silently : uint8_t { Yes, No };
     double playbackRate() const { return m_playbackRate + 0; }
     void setPlaybackRate(double);
 
@@ -94,7 +93,7 @@
     using FinishedPromise = DOMPromiseProxyWithResolveCallback<IDLInterface<WebAnimation>>;
     FinishedPromise& finished() { return m_finishedPromise.get(); }
 
-    virtual void cancel(Silently = Silently::No);
+    virtual void cancel();
     ExceptionOr<void> finish();
     ExceptionOr<void> play();
     void updatePlaybackRate(double);
@@ -158,6 +157,7 @@
 private:
     enum class DidSeek : uint8_t { Yes, No };
     enum class SynchronouslyNotify : uint8_t { Yes, No };
+    enum class Silently : uint8_t { Yes, No };
     enum class RespectHoldTime : uint8_t { Yes, No };
     enum class AutoRewind : uint8_t { Yes, No };
     enum class TimeToRunPendingTask : uint8_t { NotScheduled, ASAP, WhenReady };
@@ -175,7 +175,7 @@
     ExceptionOr<void> play(AutoRewind);
     void runPendingPauseTask();
     void runPendingPlayTask();
-    void resetPendingTasks(Silently = Silently::No);
+    void resetPendingTasks();
     void setEffectInternal(RefPtr<AnimationEffect>&&, bool = false);
     void setTimelineInternal(RefPtr<AnimationTimeline>&&);
     bool isEffectInvalidationSuspended() { return m_suspendCount; }

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (275279 => 275280)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2021-03-31 14:10:06 UTC (rev 275279)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2021-03-31 15:38:00 UTC (rev 275280)
@@ -571,9 +571,9 @@
             case TeardownType::RendererUpdateCancelingAnimations:
                 if (timeline) {
                     if (document.renderTreeBeingDestroyed())
-                        timeline->cancelDeclarativeAnimationsForStyleable(Styleable::fromElement(element), WebAnimation::Silently::Yes);
+                        timeline->cancelDeclarativeAnimationsForStyleable(Styleable::fromElement(element));
                     else if (teardownType == TeardownType::RendererUpdateCancelingAnimations)
-                        timeline->cancelDeclarativeAnimationsForStyleable(Styleable::fromElement(element), WebAnimation::Silently::No);
+                        timeline->cancelDeclarativeAnimationsForStyleable(Styleable::fromElement(element));
                 }
                 break;
             case TeardownType::RendererUpdate:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to