OLD | NEW |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 m_compositorAnimationId = 0; | 219 m_compositorAnimationId = 0; |
220 m_compositorAnimationGroupId = 0; | 220 m_compositorAnimationGroupId = 0; |
221 | 221 |
222 m_animationCurve->updateTarget(m_timeFunction() - m_startTime, | 222 m_animationCurve->updateTarget(m_timeFunction() - m_startTime, |
223 m_targetOffset); | 223 m_targetOffset); |
224 m_runState = RunState::WaitingToSendToCompositor; | 224 m_runState = RunState::WaitingToSendToCompositor; |
225 } | 225 } |
226 | 226 |
227 if (!m_animationCurve) { | 227 if (!m_animationCurve) { |
228 m_animationCurve = adoptPtr(CompositorFactory::current().createScrol
lOffsetAnimationCurve( | 228 m_animationCurve = CompositorFactory::current().createScrollOffsetAn
imationCurve( |
229 m_targetOffset, | 229 m_targetOffset, |
230 CompositorAnimationCurve::TimingFunctionTypeEaseInOut, | 230 CompositorAnimationCurve::TimingFunctionTypeEaseInOut, |
231 m_lastGranularity == ScrollByPixel ? | 231 m_lastGranularity == ScrollByPixel ? |
232 CompositorScrollOffsetAnimationCurve::ScrollDurationInverseD
elta : | 232 CompositorScrollOffsetAnimationCurve::ScrollDurationInverseD
elta : |
233 CompositorScrollOffsetAnimationCurve::ScrollDurationConstant
)); | 233 CompositorScrollOffsetAnimationCurve::ScrollDurationConstant
); |
234 m_animationCurve->setInitialValue(currentPosition()); | 234 m_animationCurve->setInitialValue(currentPosition()); |
235 } | 235 } |
236 | 236 |
237 bool sentToCompositor = false; | 237 bool sentToCompositor = false; |
238 if (!m_scrollableArea->shouldScrollOnMainThread()) { | 238 if (!m_scrollableArea->shouldScrollOnMainThread()) { |
239 OwnPtr<CompositorAnimation> animation = adoptPtr( | 239 OwnPtr<CompositorAnimation> animation = CompositorFactory::current()
.createAnimation( |
240 CompositorFactory::current().createAnimation( | 240 *m_animationCurve, |
241 *m_animationCurve, | 241 CompositorAnimation::TargetPropertyScrollOffset); |
242 CompositorAnimation::TargetPropertyScrollOffset)); | |
243 // Being here means that either there is an animation that needs | 242 // Being here means that either there is an animation that needs |
244 // to be sent to the compositor, or an animation that needs to | 243 // to be sent to the compositor, or an animation that needs to |
245 // be updated (a new scroll event before the previous animation | 244 // be updated (a new scroll event before the previous animation |
246 // is finished). In either case, the start time is when the | 245 // is finished). In either case, the start time is when the |
247 // first animation was initiated. This re-targets the animation | 246 // first animation was initiated. This re-targets the animation |
248 // using the current time on main thread. | 247 // using the current time on main thread. |
249 animation->setStartTime(m_startTime); | 248 animation->setStartTime(m_startTime); |
250 | 249 |
251 int animationId = animation->id(); | 250 int animationId = animation->id(); |
252 int animationGroupId = animation->group(); | 251 int animationGroupId = animation->group(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 298 } |
300 return true; | 299 return true; |
301 } | 300 } |
302 | 301 |
303 DEFINE_TRACE(ScrollAnimator) | 302 DEFINE_TRACE(ScrollAnimator) |
304 { | 303 { |
305 ScrollAnimatorBase::trace(visitor); | 304 ScrollAnimatorBase::trace(visitor); |
306 } | 305 } |
307 | 306 |
308 } // namespace blink | 307 } // namespace blink |
OLD | NEW |