Title: [237498] trunk/Source/WebCore
Revision
237498
Author
[email protected]
Date
2018-10-28 00:51:42 -0700 (Sun, 28 Oct 2018)

Log Message

[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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237497 => 237498)


--- trunk/Source/WebCore/ChangeLog	2018-10-28 02:02:52 UTC (rev 237497)
+++ trunk/Source/WebCore/ChangeLog	2018-10-28 07:51:42 UTC (rev 237498)
@@ -1,3 +1,41 @@
+2018-10-27  Antoine Quint  <[email protected]>
+
+        [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  <[email protected]>
 
         [EME] Add a logging macro

Modified: trunk/Source/WebCore/animation/CSSAnimation.cpp (237497 => 237498)


--- trunk/Source/WebCore/animation/CSSAnimation.cpp	2018-10-28 02:02:52 UTC (rev 237497)
+++ trunk/Source/WebCore/animation/CSSAnimation.cpp	2018-10-28 07:51:42 UTC (rev 237498)
@@ -103,62 +103,8 @@
     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();
 }
@@ -165,19 +111,8 @@
 
 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

Modified: trunk/Source/WebCore/animation/CSSAnimation.h (237497 => 237498)


--- trunk/Source/WebCore/animation/CSSAnimation.h	2018-10-28 02:02:52 UTC (rev 237497)
+++ trunk/Source/WebCore/animation/CSSAnimation.h	2018-10-28 07:51:42 UTC (rev 237498)
@@ -43,14 +43,6 @@
     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 @@
 private:
     CSSAnimation(Element&, const Animation&, const RenderStyle&);
 
-    void flushPendingStyleChanges() const;
-
     String m_animationName;
     std::unique_ptr<RenderStyle> m_unanimatedStyle;
     bool m_stickyPaused { false };

Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.cpp (237497 => 237498)


--- trunk/Source/WebCore/animation/DeclarativeAnimation.cpp	2018-10-28 02:02:52 UTC (rev 237497)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.cpp	2018-10-28 07:51:42 UTC (rev 237498)
@@ -84,6 +84,76 @@
 {
 }
 
+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)

Modified: trunk/Source/WebCore/animation/DeclarativeAnimation.h (237497 => 237498)


--- trunk/Source/WebCore/animation/DeclarativeAnimation.h	2018-10-28 02:02:52 UTC (rev 237497)
+++ trunk/Source/WebCore/animation/DeclarativeAnimation.h	2018-10-28 07:51:42 UTC (rev 237498)
@@ -47,6 +47,17 @@
     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 @@
     virtual void syncPropertiesWithBackingAnimation();
 
 private:
+    void flushPendingStyleChanges() const;
     AnimationEffectReadOnly::Phase phaseWithoutEffect() const;
     void enqueueDOMEvent(const AtomicString&, Seconds);
     void remove() final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to