[Web Animations] Move bindings methods requiring style flush from CSSAnimation to...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2018 07:51:42 +0000 (07:51 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 28 Oct 2018 07:51:42 +0000 (07:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190996

Reviewed by Dean Jackson.

Moving all of the IDL bindings methods that require flushing style from CSSAnimation to its superclass
DeclarativeAnimation so we follow the same route in CSSTransition. Note that there was code in
CSSAnimation::bindingsCurrentTime() that was not moved as it proved to not be necessary.

* animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::bindingsPlay):
(WebCore::CSSAnimation::bindingsPause):
(WebCore::CSSAnimation::bindingsStartTime const): Deleted.
(WebCore::CSSAnimation::setBindingsStartTime): Deleted.
(WebCore::CSSAnimation::bindingsCurrentTime const): Deleted.
(WebCore::CSSAnimation::setBindingsCurrentTime): Deleted.
(WebCore::CSSAnimation::bindingsPlayState const): Deleted.
(WebCore::CSSAnimation::bindingsPending const): Deleted.
(WebCore::CSSAnimation::bindingsReady): Deleted.
(WebCore::CSSAnimation::bindingsFinished): Deleted.
(WebCore::CSSAnimation::flushPendingStyleChanges const): Deleted.
* animation/CSSAnimation.h:
* animation/DeclarativeAnimation.cpp:
(WebCore::DeclarativeAnimation::bindingsStartTime const):
(WebCore::DeclarativeAnimation::setBindingsStartTime):
(WebCore::DeclarativeAnimation::bindingsCurrentTime const):
(WebCore::DeclarativeAnimation::setBindingsCurrentTime):
(WebCore::DeclarativeAnimation::bindingsPlayState const):
(WebCore::DeclarativeAnimation::bindingsPending const):
(WebCore::DeclarativeAnimation::bindingsReady):
(WebCore::DeclarativeAnimation::bindingsFinished):
(WebCore::DeclarativeAnimation::bindingsPlay):
(WebCore::DeclarativeAnimation::bindingsPause):
(WebCore::DeclarativeAnimation::flushPendingStyleChanges const):
* animation/DeclarativeAnimation.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237498 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/animation/CSSAnimation.cpp
Source/WebCore/animation/CSSAnimation.h
Source/WebCore/animation/DeclarativeAnimation.cpp
Source/WebCore/animation/DeclarativeAnimation.h

index d8460fc..9b9463c 100644 (file)
@@ -1,3 +1,41 @@
+2018-10-27  Antoine Quint  <graouts@apple.com>
+
+        [Web Animations] Move bindings methods requiring style flush from CSSAnimation to DeclarativeAnimation
+        https://bugs.webkit.org/show_bug.cgi?id=190996
+
+        Reviewed by Dean Jackson.
+
+        Moving all of the IDL bindings methods that require flushing style from CSSAnimation to its superclass
+        DeclarativeAnimation so we follow the same route in CSSTransition. Note that there was code in
+        CSSAnimation::bindingsCurrentTime() that was not moved as it proved to not be necessary.
+
+        * animation/CSSAnimation.cpp:
+        (WebCore::CSSAnimation::bindingsPlay):
+        (WebCore::CSSAnimation::bindingsPause):
+        (WebCore::CSSAnimation::bindingsStartTime const): Deleted.
+        (WebCore::CSSAnimation::setBindingsStartTime): Deleted.
+        (WebCore::CSSAnimation::bindingsCurrentTime const): Deleted.
+        (WebCore::CSSAnimation::setBindingsCurrentTime): Deleted.
+        (WebCore::CSSAnimation::bindingsPlayState const): Deleted.
+        (WebCore::CSSAnimation::bindingsPending const): Deleted.
+        (WebCore::CSSAnimation::bindingsReady): Deleted.
+        (WebCore::CSSAnimation::bindingsFinished): Deleted.
+        (WebCore::CSSAnimation::flushPendingStyleChanges const): Deleted.
+        * animation/CSSAnimation.h:
+        * animation/DeclarativeAnimation.cpp:
+        (WebCore::DeclarativeAnimation::bindingsStartTime const):
+        (WebCore::DeclarativeAnimation::setBindingsStartTime):
+        (WebCore::DeclarativeAnimation::bindingsCurrentTime const):
+        (WebCore::DeclarativeAnimation::setBindingsCurrentTime):
+        (WebCore::DeclarativeAnimation::bindingsPlayState const):
+        (WebCore::DeclarativeAnimation::bindingsPending const):
+        (WebCore::DeclarativeAnimation::bindingsReady):
+        (WebCore::DeclarativeAnimation::bindingsFinished):
+        (WebCore::DeclarativeAnimation::bindingsPlay):
+        (WebCore::DeclarativeAnimation::bindingsPause):
+        (WebCore::DeclarativeAnimation::flushPendingStyleChanges const):
+        * animation/DeclarativeAnimation.h:
+
 2018-10-27  Charlie Turner  <cturner@igalia.com>
 
         [EME] Add a logging macro
index f387b7c..3fc4810 100644 (file)
@@ -103,81 +103,16 @@ void CSSAnimation::syncPropertiesWithBackingAnimation()
     unsuspendEffectInvalidation();
 }
 
-std::optional<double> CSSAnimation::bindingsStartTime() const
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::bindingsStartTime();
-}
-
-void CSSAnimation::setBindingsStartTime(std::optional<double> startTime)
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::setBindingsStartTime(startTime);
-}
-
-std::optional<double> CSSAnimation::bindingsCurrentTime() const
-{
-    flushPendingStyleChanges();
-    auto currentTime = DeclarativeAnimation::bindingsCurrentTime();
-    if (currentTime) {
-        if (auto* animationEffect = effect())
-            return std::max(0.0, std::min(currentTime.value(), animationEffect->timing()->activeDuration().milliseconds()));
-    }
-    return currentTime;
-}
-
-ExceptionOr<void> CSSAnimation::setBindingsCurrentTime(std::optional<double> currentTime)
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::setBindingsCurrentTime(currentTime);
-}
-
-WebAnimation::PlayState CSSAnimation::bindingsPlayState() const
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::bindingsPlayState();
-}
-
-bool CSSAnimation::bindingsPending() const
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::bindingsPending();
-}
-
-WebAnimation::ReadyPromise& CSSAnimation::bindingsReady()
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::bindingsReady();
-}
-
-WebAnimation::FinishedPromise& CSSAnimation::bindingsFinished()
-{
-    flushPendingStyleChanges();
-    return DeclarativeAnimation::bindingsFinished();
-}
-
 ExceptionOr<void> CSSAnimation::bindingsPlay()
 {
-    flushPendingStyleChanges();
     m_stickyPaused = false;
     return DeclarativeAnimation::bindingsPlay();
 }
 
 ExceptionOr<void> CSSAnimation::bindingsPause()
 {
-    flushPendingStyleChanges();
     m_stickyPaused = true;
     return DeclarativeAnimation::bindingsPause();
 }
 
-void CSSAnimation::flushPendingStyleChanges() const
-{
-    if (auto* animationEffect = effect()) {
-        if (is<KeyframeEffectReadOnly>(animationEffect)) {
-            if (auto* target = downcast<KeyframeEffectReadOnly>(animationEffect)->target())
-                target->document().updateStyleIfNeeded();
-        }
-    }
-}
-
 } // namespace WebCore
index 07a42e1..6360971 100644 (file)
@@ -43,14 +43,6 @@ public:
     const String& animationName() const { return m_animationName; }
     const RenderStyle& unanimatedStyle() const { return *m_unanimatedStyle; }
 
-    std::optional<double> bindingsStartTime() const final;
-    void setBindingsStartTime(std::optional<double>) final;
-    std::optional<double> bindingsCurrentTime() const final;
-    ExceptionOr<void> setBindingsCurrentTime(std::optional<double>) final;
-    WebAnimation::PlayState bindingsPlayState() const final;
-    bool bindingsPending() const final;
-    WebAnimation::ReadyPromise& bindingsReady() final;
-    WebAnimation::FinishedPromise& bindingsFinished() final;
     ExceptionOr<void> bindingsPlay() final;
     ExceptionOr<void> bindingsPause() final;
 
@@ -60,8 +52,6 @@ protected:
 private:
     CSSAnimation(Element&, const Animation&, const RenderStyle&);
 
-    void flushPendingStyleChanges() const;
-
     String m_animationName;
     std::unique_ptr<RenderStyle> m_unanimatedStyle;
     bool m_stickyPaused { false };
index 8a74b8a..52c9eaf 100644 (file)
@@ -84,6 +84,76 @@ void DeclarativeAnimation::syncPropertiesWithBackingAnimation()
 {
 }
 
+std::optional<double> DeclarativeAnimation::bindingsStartTime() const
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsStartTime();
+}
+
+void DeclarativeAnimation::setBindingsStartTime(std::optional<double> startTime)
+{
+    flushPendingStyleChanges();
+    return WebAnimation::setBindingsStartTime(startTime);
+}
+
+std::optional<double> DeclarativeAnimation::bindingsCurrentTime() const
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsCurrentTime();
+}
+
+ExceptionOr<void> DeclarativeAnimation::setBindingsCurrentTime(std::optional<double> currentTime)
+{
+    flushPendingStyleChanges();
+    return WebAnimation::setBindingsCurrentTime(currentTime);
+}
+
+WebAnimation::PlayState DeclarativeAnimation::bindingsPlayState() const
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsPlayState();
+}
+
+bool DeclarativeAnimation::bindingsPending() const
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsPending();
+}
+
+WebAnimation::ReadyPromise& DeclarativeAnimation::bindingsReady()
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsReady();
+}
+
+WebAnimation::FinishedPromise& DeclarativeAnimation::bindingsFinished()
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsFinished();
+}
+
+ExceptionOr<void> DeclarativeAnimation::bindingsPlay()
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsPlay();
+}
+
+ExceptionOr<void> DeclarativeAnimation::bindingsPause()
+{
+    flushPendingStyleChanges();
+    return WebAnimation::bindingsPause();
+}
+
+void DeclarativeAnimation::flushPendingStyleChanges() const
+{
+    if (auto* animationEffect = effect()) {
+        if (is<KeyframeEffectReadOnly>(animationEffect)) {
+            if (auto* target = downcast<KeyframeEffectReadOnly>(animationEffect)->target())
+                target->document().updateStyleIfNeeded();
+        }
+    }
+}
+
 void DeclarativeAnimation::setTimeline(RefPtr<AnimationTimeline>&& newTimeline)
 {
     if (timeline() && !newTimeline)
index e103608..1540389 100644 (file)
@@ -47,6 +47,17 @@ public:
     void setBackingAnimation(const Animation&);
     void invalidateDOMEvents(Seconds elapsedTime = 0_s);
 
+    std::optional<double> bindingsStartTime() const final;
+    void setBindingsStartTime(std::optional<double>) final;
+    std::optional<double> bindingsCurrentTime() const final;
+    ExceptionOr<void> setBindingsCurrentTime(std::optional<double>) final;
+    WebAnimation::PlayState bindingsPlayState() const final;
+    bool bindingsPending() const final;
+    WebAnimation::ReadyPromise& bindingsReady() final;
+    WebAnimation::FinishedPromise& bindingsFinished() final;
+    ExceptionOr<void> bindingsPlay() override;
+    ExceptionOr<void> bindingsPause() override;
+
     void setTimeline(RefPtr<AnimationTimeline>&&) final;
     void cancel() final;
 
@@ -57,6 +68,7 @@ protected:
     virtual void syncPropertiesWithBackingAnimation();
 
 private:
+    void flushPendingStyleChanges() const;
     AnimationEffectReadOnly::Phase phaseWithoutEffect() const;
     void enqueueDOMEvent(const AtomicString&, Seconds);
     void remove() final;