Title: [230112] trunk
Revision
230112
Author
[email protected]
Date
2018-03-30 11:45:54 -0700 (Fri, 30 Mar 2018)

Log Message

[Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time
https://bugs.webkit.org/show_bug.cgi?id=184129

Reviewed by Dean Jackson.

Source/WebCore:

In order to allow a CSS Transition to be seeked prior to its start time, it needs to have its fill mode set
to backwards. Adding code to set the fill mode in CSSTransition::initialize() yields early timing model
invalidation and we could get in a situation where stylesWouldYieldNewCSSTransitionsBlendingKeyframes()
was called before we had a chance to create blending keyframes for a CSS transitions, since the call
to create blending keyframes is made after the call to initialize(), so we now cater for this case.

* animation/CSSTransition.cpp:
(WebCore::CSSTransition::initialize):
* animation/CSSTransition.h:
* animation/KeyframeEffectReadOnly.cpp:
(WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const):

LayoutTests:

Make one test opt into CSS Animations and CSS Transitions as Web Animations and fix expectations for a CSSTransition
test which mistakenly assumes the fill to be "none".

* transitions/transition-in-delay-phase.html:
* webanimations/css-transitions.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (230111 => 230112)


--- trunk/LayoutTests/ChangeLog	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/LayoutTests/ChangeLog	2018-03-30 18:45:54 UTC (rev 230112)
@@ -1,3 +1,16 @@
+2018-03-29  Antoine Quint  <[email protected]>
+
+        [Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time
+        https://bugs.webkit.org/show_bug.cgi?id=184129
+
+        Reviewed by Dean Jackson.
+
+        Make one test opt into CSS Animations and CSS Transitions as Web Animations and fix expectations for a CSSTransition
+        test which mistakenly assumes the fill to be "none".
+
+        * transitions/transition-in-delay-phase.html:
+        * webanimations/css-transitions.html:
+
 2018-03-28  Ryan Haddad  <[email protected]>
 
         Mark imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_createIndex7-event_order.htm as flaky.

Modified: trunk/LayoutTests/transitions/transition-in-delay-phase.html (230111 => 230112)


--- trunk/LayoutTests/transitions/transition-in-delay-phase.html	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/LayoutTests/transitions/transition-in-delay-phase.html	2018-03-30 18:45:54 UTC (rev 230112)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>

Modified: trunk/LayoutTests/webanimations/css-transitions.html (230111 => 230112)


--- trunk/LayoutTests/webanimations/css-transitions.html	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/LayoutTests/webanimations/css-transitions.html	2018-03-30 18:45:54 UTC (rev 230112)
@@ -64,7 +64,7 @@
     assert_equals(computedTiming.iterations, 1, "The animations's computed timing iterations property matches the properties set by CSS");
     assert_equals(computedTiming.localTime, 0, "The animations's computed timing localTime property matches the properties set by CSS");
     assert_equals(computedTiming.progress, 0.5, "The animations's computed timing progress property matches the properties set by CSS");
-    assert_equals(computedTiming.fill, "none", "The animations's computed timing fill property matches the properties set by CSS");
+    assert_equals(computedTiming.fill, "backwards", "The animations's computed timing fill property matches the default value set for transitions");
     assert_equals(computedTiming.easing, "linear", "The animations's computed timing easing property matches the properties set by CSS");
     assert_equals(computedTiming.direction, "normal", "The animations's computed timing direction property matches the properties set by CSS");
 

Modified: trunk/Source/WebCore/ChangeLog (230111 => 230112)


--- trunk/Source/WebCore/ChangeLog	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/Source/WebCore/ChangeLog	2018-03-30 18:45:54 UTC (rev 230112)
@@ -1,3 +1,22 @@
+2018-03-29  Antoine Quint  <[email protected]>
+
+        [Web Animations] CSSTransition objects should have fill: backwards to allow seeking prior to start time
+        https://bugs.webkit.org/show_bug.cgi?id=184129
+
+        Reviewed by Dean Jackson.
+
+        In order to allow a CSS Transition to be seeked prior to its start time, it needs to have its fill mode set
+        to backwards. Adding code to set the fill mode in CSSTransition::initialize() yields early timing model
+        invalidation and we could get in a situation where stylesWouldYieldNewCSSTransitionsBlendingKeyframes()
+        was called before we had a chance to create blending keyframes for a CSS transitions, since the call
+        to create blending keyframes is made after the call to initialize(), so we now cater for this case.
+
+        * animation/CSSTransition.cpp:
+        (WebCore::CSSTransition::initialize):
+        * animation/CSSTransition.h:
+        * animation/KeyframeEffectReadOnly.cpp:
+        (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const):
+
 2018-03-30  Daniel Bates  <[email protected]>
 
         Remove unused MIMETypeRegistry::getSupportedImageMIMETypesForEncoding()

Modified: trunk/Source/WebCore/animation/CSSTransition.cpp (230111 => 230112)


--- trunk/Source/WebCore/animation/CSSTransition.cpp	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/Source/WebCore/animation/CSSTransition.cpp	2018-03-30 18:45:54 UTC (rev 230112)
@@ -46,6 +46,19 @@
 {
 }
 
+void CSSTransition::initialize(const Element& target)
+{
+    DeclarativeAnimation::initialize(target);
+
+    suspendEffectInvalidation();
+
+    // In order for CSS Transitions to be seeked backwards, they need to have their fill mode set to backwards
+    // such that the original CSS value applied prior to the transition is used for a negative current time.
+    effect()->timing()->setFill(FillMode::Backwards);
+
+    unsuspendEffectInvalidation();
+}
+
 bool CSSTransition::matchesBackingAnimationAndStyles(const Animation& newBackingAnimation, const RenderStyle* oldStyle, const RenderStyle& newStyle) const
 {
     // See if the animations match, excluding the property since we can move from an "all" transition to an explicit property transition.

Modified: trunk/Source/WebCore/animation/CSSTransition.h (230111 => 230112)


--- trunk/Source/WebCore/animation/CSSTransition.h	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/Source/WebCore/animation/CSSTransition.h	2018-03-30 18:45:54 UTC (rev 230112)
@@ -47,6 +47,9 @@
     bool matchesBackingAnimationAndStyles(const Animation&, const RenderStyle* oldStyle, const RenderStyle& newStyle) const;
     bool canBeListed() const final;
 
+protected:
+    void initialize(const Element&) final;
+
 private:
     CSSTransition(Element&, CSSPropertyID, const Animation&);
 

Modified: trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp (230111 => 230112)


--- trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-03-30 17:46:22 UTC (rev 230111)
+++ trunk/Source/WebCore/animation/KeyframeEffectReadOnly.cpp	2018-03-30 18:45:54 UTC (rev 230112)
@@ -870,6 +870,11 @@
 bool KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes(const RenderStyle& oldStyle, const RenderStyle& newStyle) const
 {
     ASSERT(is<CSSTransition>(animation()));
+
+    // We don't yet have blending keyframes to compare with, so these wouldn't be new keyframes, but the fisrt ones.
+    if (!hasBlendingKeyframes())
+        return false;
+
     auto property = downcast<CSSTransition>(animation())->backingAnimation().property();
 
     // There cannot be new keyframes if the start and to values are the same.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to