OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CCScrollbarAnimationController_h |
| 6 #define CCScrollbarAnimationController_h |
| 7 |
| 8 #include "FloatPoint.h" |
| 9 #include "IntSize.h" |
| 10 #include <wtf/PassOwnPtr.h> |
| 11 |
| 12 namespace cc { |
| 13 |
| 14 class CCLayerImpl; |
| 15 class CCScrollbarLayerImpl; |
| 16 |
| 17 // This abstract class represents the compositor-side analogy of ScrollbarAnimat
or. |
| 18 // Individual platforms should subclass it to provide specialized implementation
. |
| 19 class CCScrollbarAnimationController { |
| 20 public: |
| 21 // Implemented by subclass. |
| 22 static PassOwnPtr<CCScrollbarAnimationController> create(CCLayerImpl* scroll
Layer); |
| 23 |
| 24 virtual ~CCScrollbarAnimationController(); |
| 25 |
| 26 virtual bool animate(double monotonicTime); |
| 27 void didPinchGestureBegin(); |
| 28 void didPinchGestureUpdate(); |
| 29 void didPinchGestureEnd(); |
| 30 void updateScrollOffset(CCLayerImpl* scrollLayer); |
| 31 |
| 32 void setHorizontalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_horizontal
ScrollbarLayer = layer; } |
| 33 CCScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontal
ScrollbarLayer; } |
| 34 |
| 35 void setVerticalScrollbarLayer(CCScrollbarLayerImpl* layer) { m_verticalScro
llbarLayer = layer; } |
| 36 CCScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScro
llbarLayer; } |
| 37 |
| 38 FloatPoint currentPos() const { return m_currentPos; } |
| 39 IntSize totalSize() const { return m_totalSize; } |
| 40 IntSize maximum() const { return m_maximum; } |
| 41 |
| 42 virtual void didPinchGestureBeginAtTime(double monotonicTime) { } |
| 43 virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } |
| 44 virtual void didPinchGestureEndAtTime(double monotonicTime) { } |
| 45 virtual void updateScrollOffsetAtTime(CCLayerImpl* scrollLayer, double monot
onicTime); |
| 46 |
| 47 protected: |
| 48 explicit CCScrollbarAnimationController(CCLayerImpl* scrollLayer); |
| 49 |
| 50 private: |
| 51 static IntSize getScrollLayerBounds(const CCLayerImpl*); |
| 52 |
| 53 // Beware of dangling pointer. Always update these during tree synchronizati
on. |
| 54 CCScrollbarLayerImpl* m_horizontalScrollbarLayer; |
| 55 CCScrollbarLayerImpl* m_verticalScrollbarLayer; |
| 56 |
| 57 FloatPoint m_currentPos; |
| 58 IntSize m_totalSize; |
| 59 IntSize m_maximum; |
| 60 }; |
| 61 |
| 62 } // namespace cc |
| 63 |
| 64 #endif // CCScrollbarAnimationController_h |
OLD | NEW |