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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 return; 225 return;
226 ASSERT(animation()); 226 ASSERT(animation());
227 if (isInEffect() && !animation()->effectSuppressed()) 227 if (isInEffect() && !animation()->effectSuppressed())
228 const_cast<KeyframeEffect*>(this)->applyEffects(); 228 const_cast<KeyframeEffect*>(this)->applyEffects();
229 else if (m_sampledEffect) 229 else if (m_sampledEffect)
230 const_cast<KeyframeEffect*>(this)->clearEffects(); 230 const_cast<KeyframeEffect*>(this)->clearEffects();
231 } 231 }
232 232
233 double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTi me, double timeToNextIteration) const 233 double KeyframeEffect::calculateTimeToEffectChange(bool forwards, double localTi me, double timeToNextIteration) const
234 { 234 {
235 const double start = specifiedTiming().startDelay; 235 const double startTime = specifiedTiming().startDelay;
236 const double end = start + activeDurationInternal(); 236 const double endTimeMinusEndDelay = startTime + activeDurationInternal();
237 const double endTime = endTimeMinusEndDelay + specifiedTiming().endDelay;
238 const double afterTime = std::min(endTimeMinusEndDelay, endTime);
237 239
238 switch (getPhase()) { 240 switch (getPhase()) {
239 case PhaseNone: 241 case PhaseNone:
240 return std::numeric_limits<double>::infinity(); 242 return std::numeric_limits<double>::infinity();
241 case PhaseBefore: 243 case PhaseBefore:
242 ASSERT(start >= localTime); 244 ASSERT(startTime >= localTime);
243 return forwards 245 return forwards
244 ? start - localTime 246 ? startTime - localTime
245 : std::numeric_limits<double>::infinity(); 247 : std::numeric_limits<double>::infinity();
246 case PhaseActive: 248 case PhaseActive:
247 if (forwards) { 249 if (forwards) {
248 // Need service to apply fill / fire events. 250 // Need service to apply fill / fire events.
249 const double timeToEnd = end - localTime; 251 const double timeToEnd = afterTime - localTime;
250 if (requiresIterationEvents()) { 252 if (requiresIterationEvents()) {
251 return std::min(timeToEnd, timeToNextIteration); 253 return std::min(timeToEnd, timeToNextIteration);
252 } 254 }
253 return timeToEnd; 255 return timeToEnd;
254 } 256 }
255 return 0; 257 return 0;
256 case PhaseAfter: 258 case PhaseAfter:
257 ASSERT(localTime >= end); 259 ASSERT(localTime >= afterTime);
258 // If this KeyframeEffect is still in effect then it will need to update 260 // If this KeyframeEffect is still in effect then it will need to update
259 // when its parent goes out of effect. We have no way of knowing when 261 // when its parent goes out of effect. We have no way of knowing when
260 // that will be, however, so the parent will need to supply it. 262 // that will be, however, so the parent will need to supply it.
261 return forwards 263 return forwards
262 ? std::numeric_limits<double>::infinity() 264 ? std::numeric_limits<double>::infinity()
263 : localTime - end; 265 : localTime - afterTime;
264 default: 266 default:
265 ASSERT_NOT_REACHED(); 267 ASSERT_NOT_REACHED();
266 return std::numeric_limits<double>::infinity(); 268 return std::numeric_limits<double>::infinity();
267 } 269 }
268 } 270 }
269 271
270 void KeyframeEffect::notifySampledEffectRemovedFromAnimationStack() 272 void KeyframeEffect::notifySampledEffectRemovedFromAnimationStack()
271 { 273 {
272 m_sampledEffect = nullptr; 274 m_sampledEffect = nullptr;
273 } 275 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 371
370 DEFINE_TRACE(KeyframeEffect) 372 DEFINE_TRACE(KeyframeEffect)
371 { 373 {
372 visitor->trace(m_target); 374 visitor->trace(m_target);
373 visitor->trace(m_model); 375 visitor->trace(m_model);
374 visitor->trace(m_sampledEffect); 376 visitor->trace(m_sampledEffect);
375 AnimationEffect::trace(visitor); 377 AnimationEffect::trace(visitor);
376 } 378 }
377 379
378 } // namespace blink 380 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698