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

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

Issue 2006103004: Send takeover msg from MT to CC using the animation path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jbroman nits Created 4 years, 6 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // If the current run state is WaitingToSendToCompositor but we have a 279 // If the current run state is WaitingToSendToCompositor but we have a
280 // non-zero compositor animation id, there's a currently running 280 // non-zero compositor animation id, there's a currently running
281 // compositor animation that needs to be removed here before the new 281 // compositor animation that needs to be removed here before the new
282 // animation is added below. 282 // animation is added below.
283 ASSERT(m_runState == RunState::WaitingToCancelOnCompositor 283 ASSERT(m_runState == RunState::WaitingToCancelOnCompositor
284 || m_runState == RunState::WaitingToSendToCompositor 284 || m_runState == RunState::WaitingToSendToCompositor
285 || m_runState == RunState::RunningOnCompositorButNeedsTakeover); 285 || m_runState == RunState::RunningOnCompositorButNeedsTakeover);
286 286
287 if (m_runState == RunState::RunningOnCompositorButNeedsTakeover) { 287 if (m_runState == RunState::RunningOnCompositorButNeedsTakeover) {
288 // The animation is already aborted when the call to 288 // The animation is already aborted when the call to
289 // ::takeoverCompositorAnimation is made. 289 // ::takeOverCompositorAnimation is made.
290 m_runState = RunState::WaitingToSendToCompositor; 290 m_runState = RunState::WaitingToSendToCompositor;
291 } else { 291 } else {
292 abortAnimation(); 292 abortAnimation();
293 } 293 }
294 294
295 m_compositorAnimationId = 0; 295 m_compositorAnimationId = 0;
296 m_compositorAnimationGroupId = 0; 296 m_compositorAnimationGroupId = 0;
297 if (m_runState == RunState::WaitingToCancelOnCompositor) { 297 if (m_runState == RunState::WaitingToCancelOnCompositor) {
298 postAnimationCleanupAndReset(); 298 postAnimationCleanupAndReset();
299 return; 299 return;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 std::move(scrollOffsetAnimationCurve))); 394 std::move(scrollOffsetAnimationCurve)));
395 m_startTime = animationStartTime; 395 m_startTime = animationStartTime;
396 } 396 }
397 } 397 }
398 398
399 void ScrollAnimator::cancelAnimation() 399 void ScrollAnimator::cancelAnimation()
400 { 400 {
401 ScrollAnimatorCompositorCoordinator::cancelAnimation(); 401 ScrollAnimatorCompositorCoordinator::cancelAnimation();
402 } 402 }
403 403
404 void ScrollAnimator::takeoverCompositorAnimation() 404 void ScrollAnimator::takeOverCompositorAnimation()
405 { 405 {
406 if (m_runState == RunState::RunningOnCompositor 406 if (m_runState == RunState::RunningOnCompositor
407 || m_runState == RunState::RunningOnCompositorButNeedsUpdate) 407 || m_runState == RunState::RunningOnCompositorButNeedsUpdate)
408 removeMainThreadScrollingReason(); 408 removeMainThreadScrollingReason();
409 409
410 ScrollAnimatorCompositorCoordinator::takeoverCompositorAnimation(); 410 ScrollAnimatorCompositorCoordinator::takeOverCompositorAnimation();
411 } 411 }
412 412
413 void ScrollAnimator::layerForCompositedScrollingDidChange( 413 void ScrollAnimator::layerForCompositedScrollingDidChange(
414 CompositorAnimationTimeline* timeline) 414 CompositorAnimationTimeline* timeline)
415 { 415 {
416 if (reattachCompositorPlayerIfNeeded(timeline) && m_animationCurve) 416 if (reattachCompositorPlayerIfNeeded(timeline) && m_animationCurve)
417 addMainThreadScrollingReason(); 417 addMainThreadScrollingReason();
418 } 418 }
419 419
420 bool ScrollAnimator::registerAndScheduleAnimation() 420 bool ScrollAnimator::registerAndScheduleAnimation()
421 { 421 {
422 getScrollableArea()->registerForAnimation(); 422 getScrollableArea()->registerForAnimation();
423 if (!m_scrollableArea->scheduleAnimation()) { 423 if (!m_scrollableArea->scheduleAnimation()) {
424 scrollToOffsetWithoutAnimation(m_targetOffset); 424 scrollToOffsetWithoutAnimation(m_targetOffset);
425 resetAnimationState(); 425 resetAnimationState();
426 return false; 426 return false;
427 } 427 }
428 return true; 428 return true;
429 } 429 }
430 430
431 DEFINE_TRACE(ScrollAnimator) 431 DEFINE_TRACE(ScrollAnimator)
432 { 432 {
433 ScrollAnimatorBase::trace(visitor); 433 ScrollAnimatorBase::trace(visitor);
434 } 434 }
435 435
436 } // namespace blink 436 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698