| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScrollAnimatorBase_h | 31 #ifndef ScrollAnimatorBase_h |
| 32 #define ScrollAnimatorBase_h | 32 #define ScrollAnimatorBase_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/PlatformWheelEvent.h" | 35 #include "platform/PlatformWheelEvent.h" |
| 36 #include "platform/geometry/FloatSize.h" | 36 #include "platform/geometry/FloatSize.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/scroll/ScrollAnimatorCompositorCoordinator.h" |
| 38 #include "platform/scroll/ScrollTypes.h" | 39 #include "platform/scroll/ScrollTypes.h" |
| 39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 class FloatPoint; | 44 class FloatPoint; |
| 44 class ScrollableArea; | 45 class ScrollableArea; |
| 45 class Scrollbar; | 46 class Scrollbar; |
| 47 class WebCompositorAnimationTimeline; |
| 46 | 48 |
| 47 class PLATFORM_EXPORT ScrollAnimatorBase : public NoBaseWillBeGarbageCollectedFi
nalized<ScrollAnimatorBase> { | 49 class PLATFORM_EXPORT ScrollAnimatorBase : public ScrollAnimatorCompositorCoordi
nator { |
| 48 public: | 50 public: |
| 49 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); | 51 static PassOwnPtrWillBeRawPtr<ScrollAnimatorBase> create(ScrollableArea*); |
| 50 | 52 |
| 51 virtual ~ScrollAnimatorBase(); | 53 virtual ~ScrollAnimatorBase(); |
| 52 | 54 |
| 53 virtual void dispose() { } | 55 virtual void dispose() { } |
| 54 | 56 |
| 55 // Computes a scroll destination for the given parameters. The returned | 57 // Computes a scroll destination for the given parameters. The returned |
| 56 // ScrollResultOneDimensional will have didScroll set to false if already at | 58 // ScrollResultOneDimensional will have didScroll set to false if already at |
| 57 // the destination. Otherwise, starts scrolling towards the destination and | 59 // the destination. Otherwise, starts scrolling towards the destination and |
| 58 // didScroll is true. Scrolling may be immediate or animated. The base | 60 // didScroll is true. Scrolling may be immediate or animated. The base |
| 59 // class implementation always scrolls immediately, never animates. | 61 // class implementation always scrolls immediately, never animates. |
| 60 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); | 62 virtual ScrollResultOneDimensional userScroll(ScrollbarOrientation, ScrollGr
anularity, float step, float delta); |
| 61 | 63 |
| 62 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); | 64 virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); |
| 63 | 65 |
| 64 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | |
| 65 | |
| 66 virtual void setIsActive() { } | 66 virtual void setIsActive() { } |
| 67 | 67 |
| 68 #if OS(MACOSX) | 68 #if OS(MACOSX) |
| 69 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { } | 69 virtual void handleWheelEventPhase(PlatformWheelEventPhase) { } |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 void setCurrentPosition(const FloatPoint&); | 72 void setCurrentPosition(const FloatPoint&); |
| 73 FloatPoint currentPosition() const; | 73 FloatPoint currentPosition() const; |
| 74 | 74 |
| 75 // Returns how much of pixelDelta will be used by the underlying scrollable | 75 // Returns how much of pixelDelta will be used by the underlying scrollable |
| 76 // area. | 76 // area. |
| 77 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta)
const; | 77 virtual float computeDeltaToConsume(ScrollbarOrientation, float pixelDelta)
const; |
| 78 | 78 |
| 79 virtual void cancelAnimations() { } | 79 |
| 80 virtual void serviceScrollAnimations() { } | 80 // ScrollAnimatorCompositorCoordinator implementation. |
| 81 virtual bool hasRunningAnimation() const { return false; } | 81 ScrollableArea* scrollableArea() const override { return m_scrollableArea; } |
| 82 void tickAnimation(double monotonicTime) override { }; |
| 83 void cancelAnimation() override { } |
| 84 void updateCompositorAnimations() override { }; |
| 85 void notifyCompositorAnimationFinished(int groupId) override { }; |
| 86 void layerForCompositedScrollingDidChange(WebCompositorAnimationTimeline*) o
verride { }; |
| 82 | 87 |
| 83 virtual void contentAreaWillPaint() const { } | 88 virtual void contentAreaWillPaint() const { } |
| 84 virtual void mouseEnteredContentArea() const { } | 89 virtual void mouseEnteredContentArea() const { } |
| 85 virtual void mouseExitedContentArea() const { } | 90 virtual void mouseExitedContentArea() const { } |
| 86 virtual void mouseMovedInContentArea() const { } | 91 virtual void mouseMovedInContentArea() const { } |
| 87 virtual void mouseEnteredScrollbar(Scrollbar&) const { } | 92 virtual void mouseEnteredScrollbar(Scrollbar&) const { } |
| 88 virtual void mouseExitedScrollbar(Scrollbar&) const { } | 93 virtual void mouseExitedScrollbar(Scrollbar&) const { } |
| 89 virtual void willStartLiveResize() { } | 94 virtual void willStartLiveResize() { } |
| 90 virtual void updateAfterLayout() { } | 95 virtual void updateAfterLayout() { } |
| 91 virtual void contentsResized() const { } | 96 virtual void contentsResized() const { } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 116 float clampScrollPosition(ScrollbarOrientation, float) const; | 121 float clampScrollPosition(ScrollbarOrientation, float) const; |
| 117 | 122 |
| 118 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 123 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
| 119 float m_currentPosX; // We avoid using a FloatPoint in order to reduce | 124 float m_currentPosX; // We avoid using a FloatPoint in order to reduce |
| 120 float m_currentPosY; // subclass code complexity. | 125 float m_currentPosY; // subclass code complexity. |
| 121 }; | 126 }; |
| 122 | 127 |
| 123 } // namespace blink | 128 } // namespace blink |
| 124 | 129 |
| 125 #endif // ScrollAnimatorBase_h | 130 #endif // ScrollAnimatorBase_h |
| OLD | NEW |