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

Side by Side Diff: Source/core/animation/Animation.cpp

Issue 194673002: Web Animations: Refactor KeyframeEffectModel to work via an InterpolationEffect. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 years, 9 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/animation/Animation.h" 32 #include "core/animation/Animation.h"
33 33
34 #include "bindings/v8/Dictionary.h" 34 #include "bindings/v8/Dictionary.h"
35 #include "core/animation/ActiveAnimations.h" 35 #include "core/animation/ActiveAnimations.h"
36 #include "core/animation/AnimationHelpers.h" 36 #include "core/animation/AnimationHelpers.h"
37 #include "core/animation/CompositorAnimations.h" 37 #include "core/animation/CompositorAnimations.h"
38 #include "core/animation/DocumentTimeline.h" 38 #include "core/animation/DocumentTimeline.h"
39 #include "core/animation/Interpolation.h"
39 #include "core/animation/KeyframeEffectModel.h" 40 #include "core/animation/KeyframeEffectModel.h"
40 #include "core/animation/Player.h" 41 #include "core/animation/Player.h"
41 #include "core/css/parser/BisonCSSParser.h" 42 #include "core/css/parser/BisonCSSParser.h"
42 #include "core/css/resolver/StyleResolver.h" 43 #include "core/css/resolver/StyleResolver.h"
43 #include "core/dom/Element.h" 44 #include "core/dom/Element.h"
44 #include "core/rendering/RenderLayer.h" 45 #include "core/rendering/RenderLayer.h"
45 #include "wtf/text/StringBuilder.h" 46 #include "wtf/text/StringBuilder.h"
46 47
47 namespace WebCore { 48 namespace WebCore {
48 49
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 return; 353 return;
353 354
354 if (player() && !previouslyInEffect) { 355 if (player() && !previouslyInEffect) {
355 ensureAnimationStack(m_target.get()).add(this); 356 ensureAnimationStack(m_target.get()).add(this);
356 m_activeInAnimationStack = true; 357 m_activeInAnimationStack = true;
357 } 358 }
358 359
359 double iteration = currentIteration(); 360 double iteration = currentIteration();
360 ASSERT(iteration >= 0); 361 ASSERT(iteration >= 0);
361 // FIXME: Handle iteration values which overflow int. 362 // FIXME: Handle iteration values which overflow int.
362 m_compositableValues = m_effect->sample(static_cast<int>(iteration), timeFra ction()); 363 m_activeInterpolations = m_effect->sample(static_cast<int>(iteration), timeF raction());
363 if (player()) 364 if (player())
364 m_target->setNeedsAnimationStyleRecalc(); 365 m_target->setNeedsAnimationStyleRecalc();
365 } 366 }
366 367
367 void Animation::clearEffects() 368 void Animation::clearEffects()
368 { 369 {
369 ASSERT(player()); 370 ASSERT(player());
370 ASSERT(m_activeInAnimationStack); 371 ASSERT(m_activeInAnimationStack);
371 ensureAnimationStack(m_target.get()).remove(this); 372 ensureAnimationStack(m_target.get()).remove(this);
372 373
373 { 374 {
374 // FIXME: clearEffects is called from withins style recalc. 375 // FIXME: clearEffects is called from withins style recalc.
375 // This queries compositingState, which is not necessarily up to date. 376 // This queries compositingState, which is not necessarily up to date.
376 // https://code.google.com/p/chromium/issues/detail?id=339847 377 // https://code.google.com/p/chromium/issues/detail?id=339847
377 DisableCompositingQueryAsserts disabler; 378 DisableCompositingQueryAsserts disabler;
378 cancelAnimationOnCompositor(); 379 cancelAnimationOnCompositor();
379 } 380 }
380 381
381 m_activeInAnimationStack = false; 382 m_activeInAnimationStack = false;
382 m_compositableValues.clear(); 383 m_activeInterpolations.clear();
383 m_target->setNeedsAnimationStyleRecalc(); 384 m_target->setNeedsAnimationStyleRecalc();
384 invalidate(); 385 invalidate();
385 } 386 }
386 387
387 void Animation::updateChildrenAndEffects() const 388 void Animation::updateChildrenAndEffects() const
388 { 389 {
389 if (!m_effect) 390 if (!m_effect)
390 return; 391 return;
391 if (isInEffect()) 392 if (isInEffect())
392 const_cast<Animation*>(this)->applyEffects(m_activeInAnimationStack); 393 const_cast<Animation*>(this)->applyEffects(m_activeInAnimationStack);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime) 479 void Animation::pauseAnimationForTestingOnCompositor(double pauseTime)
479 { 480 {
480 ASSERT(hasActiveAnimationsOnCompositor()); 481 ASSERT(hasActiveAnimationsOnCompositor());
481 if (!m_target || !m_target->renderer()) 482 if (!m_target || !m_target->renderer())
482 return; 483 return;
483 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i) 484 for (size_t i = 0; i < m_compositorAnimationIds.size(); ++i)
484 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime); 485 CompositorAnimations::instance()->pauseAnimationForTestingOnCompositor(* m_target.get(), m_compositorAnimationIds[i], pauseTime);
485 } 486 }
486 487
487 } // namespace WebCore 488 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698