| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 ? m_animationCurve->targetValue() | 192 ? m_animationCurve->targetValue() |
| 193 : m_animationCurve->getValue(elapsedTime)); | 193 : m_animationCurve->getValue(elapsedTime)); |
| 194 | 194 |
| 195 offset = FloatPoint(m_scrollableArea->clampScrollPosition(offset)); | 195 offset = FloatPoint(m_scrollableArea->clampScrollPosition(offset)); |
| 196 | 196 |
| 197 m_currentPos = offset; | 197 m_currentPos = offset; |
| 198 | 198 |
| 199 if (isFinished) | 199 if (isFinished) |
| 200 m_runState = RunState::PostAnimationCleanup; | 200 m_runState = RunState::PostAnimationCleanup; |
| 201 else | 201 else |
| 202 scrollableArea()->scheduleAnimation(); | 202 getScrollableArea()->scheduleAnimation(); |
| 203 | 203 |
| 204 TRACE_EVENT0("blink", "ScrollAnimator::notifyPositionChanged"); | 204 TRACE_EVENT0("blink", "ScrollAnimator::notifyPositionChanged"); |
| 205 notifyPositionChanged(); | 205 notifyPositionChanged(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void ScrollAnimator::postAnimationCleanupAndReset() | 208 void ScrollAnimator::postAnimationCleanupAndReset() |
| 209 { | 209 { |
| 210 // Remove the temporary main thread scrolling reason that was added while | 210 // Remove the temporary main thread scrolling reason that was added while |
| 211 // main thread had scheduled an animation. | 211 // main thread had scheduled an animation. |
| 212 removeMainThreadScrollingReason(); | 212 removeMainThreadScrollingReason(); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // Main thread should deal with the scroll animations it started. | 313 // Main thread should deal with the scroll animations it started. |
| 314 if (sentToCompositor || runningOnMainThread) | 314 if (sentToCompositor || runningOnMainThread) |
| 315 addMainThreadScrollingReason(); | 315 addMainThreadScrollingReason(); |
| 316 else | 316 else |
| 317 removeMainThreadScrollingReason(); | 317 removeMainThreadScrollingReason(); |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 | 320 |
| 321 void ScrollAnimator::addMainThreadScrollingReason() | 321 void ScrollAnimator::addMainThreadScrollingReason() |
| 322 { | 322 { |
| 323 if (WebLayer* scrollLayer = toWebLayer(scrollableArea()->layerForScrolling()
)) { | 323 if (WebLayer* scrollLayer = toWebLayer(getScrollableArea()->layerForScrollin
g())) { |
| 324 scrollLayer->addMainThreadScrollingReasons( | 324 scrollLayer->addMainThreadScrollingReasons( |
| 325 MainThreadScrollingReason::kAnimatingScrollOnMainThread); | 325 MainThreadScrollingReason::kAnimatingScrollOnMainThread); |
| 326 } | 326 } |
| 327 } | 327 } |
| 328 | 328 |
| 329 void ScrollAnimator::removeMainThreadScrollingReason() | 329 void ScrollAnimator::removeMainThreadScrollingReason() |
| 330 { | 330 { |
| 331 if (WebLayer* scrollLayer = toWebLayer(scrollableArea()->layerForScrolling()
)) { | 331 if (WebLayer* scrollLayer = toWebLayer(getScrollableArea()->layerForScrollin
g())) { |
| 332 scrollLayer->clearMainThreadScrollingReasons( | 332 scrollLayer->clearMainThreadScrollingReasons( |
| 333 MainThreadScrollingReason::kAnimatingScrollOnMainThread); | 333 MainThreadScrollingReason::kAnimatingScrollOnMainThread); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 void ScrollAnimator::notifyCompositorAnimationAborted(int groupId) | 337 void ScrollAnimator::notifyCompositorAnimationAborted(int groupId) |
| 338 { | 338 { |
| 339 // An animation aborted by the compositor is treated as a finished | 339 // An animation aborted by the compositor is treated as a finished |
| 340 // animation. | 340 // animation. |
| 341 ScrollAnimatorCompositorCoordinator::compositorAnimationFinished(groupId); | 341 ScrollAnimatorCompositorCoordinator::compositorAnimationFinished(groupId); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 384 |
| 385 void ScrollAnimator::layerForCompositedScrollingDidChange( | 385 void ScrollAnimator::layerForCompositedScrollingDidChange( |
| 386 CompositorAnimationTimeline* timeline) | 386 CompositorAnimationTimeline* timeline) |
| 387 { | 387 { |
| 388 if (reattachCompositorPlayerIfNeeded(timeline) && m_animationCurve) | 388 if (reattachCompositorPlayerIfNeeded(timeline) && m_animationCurve) |
| 389 addMainThreadScrollingReason(); | 389 addMainThreadScrollingReason(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 bool ScrollAnimator::registerAndScheduleAnimation() | 392 bool ScrollAnimator::registerAndScheduleAnimation() |
| 393 { | 393 { |
| 394 scrollableArea()->registerForAnimation(); | 394 getScrollableArea()->registerForAnimation(); |
| 395 if (!m_scrollableArea->scheduleAnimation()) { | 395 if (!m_scrollableArea->scheduleAnimation()) { |
| 396 scrollToOffsetWithoutAnimation(m_targetOffset); | 396 scrollToOffsetWithoutAnimation(m_targetOffset); |
| 397 resetAnimationState(); | 397 resetAnimationState(); |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 return true; | 400 return true; |
| 401 } | 401 } |
| 402 | 402 |
| 403 DEFINE_TRACE(ScrollAnimator) | 403 DEFINE_TRACE(ScrollAnimator) |
| 404 { | 404 { |
| 405 ScrollAnimatorBase::trace(visitor); | 405 ScrollAnimatorBase::trace(visitor); |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace blink | 408 } // namespace blink |
| OLD | NEW |