Title: [234165] trunk
Revision
234165
Author
grao...@webkit.org
Date
2018-07-24 12:32:10 -0700 (Tue, 24 Jul 2018)

Log Message

[Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
https://bugs.webkit.org/show_bug.cgi?id=187953

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html

Ensure that we have a valid effect before proceeding to update its timing.

* animation/CSSAnimation.cpp:
(WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):

LayoutTests:

Add a new test that sets an animation property via style after setting the initial animation's effect to null.

* webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt: Added.
* webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (234164 => 234165)


--- trunk/LayoutTests/ChangeLog	2018-07-24 19:31:03 UTC (rev 234164)
+++ trunk/LayoutTests/ChangeLog	2018-07-24 19:32:10 UTC (rev 234165)
@@ -1,5 +1,17 @@
 2018-07-24  Antoine Quint  <grao...@apple.com>
 
+        [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
+        https://bugs.webkit.org/show_bug.cgi?id=187953
+
+        Reviewed by Dean Jackson.
+
+        Add a new test that sets an animation property via style after setting the initial animation's effect to null.
+
+        * webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt: Added.
+        * webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html: Added.
+
+2018-07-24  Antoine Quint  <grao...@apple.com>
+
         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
         https://bugs.webkit.org/show_bug.cgi?id=187952
 

Added: trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt (0 => 234165)


--- trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt	2018-07-24 19:32:10 UTC (rev 234165)
@@ -0,0 +1,3 @@
+
+PASS Setting a CSSAnimation's property via style after setting its effect to null does not crash. 
+

Added: trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html (0 => 234165)


--- trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html	                        (rev 0)
+++ trunk/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html	2018-07-24 19:32:10 UTC (rev 234165)
@@ -0,0 +1,34 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableWebAnimationsCSSIntegration=true ] -->
+<meta charset=utf-8>
+<title>Crash setting a CSSAnimation's property via style after setting its effect to null</title>
+<style>
+    @keyframes animation {
+        from {
+            margin-left: 0px;
+        }
+        to {
+            margin-left: 100px;
+        }
+    }
+</style>
+<body>
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+test(t => {
+    const target = document.body.appendChild(document.createElement("div"));
+    target.style.animation = "animation 1s";
+
+    const animations = target.getAnimations();
+    assert_equals(animations.length, 1, "The target element has one animation.");
+
+    animations[0].effect = null;
+
+    target.style.animationDuration = "2s";
+}, "Setting a CSSAnimation's property via style after setting its effect to null does not crash.");
+
+</script>
+</body>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (234164 => 234165)


--- trunk/Source/WebCore/ChangeLog	2018-07-24 19:31:03 UTC (rev 234164)
+++ trunk/Source/WebCore/ChangeLog	2018-07-24 19:32:10 UTC (rev 234165)
@@ -1,3 +1,17 @@
+2018-07-24  Antoine Quint  <grao...@apple.com>
+
+        [Web Animations] Crash when setting an animation style on an existing animation that had its effect set to null
+        https://bugs.webkit.org/show_bug.cgi?id=187953
+
+        Reviewed by Dean Jackson.
+
+        Test: webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
+
+        Ensure that we have a valid effect before proceeding to update its timing. 
+
+        * animation/CSSAnimation.cpp:
+        (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
+
 2018-07-24  Eric Carlson  <eric.carl...@apple.com>
 
         [MediaStream] Restructure getDisplayMedia classes

Modified: trunk/Source/WebCore/animation/CSSAnimation.cpp (234164 => 234165)


--- trunk/Source/WebCore/animation/CSSAnimation.cpp	2018-07-24 19:31:03 UTC (rev 234164)
+++ trunk/Source/WebCore/animation/CSSAnimation.cpp	2018-07-24 19:32:10 UTC (rev 234165)
@@ -49,6 +49,9 @@
 {
     DeclarativeAnimation::syncPropertiesWithBackingAnimation();
 
+    if (!effect())
+        return;
+
     suspendEffectInvalidation();
 
     auto& animation = backingAnimation();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to