| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, Google Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. | 3 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 447 |
| 448 bool ScrollableArea::hasLayerForScrollCorner() const | 448 bool ScrollableArea::hasLayerForScrollCorner() const |
| 449 { | 449 { |
| 450 return layerForScrollCorner(); | 450 return layerForScrollCorner(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 void ScrollableArea::layerForScrollingDidChange(WebCompositorAnimationTimeline*
timeline) | 453 void ScrollableArea::layerForScrollingDidChange(WebCompositorAnimationTimeline*
timeline) |
| 454 { | 454 { |
| 455 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 455 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 456 programmaticScrollAnimator->layerForCompositedScrollingDidChange(timelin
e); | 456 programmaticScrollAnimator->layerForCompositedScrollingDidChange(timelin
e); |
| 457 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | |
| 458 scrollAnimator->layerForCompositedScrollingDidChange(timeline); | |
| 459 } | 457 } |
| 460 | 458 |
| 461 bool ScrollableArea::scheduleAnimation() | 459 bool ScrollableArea::scheduleAnimation() |
| 462 { | 460 { |
| 463 if (HostWindow* window = hostWindow()) { | 461 if (HostWindow* window = hostWindow()) { |
| 464 window->scheduleAnimation(widget()); | 462 window->scheduleAnimation(widget()); |
| 465 return true; | 463 return true; |
| 466 } | 464 } |
| 467 return false; | 465 return false; |
| 468 } | 466 } |
| 469 | 467 |
| 470 void ScrollableArea::serviceScrollAnimations(double monotonicTime) | 468 void ScrollableArea::serviceScrollAnimations(double monotonicTime) |
| 471 { | 469 { |
| 472 bool requiresAnimationService = false; | 470 bool requiresAnimationService = false; |
| 473 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) { | 471 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) { |
| 474 scrollAnimator->tickAnimation(monotonicTime); | 472 scrollAnimator->serviceScrollAnimations(); |
| 475 if (scrollAnimator->hasAnimationThatRequiresService()) | 473 if (scrollAnimator->hasRunningAnimation()) |
| 476 requiresAnimationService = true; | 474 requiresAnimationService = true; |
| 477 } | 475 } |
| 478 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) { | 476 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) { |
| 479 programmaticScrollAnimator->tickAnimation(monotonicTime); | 477 programmaticScrollAnimator->tickAnimation(monotonicTime); |
| 480 if (programmaticScrollAnimator->hasAnimationThatRequiresService()) | 478 if (programmaticScrollAnimator->hasAnimationThatRequiresService()) |
| 481 requiresAnimationService = true; | 479 requiresAnimationService = true; |
| 482 } | 480 } |
| 483 if (!requiresAnimationService) | 481 if (!requiresAnimationService) |
| 484 deregisterForAnimation(); | 482 deregisterForAnimation(); |
| 485 } | 483 } |
| 486 | 484 |
| 487 void ScrollableArea::updateCompositorScrollAnimations() | 485 void ScrollableArea::updateCompositorScrollAnimations() |
| 488 { | 486 { |
| 489 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 487 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 490 programmaticScrollAnimator->updateCompositorAnimations(); | 488 programmaticScrollAnimator->updateCompositorAnimations(); |
| 491 | |
| 492 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | |
| 493 scrollAnimator->updateCompositorAnimations(); | |
| 494 } | 489 } |
| 495 | 490 |
| 496 void ScrollableArea::notifyCompositorAnimationFinished(int groupId) | 491 void ScrollableArea::notifyCompositorAnimationFinished(int groupId) |
| 497 { | 492 { |
| 498 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 493 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 499 programmaticScrollAnimator->notifyCompositorAnimationFinished(groupId); | 494 programmaticScrollAnimator->notifyCompositorAnimationFinished(groupId); |
| 500 | |
| 501 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | |
| 502 scrollAnimator->notifyCompositorAnimationFinished(groupId); | |
| 503 } | 495 } |
| 504 | 496 |
| 505 void ScrollableArea::cancelScrollAnimation() | 497 void ScrollableArea::cancelScrollAnimation() |
| 506 { | 498 { |
| 507 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | 499 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) |
| 508 scrollAnimator->cancelAnimation(); | 500 scrollAnimator->cancelAnimations(); |
| 509 } | 501 } |
| 510 | 502 |
| 511 void ScrollableArea::cancelProgrammaticScrollAnimation() | 503 void ScrollableArea::cancelProgrammaticScrollAnimation() |
| 512 { | 504 { |
| 513 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 505 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 514 programmaticScrollAnimator->cancelAnimation(); | 506 programmaticScrollAnimator->cancelAnimation(); |
| 515 } | 507 } |
| 516 | 508 |
| 517 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const | 509 DoubleRect ScrollableArea::visibleContentRectDouble(IncludeScrollbarsInRect scro
llbarInclusion) const |
| 518 { | 510 { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 std::max(0, size.height() - horizontalScrollbarHeight)); | 578 std::max(0, size.height() - horizontalScrollbarHeight)); |
| 587 } | 579 } |
| 588 | 580 |
| 589 DEFINE_TRACE(ScrollableArea) | 581 DEFINE_TRACE(ScrollableArea) |
| 590 { | 582 { |
| 591 visitor->trace(m_scrollAnimator); | 583 visitor->trace(m_scrollAnimator); |
| 592 visitor->trace(m_programmaticScrollAnimator); | 584 visitor->trace(m_programmaticScrollAnimator); |
| 593 } | 585 } |
| 594 | 586 |
| 595 } // namespace blink | 587 } // namespace blink |
| OLD | NEW |