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