Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: third_party/WebKit/Source/core/animation/KeyframeEffect.cpp

Issue 1933113002: Web Animations: Clip animation active intervals if endDelay is negative (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
index 9696eac0d44430a4da3b25330f875e777077fa14..73e5e3868c379627062195772c6960adf7096722 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
@@ -232,21 +232,23 @@ void KeyframeEffect::updateChildrenAndEffects() const
double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const
{
- const double start = specifiedTiming().startDelay;
- const double end = start + activeDurationInternal();
+ const double startTime = specifiedTiming().startDelay;
+ const double endTimeMinusEndDelay = startTime + activeDurationInternal();
+ const double endTime = endTimeMinusEndDelay + specifiedTiming().endDelay;
+ const double afterTime = std::min(endTimeMinusEndDelay, endTime);
switch (getPhase()) {
case PhaseNone:
return std::numeric_limits<double>::infinity();
case PhaseBefore:
- ASSERT(start >= localTime);
+ ASSERT(startTime >= localTime);
return forwards
- ? start - localTime
+ ? startTime - localTime
: std::numeric_limits<double>::infinity();
case PhaseActive:
if (forwards) {
// Need service to apply fill / fire events.
- const double timeToEnd = end - localTime;
+ const double timeToEnd = afterTime - localTime;
if (requiresIterationEvents()) {
return std::min(timeToEnd, timeToNextIteration);
}
@@ -254,13 +256,13 @@ double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTi
}
return 0;
case PhaseAfter:
- ASSERT(localTime >= end);
+ ASSERT(localTime >= afterTime);
// If this KeyframeEffect is still in effect then it will need to update
// when its parent goes out of effect. We have no way of knowing when
// that will be, however, so the parent will need to supply it.
return forwards
? std::numeric_limits<double>::infinity()
- : localTime - end;
+ : localTime - afterTime;
default:
ASSERT_NOT_REACHED();
return std::numeric_limits<double>::infinity();

Powered by Google App Engine
This is Rietveld 408576698