Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 15 matching lines...) Expand all Loading... | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/animation/AnimationTimeline.h" | 31 #include "core/animation/AnimationTimeline.h" |
| 32 | 32 |
| 33 #include "core/animation/AnimationClock.h" | 33 #include "core/animation/AnimationClock.h" |
| 34 #include "core/animation/ElementAnimations.h" | 34 #include "core/animation/ElementAnimations.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/StyleChangeReason.h" | |
| 36 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
| 37 #include "core/loader/DocumentLoader.h" | 38 #include "core/loader/DocumentLoader.h" |
| 38 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
| 39 #include "platform/RuntimeEnabledFeatures.h" | 40 #include "platform/RuntimeEnabledFeatures.h" |
| 40 #include "platform/TraceEvent.h" | 41 #include "platform/TraceEvent.h" |
| 41 #include "platform/animation/CompositorAnimationTimeline.h" | 42 #include "platform/animation/CompositorAnimationTimeline.h" |
| 42 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 43 #include "public/platform/WebCompositorSupport.h" | 44 #include "public/platform/WebCompositorSupport.h" |
| 44 #include "wtf/PtrUtil.h" | 45 #include "wtf/PtrUtil.h" |
| 45 #include <algorithm> | 46 #include <algorithm> |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 64 { | 65 { |
| 65 return new AnimationTimeline(document, timing); | 66 return new AnimationTimeline(document, timing); |
| 66 } | 67 } |
| 67 | 68 |
| 68 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) | 69 AnimationTimeline::AnimationTimeline(Document* document, PlatformTiming* timing) |
| 69 : m_document(document) | 70 : m_document(document) |
| 70 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader | 71 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the loader |
| 71 , m_zeroTimeInitialized(false) | 72 , m_zeroTimeInitialized(false) |
| 72 , m_outdatedAnimationCount(0) | 73 , m_outdatedAnimationCount(0) |
| 73 , m_playbackRate(1) | 74 , m_playbackRate(1) |
| 74 , m_lastCurrentTimeInternal(0) | 75 , m_lastCurrentTimeInternal(0) |
|
alancutter (OOO until 2018)
2016/06/29 03:41:32
We should initialise m_hasUnresolvedKeyframesRule
| |
| 75 { | 76 { |
| 76 ThreadState::current()->registerPreFinalizer(this); | 77 ThreadState::current()->registerPreFinalizer(this); |
| 77 if (!timing) | 78 if (!timing) |
| 78 m_timing = new AnimationTimelineTiming(this); | 79 m_timing = new AnimationTimelineTiming(this); |
| 79 else | 80 else |
| 80 m_timing = timing; | 81 m_timing = timing; |
| 81 | 82 |
| 82 if (Platform::current()->isThreadedAnimationEnabled()) | 83 if (Platform::current()->isThreadedAnimationEnabled()) |
| 83 m_compositorTimeline = CompositorAnimationTimeline::create(); | 84 m_compositorTimeline = CompositorAnimationTimeline::create(); |
| 84 | 85 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 for (const auto& animation : m_animations) { | 341 for (const auto& animation : m_animations) { |
| 341 animation->setCompositorPending(sourceChanged); | 342 animation->setCompositorPending(sourceChanged); |
| 342 } | 343 } |
| 343 } | 344 } |
| 344 | 345 |
| 345 double AnimationTimeline::playbackRate() const | 346 double AnimationTimeline::playbackRate() const |
| 346 { | 347 { |
| 347 return m_playbackRate; | 348 return m_playbackRate; |
| 348 } | 349 } |
| 349 | 350 |
| 351 void AnimationTimeline::keyframesRulesAdded() | |
| 352 { | |
| 353 if (m_hasUnresolvedKeyframesRule) { | |
| 354 m_hasUnresolvedKeyframesRule = false; | |
| 355 if (m_document) | |
| 356 m_document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReaso nForTracing::create(StyleChangeReason::Animation)); | |
| 357 return; | |
| 358 } | |
| 359 | |
| 360 for (const auto& animation : m_animations) { | |
| 361 const AnimationEffect* effect = animation->effect(); | |
| 362 if (!effect) | |
| 363 continue; | |
| 364 if (!effect->isKeyframeEffect()) | |
| 365 continue; | |
| 366 toKeyframeEffect(effect)->target()->setNeedsStyleRecalc(LocalStyleChange , StyleChangeReasonForTracing::create(StyleChangeReason::Animation)); | |
| 367 } | |
| 368 } | |
| 369 | |
| 350 DEFINE_TRACE(AnimationTimeline) | 370 DEFINE_TRACE(AnimationTimeline) |
| 351 { | 371 { |
| 352 visitor->trace(m_document); | 372 visitor->trace(m_document); |
| 353 visitor->trace(m_timing); | 373 visitor->trace(m_timing); |
| 354 visitor->trace(m_animationsNeedingUpdate); | 374 visitor->trace(m_animationsNeedingUpdate); |
| 355 visitor->trace(m_animations); | 375 visitor->trace(m_animations); |
| 356 } | 376 } |
| 357 | 377 |
| 358 } // namespace blink | 378 } // namespace blink |
| OLD | NEW |