Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/svg/animation/SMILTimeContainer.h" | 26 #include "core/svg/animation/SMILTimeContainer.h" |
| 27 | 27 |
| 28 #include "core/animation/AnimationClock.h" | 28 #include "core/animation/AnimationClock.h" |
| 29 #include "core/animation/AnimationTimeline.h" | 29 #include "core/animation/AnimationTimeline.h" |
| 30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
| 31 #include "core/frame/FrameView.h" | 31 #include "core/frame/FrameView.h" |
| 32 #include "core/frame/Settings.h" | 32 #include "core/frame/Settings.h" |
| 33 #include "core/frame/UseCounter.h" | |
| 33 #include "core/svg/SVGSVGElement.h" | 34 #include "core/svg/SVGSVGElement.h" |
| 34 #include "core/svg/animation/SVGSMILElement.h" | 35 #include "core/svg/animation/SVGSMILElement.h" |
| 35 #include <algorithm> | 36 #include <algorithm> |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 static const double initialFrameDelay = 0.025; | 40 static const double initialFrameDelay = 0.025; |
| 40 static const double animationPolicyOnceDuration = 3.000; | 41 static const double animationPolicyOnceDuration = 3.000; |
| 41 | 42 |
| 42 SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner) | 43 SMILTimeContainer::SMILTimeContainer(SVGSVGElement& owner) |
| 43 : m_beginTime(0) | 44 : m_beginTime(0) |
| 44 , m_pauseTime(0) | 45 , m_pauseTime(0) |
| 45 , m_resumeTime(0) | 46 , m_resumeTime(0) |
| 46 , m_accumulatedActiveTime(0) | 47 , m_accumulatedActiveTime(0) |
| 47 , m_presetStartTime(0) | 48 , m_presetStartTime(0) |
| 48 , m_frameSchedulingState(Idle) | 49 , m_frameSchedulingState(Idle) |
| 49 , m_documentOrderIndexesDirty(false) | 50 , m_documentOrderIndexesDirty(false) |
| 51 , m_hasUpdatedAnimation(false) | |
| 50 , m_wakeupTimer(this, &SMILTimeContainer::wakeupTimerFired) | 52 , m_wakeupTimer(this, &SMILTimeContainer::wakeupTimerFired) |
| 51 , m_animationPolicyOnceTimer(this, &SMILTimeContainer::animationPolicyTimerF ired) | 53 , m_animationPolicyOnceTimer(this, &SMILTimeContainer::animationPolicyTimerF ired) |
| 52 , m_ownerSVGElement(&owner) | 54 , m_ownerSVGElement(&owner) |
| 53 #if ENABLE(ASSERT) | 55 #if ENABLE(ASSERT) |
| 54 , m_preventScheduledAnimationsChanges(false) | 56 , m_preventScheduledAnimationsChanges(false) |
| 55 #endif | 57 #endif |
| 56 { | 58 { |
| 57 } | 59 } |
| 58 | 60 |
| 59 SMILTimeContainer::~SMILTimeContainer() | 61 SMILTimeContainer::~SMILTimeContainer() |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompar e(elapsed)); | 507 std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompar e(elapsed)); |
| 506 | 508 |
| 507 unsigned animationsToApplySize = animationsToApply.size(); | 509 unsigned animationsToApplySize = animationsToApply.size(); |
| 508 if (!animationsToApplySize) { | 510 if (!animationsToApplySize) { |
| 509 #if ENABLE(ASSERT) | 511 #if ENABLE(ASSERT) |
| 510 m_preventScheduledAnimationsChanges = false; | 512 m_preventScheduledAnimationsChanges = false; |
| 511 #endif | 513 #endif |
| 512 return earliestFireTime; | 514 return earliestFireTime; |
| 513 } | 515 } |
| 514 | 516 |
| 517 if (!m_hasUpdatedAnimation) { | |
| 518 m_hasUpdatedAnimation = true; | |
| 519 UseCounter::count(&document(), UseCounter::SVGSMILAnimationAppliedEffect ); | |
|
fs
2016/07/21 10:17:33
You could ditch the m_hasUpdatedAnimation - once t
suzyh_UTC10 (ex-contributor)
2016/07/25 03:16:00
Done.
| |
| 520 } | |
| 521 | |
| 515 // Apply results to target elements. | 522 // Apply results to target elements. |
| 516 for (unsigned i = 0; i < animationsToApplySize; ++i) | 523 for (unsigned i = 0; i < animationsToApplySize; ++i) |
| 517 animationsToApply[i]->applyResultsToTarget(); | 524 animationsToApply[i]->applyResultsToTarget(); |
| 518 | 525 |
| 519 #if ENABLE(ASSERT) | 526 #if ENABLE(ASSERT) |
| 520 m_preventScheduledAnimationsChanges = false; | 527 m_preventScheduledAnimationsChanges = false; |
| 521 #endif | 528 #endif |
| 522 | 529 |
| 523 for (unsigned i = 0; i < animationsToApplySize; ++i) { | 530 for (unsigned i = 0; i < animationsToApplySize; ++i) { |
| 524 if (animationsToApply[i]->isConnected() && animationsToApply[i]->isSVGDi scardElement()) { | 531 if (animationsToApply[i]->isConnected() && animationsToApply[i]->isSVGDi scardElement()) { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 543 setElapsed(elapsed().value() + initialFrameDelay); | 550 setElapsed(elapsed().value() + initialFrameDelay); |
| 544 } | 551 } |
| 545 | 552 |
| 546 DEFINE_TRACE(SMILTimeContainer) | 553 DEFINE_TRACE(SMILTimeContainer) |
| 547 { | 554 { |
| 548 visitor->trace(m_scheduledAnimations); | 555 visitor->trace(m_scheduledAnimations); |
| 549 visitor->trace(m_ownerSVGElement); | 556 visitor->trace(m_ownerSVGElement); |
| 550 } | 557 } |
| 551 | 558 |
| 552 } // namespace blink | 559 } // namespace blink |
| OLD | NEW |