| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 step = pixelStep(orientation); | 152 step = pixelStep(orientation); |
| 153 break; | 153 break; |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (direction == ScrollUp || direction == ScrollLeft) | 156 if (direction == ScrollUp || direction == ScrollLeft) |
| 157 delta = -delta; | 157 delta = -delta; |
| 158 | 158 |
| 159 return scrollAnimator()->scroll(orientation, granularity, step, delta); | 159 return scrollAnimator()->scroll(orientation, granularity, step, delta); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset) | 162 void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset, bo
ol cancelProgrammaticAnimations) |
| 163 { | 163 { |
| 164 cancelProgrammaticScrollAnimation(); | 164 if (cancelProgrammaticAnimations) |
| 165 cancelProgrammaticScrollAnimation(); |
| 165 scrollAnimator()->scrollToOffsetWithoutAnimation(offset); | 166 scrollAnimator()->scrollToOffsetWithoutAnimation(offset); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orienta
tion, float offset) | 169 void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orienta
tion, float offset) |
| 169 { | 170 { |
| 170 if (orientation == HorizontalScrollbar) | 171 if (orientation == HorizontalScrollbar) |
| 171 scrollToOffsetWithoutAnimation(FloatPoint(offset, scrollAnimator()->curr
entPosition().y())); | 172 scrollToOffsetWithoutAnimation(FloatPoint(offset, scrollAnimator()->curr
entPosition().y())); |
| 172 else | 173 else |
| 173 scrollToOffsetWithoutAnimation(FloatPoint(scrollAnimator()->currentPosit
ion().x(), offset)); | 174 scrollToOffsetWithoutAnimation(FloatPoint(scrollAnimator()->currentPosit
ion().x(), offset)); |
| 174 } | 175 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 { | 424 { |
| 424 if (HostWindow* window = hostWindow()) { | 425 if (HostWindow* window = hostWindow()) { |
| 425 window->scheduleAnimation(); | 426 window->scheduleAnimation(); |
| 426 return true; | 427 return true; |
| 427 } | 428 } |
| 428 return false; | 429 return false; |
| 429 } | 430 } |
| 430 | 431 |
| 431 void ScrollableArea::serviceScrollAnimations(double monotonicTime) | 432 void ScrollableArea::serviceScrollAnimations(double monotonicTime) |
| 432 { | 433 { |
| 433 bool hasRunningAnimation = false; | 434 bool requiresAnimationService = false; |
| 434 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) { | 435 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) { |
| 435 scrollAnimator->serviceScrollAnimations(); | 436 scrollAnimator->serviceScrollAnimations(); |
| 436 if (scrollAnimator->hasRunningAnimation()) | 437 if (scrollAnimator->hasRunningAnimation()) |
| 437 hasRunningAnimation = true; | 438 requiresAnimationService = true; |
| 438 } | 439 } |
| 439 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) { | 440 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) { |
| 440 programmaticScrollAnimator->tickAnimation(monotonicTime); | 441 programmaticScrollAnimator->tickAnimation(monotonicTime); |
| 441 if (programmaticScrollAnimator->hasRunningAnimation()) | 442 if (programmaticScrollAnimator->hasAnimationThatRequiresService()) |
| 442 hasRunningAnimation = true; | 443 requiresAnimationService = true; |
| 443 } | 444 } |
| 444 if (!hasRunningAnimation) | 445 if (!requiresAnimationService) |
| 445 deregisterForAnimation(); | 446 deregisterForAnimation(); |
| 446 } | 447 } |
| 447 | 448 |
| 449 void ScrollableArea::updateCompositorScrollAnimations() |
| 450 { |
| 451 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 452 programmaticScrollAnimator->updateCompositorAnimations(); |
| 453 } |
| 454 |
| 455 void ScrollableArea::notifyCompositorAnimationFinished(int groupId) |
| 456 { |
| 457 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 458 programmaticScrollAnimator->notifyCompositorAnimationFinished(groupId); |
| 459 } |
| 460 |
| 448 void ScrollableArea::cancelProgrammaticScrollAnimation() | 461 void ScrollableArea::cancelProgrammaticScrollAnimation() |
| 449 { | 462 { |
| 450 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) | 463 if (ProgrammaticScrollAnimator* programmaticScrollAnimator = existingProgram
maticScrollAnimator()) |
| 451 programmaticScrollAnimator->cancelAnimation(); | 464 programmaticScrollAnimator->cancelAnimation(); |
| 452 } | 465 } |
| 453 | 466 |
| 454 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const | 467 IntRect ScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarIncl
usion) const |
| 455 { | 468 { |
| 456 int verticalScrollbarWidth = 0; | 469 int verticalScrollbarWidth = 0; |
| 457 int horizontalScrollbarHeight = 0; | 470 int horizontalScrollbarHeight = 0; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 { | 505 { |
| 493 return scrollSize(orientation); | 506 return scrollSize(orientation); |
| 494 } | 507 } |
| 495 | 508 |
| 496 float ScrollableArea::pixelStep(ScrollbarOrientation) const | 509 float ScrollableArea::pixelStep(ScrollbarOrientation) const |
| 497 { | 510 { |
| 498 return 1; | 511 return 1; |
| 499 } | 512 } |
| 500 | 513 |
| 501 } // namespace blink | 514 } // namespace blink |
| OLD | NEW |