Bug 1141710, part 7 - Store the generated 'animation' property string in a global constant and reuse that constant. r=dholbert
☠☠ backed out by 24872a839d9d ☠ ☠
authorJonathan Watt <jwatt@jwatt.org>
Tue, 03 Mar 2015 17:40:26 +0000
changeset 232912 9496b1468d9cefa27eb5db157a935f5d32d39988
parent 232911 e1330135150d1d502d83ef79de95e1ac18a235e5
child 232913 c67f9c7dfd4ec05f4d9b49f0e822f0187df6aeb5
push id56680
push userjwatt@jwatt.org
push dateWed, 11 Mar 2015 00:34:08 +0000
treeherdermozilla-inbound@0e360d3f690b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1141710
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1141710, part 7 - Store the generated 'animation' property string in a global constant and reuse that constant. r=dholbert
dom/animation/test/css-animations/test_animation-player-starttime.html
--- a/dom/animation/test/css-animations/test_animation-player-starttime.html
+++ b/dom/animation/test/css-animations/test_animation-player-starttime.html
@@ -37,16 +37,17 @@
 // checker helpers to ensure that computedTiming's properties are updated as
 // expected.
 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1108055
 
 
 const CSS_ANIM_EVENTS = ['animationstart', 'animationiteration', 'animationend'];
 const ANIM_DELAY_MS = 1000000; // 1000s
 const ANIM_DUR_MS = 1000000; // 1000s
+const ANIM_PROPERTY_VAL = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
 
 /**
  * These helpers get the value that the startTime needs to be set to, to put an
  * animation that uses the above ANIM_DELAY_MS and ANIM_DUR_MS values into the
  * before, active and after phases, respectively.
  */
 function startTimeForBeforePhase(timeline) {
   return timeline.currentTime - ANIM_DELAY_MS / 2;
@@ -293,17 +294,17 @@ function checkStateAtActiveIntervalEndTi
     'by the animation at the end of the active duration');
 }
 
 
 test(function(t)
 {
   var div = addDiv(t, {'class': 'animated-div'});
 
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
 
   var player = div.getAnimationPlayers()[0];
 
   // Animations shouldn't start until the next paint tick, so:
   assert_equals(player.startTime, null,
     'AnimationPlayer.startTime should be unresolved when an animation ' +
     'is initially created');
 
@@ -329,17 +330,17 @@ test(function(t)
   checkStateOnSettingStartTimeToAnimationCreationTime(player);
 }, 'Examine newly created Animation');
 
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
 
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
 
   var player = div.getAnimationPlayers()[0];
 
   player.ready.then(t.step_func(function() {
     checkStateOnReadyPromiseResolved(player);
 
     player.startTime = document.timeline.currentTime - ANIM_DELAY_MS; // jump to start of active interval
     return eventWatcher.waitForEvent('animationstart');
@@ -365,17 +366,17 @@ async_test(function(t) {
   });
 }, 'Skipping forward through animation');
 
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
 
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
 
   var player = div.getAnimationPlayers()[0];
 
   player.startTime = document.timeline.currentTime - ANIM_DELAY_MS - ANIM_DUR_MS; // end of active interval
 
   // Skipping over the active interval will dispatch an 'animationstart' then
   // an 'animationend' event. We need to wait for these events before we start
   // testing going backwards since EventWatcher will fail the test if it gets
@@ -430,47 +431,47 @@ async_test(function(t) {
 // (block this test from finishing forever), so instead we just listen for
 // events until two animation frames (i.e. requestAnimationFrame callbacks)
 // have happened, then assume that no events will ever be dispatched for the
 // redundant changes if no events were detected in that time.
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   player.startTime = startTimeForActivePhase(player.timeline);
   player.startTime = startTimeForBeforePhase(player.timeline);
 
   waitForTwoAnimationFrames().then(function() {
     eventWatcher.stopWatching();
     t.done();
   });
 }, 'Redundant change, before -> active, then back');
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   player.startTime = startTimeForAfterPhase(player.timeline);
   player.startTime = startTimeForBeforePhase(player.timeline);
 
   waitForTwoAnimationFrames().then(function() {
     eventWatcher.stopWatching();
     t.done();
   });
 }, 'Redundant change, before -> after, then back');
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   eventWatcher.waitForEvent('animationstart').then(function() {
     player.startTime = startTimeForBeforePhase(player.timeline);
     player.startTime = startTimeForActivePhase(player.timeline);
 
     waitForTwoAnimationFrames().then(function() {
       eventWatcher.stopWatching();
@@ -479,17 +480,17 @@ async_test(function(t) {
   });
   // get us into the initial state:
   player.startTime = startTimeForActivePhase(player.timeline);
 }, 'Redundant change, active -> before, then back');
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   eventWatcher.waitForEvent('animationstart').then(function() {
     player.startTime = startTimeForAfterPhase(player.timeline);
     player.startTime = startTimeForActivePhase(player.timeline);
 
     waitForTwoAnimationFrames().then(function() {
       eventWatcher.stopWatching();
@@ -498,17 +499,17 @@ async_test(function(t) {
   });
   // get us into the initial state:
   player.startTime = startTimeForActivePhase(player.timeline);
 }, 'Redundant change, active -> after, then back');
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   eventWatcher.waitForEvents(['animationstart', 'animationend']).then(function() {
     player.startTime = startTimeForBeforePhase(player.timeline);
     player.startTime = startTimeForAfterPhase(player.timeline);
 
     waitForTwoAnimationFrames().then(function() {
       eventWatcher.stopWatching();
@@ -517,17 +518,17 @@ async_test(function(t) {
   });
   // get us into the initial state:
   player.startTime = startTimeForAfterPhase(player.timeline);
 }, 'Redundant change, after -> before, then back');
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
   var eventWatcher = new EventWatcher(div, CSS_ANIM_EVENTS);
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
   var player = div.getAnimationPlayers()[0];
 
   eventWatcher.waitForEvents(['animationstart', 'animationend']).then(function() {
     player.startTime = startTimeForActivePhase(player.timeline);
     player.startTime = startTimeForAfterPhase(player.timeline);
 
     waitForTwoAnimationFrames().then(function() {
       eventWatcher.stopWatching();
@@ -536,17 +537,17 @@ async_test(function(t) {
   });
   // get us into the initial state:
   player.startTime = startTimeForAfterPhase(player.timeline);
 }, 'Redundant change, after -> active, then back');
 
 
 async_test(function(t) {
   var div = addDiv(t, {'class': 'animated-div'});
-  div.style.animation = 'anim ' + ANIM_DUR_MS + 'ms ' + ANIM_DELAY_MS + 'ms';
+  div.style.animation = ANIM_PROPERTY_VAL;
 
   var player = div.getAnimationPlayers()[0];
 
   player.ready.then(t.step_func(function() {
     player.startTime = null;
     return player.ready;
   })).catch(t.step_func(function(reason) {
     assert_unreached(reason);