[Web Animations] Crash when setting an animation style on an existing animation that...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 19:32:10 +0000 (19:32 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jul 2018 19:32:10 +0000 (19:32 +0000)
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.

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

LayoutTests/ChangeLog
LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt [new file with mode: 0644]
LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/animation/CSSAnimation.cpp

index 5e63f6c..6876852 100644 (file)
@@ -1,5 +1,17 @@
 2018-07-24  Antoine Quint  <graouts@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  <graouts@apple.com>
+
         [Web Animations] Crash when setting "animation: none" after clearing an animation's effect
         https://bugs.webkit.org/show_bug.cgi?id=187952
 
diff --git a/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt b/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt
new file mode 100644 (file)
index 0000000..cac49de
--- /dev/null
@@ -0,0 +1,3 @@
+
+PASS Setting a CSSAnimation's property via style after setting its effect to null does not crash. 
+
diff --git a/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html b/LayoutTests/webanimations/setting-css-animation-timing-property-via-style-after-clearing-effect.html
new file mode 100644 (file)
index 0000000..d739f25
--- /dev/null
@@ -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="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<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
index 54d0db6..63a1ccd 100644 (file)
@@ -1,3 +1,17 @@
+2018-07-24  Antoine Quint  <graouts@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.carlson@apple.com>
 
         [MediaStream] Restructure getDisplayMedia classes
index 90572e2..f387b7c 100644 (file)
@@ -49,6 +49,9 @@ void CSSAnimation::syncPropertiesWithBackingAnimation()
 {
     DeclarativeAnimation::syncPropertiesWithBackingAnimation();
 
+    if (!effect())
+        return;
+
     suspendEffectInvalidation();
 
     auto& animation = backingAnimation();