Chromium Code Reviews| Index: Source/core/svg/animation/SMILTimeContainer.cpp |
| diff --git a/Source/core/svg/animation/SMILTimeContainer.cpp b/Source/core/svg/animation/SMILTimeContainer.cpp |
| index ea7c17eb12de3af5d027dd33b6048aa3c0bcc003..47a1aed5859f6458537aab67b2a63ff28b151391 100644 |
| --- a/Source/core/svg/animation/SMILTimeContainer.cpp |
| +++ b/Source/core/svg/animation/SMILTimeContainer.cpp |
| @@ -30,12 +30,14 @@ |
| #include "core/animation/AnimationTimeline.h" |
| #include "core/dom/ElementTraversal.h" |
| #include "core/frame/FrameView.h" |
| +#include "core/frame/Settings.h" |
| #include "core/svg/SVGSVGElement.h" |
| #include "core/svg/animation/SVGSMILElement.h" |
| namespace blink { |
| static const double initialFrameDelay = 0.025; |
| +static const double animationPolicyOnceDuration = 3.000; |
| #if !ENABLE(OILPAN) |
| // Every entry-point that calls updateAnimations() should instantiate a |
| @@ -58,6 +60,7 @@ SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner) |
| , m_frameSchedulingState(Idle) |
| , m_documentOrderIndexesDirty(false) |
| , m_wakeupTimer(this, &SMILTimeContainer::wakeupTimerFired) |
| + , m_animationPolicyOnceTimer(this, &SMILTimeContainer::animationPolicyOnceTimerFired) |
| , m_ownerSVGElement(owner) |
| #if ENABLE(ASSERT) |
| , m_preventScheduledAnimationsChanges(false) |
| @@ -163,6 +166,16 @@ bool SMILTimeContainer::isStarted() const |
| void SMILTimeContainer::begin() |
| { |
| RELEASE_ASSERT(!m_beginTime); |
| + |
| + if (document().settings()) { |
| + ImageAnimationPolicy animationPolicy = document().settings()->imageAnimationPolicy(); |
|
fs
2014/12/18 16:45:18
I'd suggest you move these two into a helper funct
je_julie(Not used)
2014/12/22 15:05:18
Done.
|
| + if (animationPolicy == ImageAnimationPolicyNoAnimation) |
| + return; |
|
fs
2014/12/18 16:45:18
I'm a bit worried that this will leave us in an in
je_julie(Not used)
2014/12/22 15:05:18
I updated new concept with considering DOM APIs.
|
| + // Repeating behavior is not well-defined for SMIL/SVG animations |
| + // We define "once" as "play for animationPolicyOnceDuration seconds" here instead. |
| + if (animationPolicy == ImageAnimationPolicyAnimateOnce) |
| + m_animationPolicyOnceTimer.startOneShot(animationPolicyOnceDuration, FROM_HERE); |
|
fs
2014/12/18 16:45:18
I suppose this is one way to implement this. It ha
je_julie(Not used)
2014/12/22 15:05:18
Please check my new concept.
|
| + } |
| double now = currentTime(); |
| // If 'm_presetStartTime' is set, the timeline was modified via setElapsed() before the document began. |
| @@ -221,6 +234,15 @@ void SMILTimeContainer::setElapsed(SMILTime time) |
| return; |
| } |
| + // If imageAnimationPolicy is 'once', animation is stopped at animationPolicyOnceDuration. |
| + // setElapsed over animationPolicyOnceDuration is not allowed. |
| + if (document().settings()) { |
| + ImageAnimationPolicy animationPolicy = document().settings()->imageAnimationPolicy(); |
| + if (animationPolicy == ImageAnimationPolicyAnimateOnce |
| + && time.value() > animationPolicyOnceDuration) |
| + time = SMILTime(animationPolicyOnceDuration); |
|
fs
2014/12/18 16:45:18
Should be possible to simply do:
time = std::min(
je_julie(Not used)
2014/12/22 15:05:18
Please check my new concept.
|
| + } |
| + |
| cancelAnimationFrame(); |
| double now = currentTime(); |
| @@ -295,6 +317,11 @@ void SMILTimeContainer::wakeupTimerFired(Timer<SMILTimeContainer>*) |
| } |
| } |
| +void SMILTimeContainer::animationPolicyOnceTimerFired(Timer<SMILTimeContainer>*) |
| +{ |
| + cancelAnimationFrame(); |
|
fs
2014/12/18 16:45:18
I don't think is enough (see above about DOM metho
je_julie(Not used)
2014/12/22 15:05:18
I added new function for freeze.
|
| +} |
| + |
| void SMILTimeContainer::updateDocumentOrderIndexes() |
| { |
| unsigned timingElementCount = 0; |