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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollAnimator.cpp

Issue 1616653002: CC Animation: Move files from cc_blink to Source/platform/animation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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) 2011, Google Inc. All rights reserved. 2 * Copyright (c) 2011, 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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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 "platform/scroll/ScrollAnimator.h" 31 #include "platform/scroll/ScrollAnimator.h"
32 32
33 #include "platform/CompositorFactory.h"
33 #include "platform/TraceEvent.h" 34 #include "platform/TraceEvent.h"
34 #include "platform/graphics/GraphicsLayer.h" 35 #include "platform/graphics/GraphicsLayer.h"
35 #include "platform/scroll/ScrollableArea.h" 36 #include "platform/scroll/ScrollableArea.h"
36 #include "public/platform/Platform.h" 37 #include "public/platform/Platform.h"
37 #include "public/platform/WebCompositorAnimation.h" 38 #include "public/platform/WebCompositorAnimation.h"
38 #include "public/platform/WebCompositorSupport.h" 39 #include "public/platform/WebCompositorSupport.h"
39 #include "wtf/CurrentTime.h" 40 #include "wtf/CurrentTime.h"
40 #include "wtf/PassRefPtr.h" 41 #include "wtf/PassRefPtr.h"
41 42
42 namespace blink { 43 namespace blink {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 218
218 m_compositorAnimationId = 0; 219 m_compositorAnimationId = 0;
219 m_compositorAnimationGroupId = 0; 220 m_compositorAnimationGroupId = 0;
220 221
221 m_animationCurve->updateTarget(m_timeFunction() - m_startTime, 222 m_animationCurve->updateTarget(m_timeFunction() - m_startTime,
222 m_targetOffset); 223 m_targetOffset);
223 m_runState = RunState::WaitingToSendToCompositor; 224 m_runState = RunState::WaitingToSendToCompositor;
224 } 225 }
225 226
226 if (!m_animationCurve) { 227 if (!m_animationCurve) {
227 m_animationCurve = adoptPtr(Platform::current()->compositorSupport() 228 m_animationCurve = adoptPtr(CompositorFactory::current().createScrol lOffsetAnimationCurve(
228 ->createScrollOffsetAnimationCurve( 229 m_targetOffset,
229 m_targetOffset, 230 WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut,
230 WebCompositorAnimationCurve::TimingFunctionTypeEaseInOut, 231 m_lastGranularity == ScrollByPixel ? WebScrollOffsetAnimationCur ve::ScrollDurationInverseDelta : WebScrollOffsetAnimationCurve::ScrollDurationCo nstant));
231 m_lastGranularity == ScrollByPixel ?
232 WebScrollOffsetAnimationCurve::ScrollDurationInverseDelt a :
233 WebScrollOffsetAnimationCurve::ScrollDurationConstant));
234 m_animationCurve->setInitialValue(currentPosition()); 232 m_animationCurve->setInitialValue(currentPosition());
235 } 233 }
236 234
237 bool sentToCompositor = false; 235 bool sentToCompositor = false;
238 if (GraphicsLayer* layer = m_scrollableArea->layerForScrolling()) { 236 if (GraphicsLayer* layer = m_scrollableArea->layerForScrolling()) {
239 ASSERT(layer->scrollableArea() == m_scrollableArea); 237 ASSERT(layer->scrollableArea() == m_scrollableArea);
240 if (!layer->platformLayer()->shouldScrollOnMainThread()) { 238 if (!layer->platformLayer()->shouldScrollOnMainThread()) {
241 OwnPtr<WebCompositorAnimation> animation = adoptPtr( 239 OwnPtr<WebCompositorAnimation> animation = adoptPtr(
242 Platform::current()->compositorSupport()->createAnimation( 240 Platform::current()->compositorSupport()->createAnimation(
243 *m_animationCurve, 241 *m_animationCurve,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 300 }
303 return true; 301 return true;
304 } 302 }
305 303
306 DEFINE_TRACE(ScrollAnimator) 304 DEFINE_TRACE(ScrollAnimator)
307 { 305 {
308 ScrollAnimatorBase::trace(visitor); 306 ScrollAnimatorBase::trace(visitor);
309 } 307 }
310 308
311 } // namespace blink 309 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698