forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Web Animations CSS: Unfreeze AnimationClock if sampling timelines doe…
…s not trigger style recalc When sampling the animations and transitions timelines, we set the AnimationClock's time and freeze it so that subsequent accesses of the clock's time during style recalc receive the same value. The clock is unfrozen when style recalc completes. However, if a timeline is sampled after its last Player is removed, it will not trigger style recalc *. This can occur if a transition is cancelled prematurely. In this case, we will fail to unfreeze the clock, so transitions started subsequently will see a stale clock time. This change modifies DocumentTimeline::serviceAnimations() to unfreeze the AnimationClock if it did not trigger a style recalc. It also adds a test to verify this behavior. * In non-CSS uses of the Web Animations model, a timeline can also fail to trigger style recalc if its animations have no effect or no target. BUG=303430,248938 R=timloh@chromium.org Review URL: https://codereview.chromium.org/46043014 git-svn-id: svn://svn.chromium.org/blink/trunk@161134 bbb929c8-8fbe-4397-9dbb-9b2b20218538
- Loading branch information
steveblock@chromium.org
committed
Nov 1, 2013
1 parent
875384f
commit 9940aa1
Showing
16 changed files
with
181 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
third_party/WebKit/LayoutTests/transitions/cancel-and-start-new-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Tests that having stopped a transition before it completes, a subsequent transition starts correctly. | ||
|
||
PASS |
76 changes: 76 additions & 0 deletions
76
third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<!DOCTYPE html> | ||
|
||
<html> | ||
<head> | ||
<style> | ||
#target { | ||
position: relative; | ||
background-color: #933; | ||
width: 50px; | ||
height: 50px; | ||
top: 0px; | ||
left: 0px; | ||
} | ||
#target.transition-top { | ||
top: 400px; | ||
-webkit-transition: top 100ms linear; | ||
transition: top 100ms linear; | ||
} | ||
#target.transition-left { | ||
left: 400px; | ||
-webkit-transition: left 100ms linear; | ||
transition: left 100ms linear; | ||
} | ||
</style> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.dumpAsText(); | ||
testRunner.waitUntilDone(); | ||
} | ||
|
||
function isEqual(actual, desired, tolerance) | ||
{ | ||
var diff = Math.abs(actual - desired); | ||
return diff < tolerance; | ||
} | ||
|
||
function cancelTransition() | ||
{ | ||
document.getElementById("target").classList.remove('transition-top'); | ||
} | ||
|
||
function startNewTransition() | ||
{ | ||
document.getElementById("target").classList.add('transition-left'); | ||
setTimeout(check, 50); | ||
} | ||
|
||
function check() | ||
{ | ||
var left = parseFloat(window.getComputedStyle(document.getElementById('target')).left); | ||
if (isEqual(left, 200, 50)) | ||
var result = "<span style='color:green'>PASS</span>"; | ||
else | ||
var result = "<span style='color:red'>FAIL(was: " + left + ", expected: 200)</span>"; | ||
document.getElementById('result').innerHTML = result; | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
|
||
function start() | ||
{ | ||
document.getElementById("target").classList.add('transition-top'); | ||
setTimeout("cancelTransition()", 50); | ||
setTimeout("startNewTransition()", 100); | ||
} | ||
</script> | ||
</head> | ||
<body onload="start()"> | ||
<p> | ||
Tests that having stopped a transition before it completes, a subsequent | ||
transition starts correctly. | ||
</p> | ||
<div id="target"></div> | ||
<div id="result"></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.