[Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2018 19:19:46 +0000 (19:19 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2018 19:19:46 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184038

Reviewed by Dean Jackson.

Source/WebCore:

Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled.

* testing/InternalSettings.cpp:
(WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

LayoutTests:

Make 48 tests opt into CSS Animations and CSS Transitions as Web Animations. These tests used the internals.pauseAnimationAtTimeOnElement()
method, but this method should be going away since the Web Animations API allows seeking and pausing. To support this, we make
animation-test-helpers.js use the Web Animations API instead of internals.pauseAnimationAtTimeOnElement() if the tests has opted
into CSS Animations and CSS Transitions as Web Animations and we know it's safe to use these APIs.

* animations/3d/matrix-transform-type-animation.html:
* animations/3d/transform-perspective.html:
* animations/animation-callback-timestamp.html:
* animations/animation-direction-reverse-hardware-opacity.html:
* animations/animation-direction-reverse-hardware.html:
* animations/animation-direction-reverse-non-hardware.html:
* animations/animation-direction-reverse-timing-functions-hardware.html:
* animations/animation-direction-reverse-timing-functions.html:
* animations/animation-direction.html:
* animations/animation-hit-test.html:
* animations/animation-offscreen-to-onscreen.html:
* animations/change-keyframes-expected.txt:
* animations/change-keyframes.html:
* animations/cross-fade-background-image.html:
* animations/cross-fade-border-image-source.html:
* animations/cross-fade-list-style-image.html:
* animations/cross-fade-webkit-mask-box-image.html:
* animations/duplicate-keys-expected.html:
* animations/duplicate-keys.html:
* animations/font-variations/font-stretch.html:
* animations/font-variations/font-style.html:
* animations/font-variations/font-variation-settings-order.html:
* animations/font-variations/font-variation-settings-unlike.html:
* animations/font-variations/font-variation-settings.html:
* animations/font-variations/font-weight.html:
* animations/generic-from-to.html:
* animations/import.html:
* animations/keyframe-multiple-timing-functions-transform.html:
* animations/keyframes-comma-separated.html:
* animations/keyframes-infinite-iterations.html:
* animations/keyframes-invalid-keys.html:
* animations/keyframes-out-of-order.html:
* animations/keyframes.html:
* animations/longhand-timing-function.html:
* animations/matrix-anim.html:
* animations/missing-keyframe-properties-repeating.html:
* animations/missing-keyframe-properties.html:
* animations/missing-values-first-keyframe.html:
* animations/missing-values-last-keyframe.html:
* animations/multiple-animations-timing-function.html:
* animations/multiple-animations.html:
* animations/multiple-keyframes.html:
* animations/negative-delay.html:
* animations/pause-crash.html:
* animations/resources/animation-test-helpers.js:
(checkExpectedValue):
(pauseAnimationAtTimeOnElement):
(startTest):
(runAnimationTest):
* animations/simultaneous-start-left.html:
* animations/spring-function.html:
* animations/stacking-context-unchanged-while-running.html:
* animations/timing-functions.html:
* animations/unanimated-style.html:
* animations/unprefixed-keyframes.html:

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

56 files changed:
LayoutTests/ChangeLog
LayoutTests/animations/3d/matrix-transform-type-animation.html
LayoutTests/animations/3d/transform-perspective.html
LayoutTests/animations/animation-callback-timestamp.html
LayoutTests/animations/animation-direction-reverse-hardware-opacity.html
LayoutTests/animations/animation-direction-reverse-hardware.html
LayoutTests/animations/animation-direction-reverse-non-hardware.html
LayoutTests/animations/animation-direction-reverse-timing-functions-hardware.html
LayoutTests/animations/animation-direction-reverse-timing-functions.html
LayoutTests/animations/animation-direction.html
LayoutTests/animations/animation-hit-test.html
LayoutTests/animations/animation-offscreen-to-onscreen.html
LayoutTests/animations/change-keyframes-expected.txt
LayoutTests/animations/change-keyframes.html
LayoutTests/animations/cross-fade-background-image.html
LayoutTests/animations/cross-fade-border-image-source.html
LayoutTests/animations/cross-fade-list-style-image.html
LayoutTests/animations/cross-fade-webkit-mask-box-image.html
LayoutTests/animations/duplicate-keys-expected.html
LayoutTests/animations/duplicate-keys.html
LayoutTests/animations/font-variations/font-stretch.html
LayoutTests/animations/font-variations/font-style.html
LayoutTests/animations/font-variations/font-variation-settings-order.html
LayoutTests/animations/font-variations/font-variation-settings-unlike.html
LayoutTests/animations/font-variations/font-variation-settings.html
LayoutTests/animations/font-variations/font-weight.html
LayoutTests/animations/generic-from-to.html
LayoutTests/animations/import.html
LayoutTests/animations/keyframe-multiple-timing-functions-transform.html
LayoutTests/animations/keyframes-comma-separated.html
LayoutTests/animations/keyframes-infinite-iterations.html
LayoutTests/animations/keyframes-invalid-keys.html
LayoutTests/animations/keyframes-out-of-order.html
LayoutTests/animations/keyframes.html
LayoutTests/animations/longhand-timing-function.html
LayoutTests/animations/matrix-anim.html
LayoutTests/animations/missing-keyframe-properties-repeating.html
LayoutTests/animations/missing-keyframe-properties.html
LayoutTests/animations/missing-values-first-keyframe.html
LayoutTests/animations/missing-values-last-keyframe.html
LayoutTests/animations/multiple-animations-timing-function.html
LayoutTests/animations/multiple-animations.html
LayoutTests/animations/multiple-keyframes.html
LayoutTests/animations/negative-delay.html
LayoutTests/animations/pause-crash.html
LayoutTests/animations/resources/animation-test-helpers.js
LayoutTests/animations/simultaneous-start-left.html
LayoutTests/animations/spring-function.html
LayoutTests/animations/stacking-context-unchanged-while-running.html
LayoutTests/animations/timing-functions.html
LayoutTests/animations/unanimated-style.html
LayoutTests/animations/unprefixed-keyframes.html
Source/WebCore/ChangeLog
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl

index 61c7774..b8bc09e 100644 (file)
@@ -1,3 +1,71 @@
+2018-03-27  Antoine Quint  <graouts@apple.com>
+
+        [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests
+        https://bugs.webkit.org/show_bug.cgi?id=184038
+
+        Reviewed by Dean Jackson.
+
+        Make 48 tests opt into CSS Animations and CSS Transitions as Web Animations. These tests used the internals.pauseAnimationAtTimeOnElement()
+        method, but this method should be going away since the Web Animations API allows seeking and pausing. To support this, we make
+        animation-test-helpers.js use the Web Animations API instead of internals.pauseAnimationAtTimeOnElement() if the tests has opted
+        into CSS Animations and CSS Transitions as Web Animations and we know it's safe to use these APIs.
+
+        * animations/3d/matrix-transform-type-animation.html:
+        * animations/3d/transform-perspective.html:
+        * animations/animation-callback-timestamp.html:
+        * animations/animation-direction-reverse-hardware-opacity.html:
+        * animations/animation-direction-reverse-hardware.html:
+        * animations/animation-direction-reverse-non-hardware.html:
+        * animations/animation-direction-reverse-timing-functions-hardware.html:
+        * animations/animation-direction-reverse-timing-functions.html:
+        * animations/animation-direction.html:
+        * animations/animation-hit-test.html:
+        * animations/animation-offscreen-to-onscreen.html:
+        * animations/change-keyframes-expected.txt:
+        * animations/change-keyframes.html:
+        * animations/cross-fade-background-image.html:
+        * animations/cross-fade-border-image-source.html:
+        * animations/cross-fade-list-style-image.html:
+        * animations/cross-fade-webkit-mask-box-image.html:
+        * animations/duplicate-keys-expected.html:
+        * animations/duplicate-keys.html:
+        * animations/font-variations/font-stretch.html:
+        * animations/font-variations/font-style.html:
+        * animations/font-variations/font-variation-settings-order.html:
+        * animations/font-variations/font-variation-settings-unlike.html:
+        * animations/font-variations/font-variation-settings.html:
+        * animations/font-variations/font-weight.html:
+        * animations/generic-from-to.html:
+        * animations/import.html:
+        * animations/keyframe-multiple-timing-functions-transform.html:
+        * animations/keyframes-comma-separated.html:
+        * animations/keyframes-infinite-iterations.html:
+        * animations/keyframes-invalid-keys.html:
+        * animations/keyframes-out-of-order.html:
+        * animations/keyframes.html:
+        * animations/longhand-timing-function.html:
+        * animations/matrix-anim.html:
+        * animations/missing-keyframe-properties-repeating.html:
+        * animations/missing-keyframe-properties.html:
+        * animations/missing-values-first-keyframe.html:
+        * animations/missing-values-last-keyframe.html:
+        * animations/multiple-animations-timing-function.html:
+        * animations/multiple-animations.html:
+        * animations/multiple-keyframes.html:
+        * animations/negative-delay.html:
+        * animations/pause-crash.html:
+        * animations/resources/animation-test-helpers.js:
+        (checkExpectedValue):
+        (pauseAnimationAtTimeOnElement):
+        (startTest):
+        (runAnimationTest):
+        * animations/simultaneous-start-left.html:
+        * animations/spring-function.html:
+        * animations/stacking-context-unchanged-while-running.html:
+        * animations/timing-functions.html:
+        * animations/unanimated-style.html:
+        * animations/unprefixed-keyframes.html:
+
 2018-03-27  Per Arne Vollan  <pvollan@apple.com>
 
         Mark some CSS animations tests as failing on Windows.
index f8e7a14..a38d209 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css">
index af9e4a9..3e1ebcc 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html>
 <head>
index 6d45632..cd91fb4 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML>
+<!DOCTYPE HTML><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
     <script src="../resources/js-test-pre.js"></script>
index edcb440..22c7f91 100644 (file)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>Test of -webkit-animation-direction on composited elements (opacity)</title>
index 9a8b428..1e47d4f 100644 (file)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>Test of -webkit-animation-direction on composited elements</title>
index 673c2e4..e76dbfd 100644 (file)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>Test of -webkit-animation-direction reverse on non-composited elements</title>
index bab61e0..84f3f6e 100644 (file)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <title>Test of -webkit-animation-direction timing functions on composited elements</title>
index 2b4c380..cfbfaef 100644 (file)
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <title>Test of -webkit-animation-direction timing functions</title>
index bc6dfce..fd0935d 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html>
 <head>
index fdb3681..b9123b0 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
@@ -58,7 +57,7 @@
         {
             if (window.testRunner) {
                 var target = document.getElementById("target");
-                if (!internals.pauseAnimationAtTimeOnElement("anim", 2.0, target)) {
+                if (!pauseAnimationAtTimeOnElement("anim", 2.0, target)) {
                     document.getElementById('result').innerHTML = "FAIL: Failed to pause animation"
                     testRunner.notifyDone();
                     return;
index a8bc076..5d372af 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css" media="screen">
index 9254940..58cd383 100644 (file)
@@ -1,5 +1,5 @@
-CONSOLE MESSAGE: line 57: CSSKeyframesRule 'insertRule' function is deprecated.  Use 'appendRule' instead.
-CONSOLE MESSAGE: line 59: CSSKeyframesRule 'insertRule' function is deprecated.  Use 'appendRule' instead.
+CONSOLE MESSAGE: line 56: CSSKeyframesRule 'insertRule' function is deprecated.  Use 'appendRule' instead.
+CONSOLE MESSAGE: line 58: CSSKeyframesRule 'insertRule' function is deprecated.  Use 'appendRule' instead.
 This test performs an animation of the left property and makes sure it is animating. Then it stops the animation, changes the keyframes to an animation of the top property, restarts the animation and makes sure top is animating.
 PASS - "left" property for "box" element at 0.5s saw something close to: 200
 PASS - "top" property for "box" element at 1s saw something close to: 100
index 5ba715a..cf51841 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index e36a1c2..1e11af3 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>
index 0e5e9d4..3dc2e11 100644 (file)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>
index 883f4be..c7ff6bc 100644 (file)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>
index 5fb45c7..8c8fa15 100644 (file)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>
index 529f491..7c29fa2 100644 (file)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <style>
 .box {
     height: 100px;
 <script>
 if (window.testRunner) {
     window.addEventListener("load", function () {
-        var box = document.querySelector(".box");
-        internals.pauseAnimationAtTimeOnElement("foo", 0.1, box);
+        const animations = document.querySelector(".box").getAnimations();
+        for (let animation of animations) {
+            if (animation instanceof CSSAnimation && animation.animationName == "foo") {
+                animation.currentTime = 100;
+                animation.pause();
+                break;
+            }
+        }
     }, false);
 }
 </script>
index a642ff3..d7bce92 100644 (file)
@@ -1,3 +1,4 @@
+<!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <style>
 .box {
     height: 100px;
 if (window.testRunner) {
     testRunner.waitUntilDone();
     window.addEventListener("load", function () {
-        var box = document.querySelector(".box");
-        internals.pauseAnimationAtTimeOnElement("foo", 0.1, box);
+        const animations = document.querySelector(".box").getAnimations();
+        for (let animation of animations) {
+            if (animation instanceof CSSAnimation && animation.animationName == "foo") {
+                animation.currentTime = 100;
+                animation.pause();
+                break;
+            }
+        }
         testRunner.notifyDone();
     }, false);
 }
index 261ac0d..ddc0de2 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index d939b64..8e6bd6e 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index 5cbe260..7cfafb0 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index 941a1fc..f08f81a 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index b95e2e0..d2041b1 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index 1ac90da..9ae1689 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
 <script src="../resources/animation-test-helpers.js"></script>
index b3b878f..5354346 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 88d88e1..62f88ee 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index b4e3b7c..a2c2121 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
     <style>
index 19a6625..1fb4aad 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 8a70681..8fa3b79 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style>
index d428582..6a513bc 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 954f86f..f04a278 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 5205a22..3f2631c 100644 (file)
@@ -1,6 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
-
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html lang="en">
 <head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 15e5927..2db4884 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html>
 <head>
index 10ac2b8..b249dfc 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index 5dc83d4..33e045f 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css" media="screen">
index 25bfe18..edb4770 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css" media="screen">
index d8798d1..58a5f21 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css" media="screen">
index 9c7a90d..d38d5d0 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <style type="text/css" media="screen">
index f157b16..f44ee46 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
     <style>
index b4fdd30..0af7d4e 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index b90565b..df0ac20 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index 6e14ef1..e4efe9e 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
-        "http://www.w3.org/TR/html4/strict.dtd">
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>For Bug 26150 - Negative values for animation-delay are ignored</title>
index 7de9b73..8517284 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>Pause and resume animation should not crash</title>
index c6527cf..85c9828 100644 (file)
@@ -18,7 +18,7 @@ Function parameters:
     - the tolerance to use when comparing the effective CSS property value with its expected value
 
     [1] If null is passed, a regular setTimeout() will be used instead to snapshot the animated property in the future,
-    instead of fast forwarding using the pauseAnimationAtTimeOnElement() JS API from Internals.
+    instead of fast forwarding using the pauseAnimationAtTimeOnElement() function.
     
     [2] If a single string is passed, it is the id of the element to test. If an array with 2 elements is passed they
     are the ids of 2 elements, whose values are compared for equality. In this case the expected value is ignored
@@ -373,12 +373,12 @@ function checkExpectedValue(expected, index)
         }
     }
 
-    if (animationName && hasPauseAnimationAPI && !internals.pauseAnimationAtTimeOnElement(animationName, time, document.getElementById(elementId))) {
+    if (animationName && hasPauseAnimationAPI && !pauseAnimationAtTimeOnElement(animationName, time, document.getElementById(elementId))) {
         result += "FAIL - animation \"" + animationName + "\" is not running" + "<br>";
         return;
     }
     
-    if (compareElements && !element2Static && animationName && hasPauseAnimationAPI && !internals.pauseAnimationAtTimeOnElement(animationName, time, document.getElementById(elementId2))) {
+    if (compareElements && !element2Static && animationName && hasPauseAnimationAPI && !pauseAnimationAtTimeOnElement(animationName, time, document.getElementById(elementId2))) {
         result += "FAIL - animation \"" + animationName + "\" is not running" + "<br>";
         return;
     }
@@ -510,6 +510,24 @@ function checkExpectedValueCallback(expected, index)
     return function() { checkExpectedValue(expected, index); };
 }
 
+function pauseAnimationAtTimeOnElement(animationName, time, element)
+{
+    // If we haven't opted into CSS Animations and CSS Transitions as Web Animations, use the internal API.
+    if ('internals' in window && !internals.settings.cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled())
+        return internals.pauseAnimationAtTimeOnElement(animationName, time, element);
+
+    // Otherwise, use the Web Animations API.
+    const animations = element.getAnimations();
+    for (let animation of animations) {
+        if (animation instanceof CSSAnimation && animation.animationName == animationName) {
+            animation.currentTime = time * 1000;
+            animation.pause();
+            return true;
+        }
+    }
+    return false;
+}
+
 var testStarted = false;
 function startTest(expected, startCallback, finishCallback)
 {
@@ -526,7 +544,6 @@ function startTest(expected, startCallback, finishCallback)
         var time = expected[i][1];
 
         // We can only use the animation fast-forward mechanism if there's an animation name
-        // and Internals implements pauseAnimationAtTimeOnElement()
         if (animationName && hasPauseAnimationAPI)
             checkExpectedValue(expected, i);
         else {
@@ -546,14 +563,13 @@ function startTest(expected, startCallback, finishCallback)
 }
 
 var result = "";
-var hasPauseAnimationAPI;
+var hasPauseAnimationAPI = true;
 
 if (window.testRunner)
     testRunner.waitUntilDone();
 
 function runAnimationTest(expected, startCallback, event, disablePauseAnimationAPI, doPixelTest, finishCallback)
 {
-    hasPauseAnimationAPI = 'internals' in window;
     if (disablePauseAnimationAPI)
         hasPauseAnimationAPI = false;
 
index 1b376a2..0d3c525 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index eca413e..64a5fa5 100644 (file)
@@ -1,3 +1,4 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <script>
   if (window.internals)
     internals.settings.setSpringTimingFunctionEnabled(true);
index 3f17be9..acb625c 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html>
 <head>
index afce122..3f935ef 100644 (file)
@@ -1,5 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-   "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html lang="en">
 <head>
index 345ecd8..35bf30c 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 
 <html>
 <head>
index f0ad8db..815cafc 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!DOCTYPE html><!-- webkit-test-runner [ enableCSSAnimationsAndCSSTransitionsBackedByWebAnimations=true ] -->
 <html>
 <head>
   <title>Unprefixed keyframes test</title>
index c2b02be..03d8464 100644 (file)
@@ -1,3 +1,17 @@
+2018-03-27  Antoine Quint  <graouts@apple.com>
+
+        [Web Animations] Stop using internals.pauseAnimationAtTimeOnElement() in favor of Web Animations API for animations tests
+        https://bugs.webkit.org/show_bug.cgi?id=184038
+
+        Reviewed by Dean Jackson.
+
+        Expose a new method to indicate that the runtime flag for CSS Animations and CSS Transitions as Web Animations is enabled.
+
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2018-03-27  Thibault Saunier  <tsaunier@igalia.com>
 
         [GStreamer] Enhance debugging in the BasePlayer
index f555ab5..1cfb7a6 100644 (file)
@@ -936,6 +936,11 @@ void InternalSettings::setForcedPrefersReducedMotionAccessibilityValue(InternalS
     settings().setForcedPrefersReducedMotionAccessibilityValue(internalSettingsToSettingsValue(value));
 }
 
+bool InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled()
+{
+    return RuntimeEnabledFeatures::sharedFeatures().cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled();
+}
+
 // If you add to this class, make sure that you update the Backup class for test reproducability!
 
 }
index fba3686..4cc29fe 100644 (file)
@@ -124,6 +124,8 @@ public:
     static void setWebVREnabled(bool);
     static void setScreenCaptureEnabled(bool);
 
+    static bool cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled();
+
 private:
     explicit InternalSettings(Page*);
 
index fd6b3a4..ee5b475 100644 (file)
@@ -109,5 +109,7 @@ enum FontLoadTimingOverride { "Block", "Swap", "Failure" };
 
     [MayThrowException] void setShouldManageAudioSessionCategory(boolean should);
     [MayThrowException] void setCustomPasteboardDataEnabled(boolean enabled);
+
+    [EnabledAtRuntime=WebAnimations] boolean cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled();
 };