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 | 4 |
5 #ifndef CCScrollbarAnimationController_h | 5 #ifndef CCScrollbarAnimationController_h |
6 #define CCScrollbarAnimationController_h | 6 #define CCScrollbarAnimationController_h |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "FloatPoint.h" | 9 #include "FloatPoint.h" |
10 #include "IntSize.h" | 10 #include "IntSize.h" |
11 | 11 |
| 12 namespace gfx { |
| 13 class Size; |
| 14 } |
| 15 |
12 namespace cc { | 16 namespace cc { |
13 | 17 |
14 class LayerImpl; | 18 class LayerImpl; |
15 class ScrollbarLayerImpl; | 19 class ScrollbarLayerImpl; |
16 | 20 |
17 // This abstract class represents the compositor-side analogy of ScrollbarAnimat
or. | 21 // This abstract class represents the compositor-side analogy of ScrollbarAnimat
or. |
18 // Individual platforms should subclass it to provide specialized implementation
. | 22 // Individual platforms should subclass it to provide specialized implementation
. |
19 class ScrollbarAnimationController { | 23 class ScrollbarAnimationController { |
20 public: | 24 public: |
21 static scoped_ptr<ScrollbarAnimationController> create(LayerImpl* scrollLaye
r); | 25 static scoped_ptr<ScrollbarAnimationController> create(LayerImpl* scrollLaye
r); |
22 | 26 |
23 virtual ~ScrollbarAnimationController(); | 27 virtual ~ScrollbarAnimationController(); |
24 | 28 |
25 virtual bool animate(double monotonicTime); | 29 virtual bool animate(double monotonicTime); |
26 void didPinchGestureBegin(); | 30 void didPinchGestureBegin(); |
27 void didPinchGestureUpdate(); | 31 void didPinchGestureUpdate(); |
28 void didPinchGestureEnd(); | 32 void didPinchGestureEnd(); |
29 void updateScrollOffset(LayerImpl* scrollLayer); | 33 void updateScrollOffset(LayerImpl* scrollLayer); |
30 | 34 |
31 void setHorizontalScrollbarLayer(ScrollbarLayerImpl* layer) { m_horizontalSc
rollbarLayer = layer; } | 35 void setHorizontalScrollbarLayer(ScrollbarLayerImpl* layer) { m_horizontalSc
rollbarLayer = layer; } |
32 ScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalSc
rollbarLayer; } | 36 ScrollbarLayerImpl* horizontalScrollbarLayer() const { return m_horizontalSc
rollbarLayer; } |
33 | 37 |
34 void setVerticalScrollbarLayer(ScrollbarLayerImpl* layer) { m_verticalScroll
barLayer = layer; } | 38 void setVerticalScrollbarLayer(ScrollbarLayerImpl* layer) { m_verticalScroll
barLayer = layer; } |
35 ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScroll
barLayer; } | 39 ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScroll
barLayer; } |
36 | 40 |
37 FloatPoint currentPos() const { return m_currentPos; } | 41 FloatPoint currentPos() const { return m_currentPos; } |
38 IntSize totalSize() const { return m_totalSize; } | 42 gfx::Size totalSize() const { return m_totalSize; } |
39 IntSize maximum() const { return m_maximum; } | 43 IntSize maximum() const { return m_maximum; } |
40 | 44 |
41 virtual void didPinchGestureBeginAtTime(double monotonicTime) { } | 45 virtual void didPinchGestureBeginAtTime(double monotonicTime) { } |
42 virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } | 46 virtual void didPinchGestureUpdateAtTime(double monotonicTime) { } |
43 virtual void didPinchGestureEndAtTime(double monotonicTime) { } | 47 virtual void didPinchGestureEndAtTime(double monotonicTime) { } |
44 virtual void updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monoton
icTime); | 48 virtual void updateScrollOffsetAtTime(LayerImpl* scrollLayer, double monoton
icTime); |
45 | 49 |
46 protected: | 50 protected: |
47 explicit ScrollbarAnimationController(LayerImpl* scrollLayer); | 51 explicit ScrollbarAnimationController(LayerImpl* scrollLayer); |
48 | 52 |
49 private: | 53 private: |
50 static IntSize getScrollLayerBounds(const LayerImpl*); | 54 static gfx::Size getScrollLayerBounds(const LayerImpl*); |
51 | 55 |
52 // Beware of dangling pointer. Always update these during tree synchronizati
on. | 56 // Beware of dangling pointer. Always update these during tree synchronizati
on. |
53 ScrollbarLayerImpl* m_horizontalScrollbarLayer; | 57 ScrollbarLayerImpl* m_horizontalScrollbarLayer; |
54 ScrollbarLayerImpl* m_verticalScrollbarLayer; | 58 ScrollbarLayerImpl* m_verticalScrollbarLayer; |
55 | 59 |
56 FloatPoint m_currentPos; | 60 FloatPoint m_currentPos; |
57 IntSize m_totalSize; | 61 gfx::Size m_totalSize; |
58 IntSize m_maximum; | 62 IntSize m_maximum; |
59 }; | 63 }; |
60 | 64 |
61 } // namespace cc | 65 } // namespace cc |
62 | 66 |
63 #endif // CCScrollbarAnimationController_h | 67 #endif // CCScrollbarAnimationController_h |
OLD | NEW |