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

Side by Side Diff: third_party/WebKit/Source/platform/animation/CompositorAnimationHost.cpp

Issue 2559273003: Blink Compositor Animation: Introduce CompositorAnimationHost correctly. (Closed)
Patch Set: Allocate on stack in unit tests. Created 4 years 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/animation/CompositorAnimationHost.h" 5 #include "platform/animation/CompositorAnimationHost.h"
6 6
7 #include "cc/animation/animation_host.h"
7 #include "cc/animation/scroll_offset_animations.h" 8 #include "cc/animation/scroll_offset_animations.h"
9 #include "platform/animation/CompositorAnimationTimeline.h"
8 10
9 namespace blink { 11 namespace blink {
10 12
11 CompositorAnimationHost::CompositorAnimationHost(cc::AnimationHost* host) 13 CompositorAnimationHost::CompositorAnimationHost(cc::AnimationHost* host)
12 : m_animationHost(host) {} 14 : m_animationHost(host) {
15 DCHECK(m_animationHost);
16 }
13 17
14 bool CompositorAnimationHost::isNull() const { 18 void CompositorAnimationHost::addTimeline(
15 return !m_animationHost; 19 const CompositorAnimationTimeline& timeline) {
20 m_animationHost->AddAnimationTimeline(timeline.animationTimeline());
21 }
22
23 void CompositorAnimationHost::removeTimeline(
24 const CompositorAnimationTimeline& timeline) {
25 m_animationHost->RemoveAnimationTimeline(timeline.animationTimeline());
16 } 26 }
17 27
18 void CompositorAnimationHost::adjustImplOnlyScrollOffsetAnimation( 28 void CompositorAnimationHost::adjustImplOnlyScrollOffsetAnimation(
19 cc::ElementId elementId, 29 CompositorElementId elementId,
20 const gfx::Vector2dF& adjustment) { 30 const gfx::Vector2dF& adjustment) {
21 if (!m_animationHost)
22 return;
23
24 m_animationHost->scroll_offset_animations().AddAdjustmentUpdate(elementId, 31 m_animationHost->scroll_offset_animations().AddAdjustmentUpdate(elementId,
25 adjustment); 32 adjustment);
26 } 33 }
27 34
28 void CompositorAnimationHost::takeOverImplOnlyScrollOffsetAnimation( 35 void CompositorAnimationHost::takeOverImplOnlyScrollOffsetAnimation(
29 cc::ElementId elementId) { 36 CompositorElementId elementId) {
30 if (!m_animationHost)
31 return;
32
33 m_animationHost->scroll_offset_animations().AddTakeoverUpdate(elementId); 37 m_animationHost->scroll_offset_animations().AddTakeoverUpdate(elementId);
34 } 38 }
35 39
36 } // namespace blink 40 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698