OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef Scrollbar_h | 26 #ifndef Scrollbar_h |
27 #define Scrollbar_h | 27 #define Scrollbar_h |
28 | 28 |
29 #include "platform/Timer.h" | 29 #include "platform/Timer.h" |
30 #include "platform/Widget.h" | 30 #include "platform/Widget.h" |
| 31 #include "platform/heap/Handle.h" |
31 #include "platform/scroll/ScrollTypes.h" | 32 #include "platform/scroll/ScrollTypes.h" |
32 #include "platform/scroll/ScrollbarThemeClient.h" | 33 #include "platform/scroll/ScrollbarThemeClient.h" |
33 #include "wtf/MathExtras.h" | 34 #include "wtf/MathExtras.h" |
34 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
35 | 36 |
36 namespace blink { | 37 namespace blink { |
37 | 38 |
38 class GraphicsContext; | 39 class GraphicsContext; |
39 class IntRect; | 40 class IntRect; |
40 class PlatformGestureEvent; | 41 class PlatformGestureEvent; |
41 class PlatformMouseEvent; | 42 class PlatformMouseEvent; |
| 43 class ScrollAnimator; |
42 class ScrollableArea; | 44 class ScrollableArea; |
43 class ScrollbarTheme; | 45 class ScrollbarTheme; |
44 class ScrollView; | 46 class ScrollView; |
45 | 47 |
46 class PLATFORM_EXPORT Scrollbar : public Widget, | 48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { |
47 public ScrollbarThemeClient { | |
48 | 49 |
49 public: | 50 public: |
50 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, S
crollbarControlSize); | 51 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize); |
51 | 52 |
52 virtual ~Scrollbar(); | 53 virtual ~Scrollbar(); |
53 | 54 |
54 // ScrollbarThemeClient implementation. | 55 // ScrollbarThemeClient implementation. |
55 virtual int x() const OVERRIDE { return Widget::x(); } | 56 virtual int x() const OVERRIDE { return Widget::x(); } |
56 virtual int y() const OVERRIDE { return Widget::y(); } | 57 virtual int y() const OVERRIDE { return Widget::y(); } |
57 virtual int width() const OVERRIDE { return Widget::width(); } | 58 virtual int width() const OVERRIDE { return Widget::width(); } |
58 virtual int height() const OVERRIDE { return Widget::height(); } | 59 virtual int height() const OVERRIDE { return Widget::height(); } |
59 virtual IntSize size() const OVERRIDE { return Widget::size(); } | 60 virtual IntSize size() const OVERRIDE { return Widget::size(); } |
60 virtual IntPoint location() const OVERRIDE { return Widget::location(); } | 61 virtual IntPoint location() const OVERRIDE { return Widget::location(); } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 virtual ScrollbarPart hoveredPart() const OVERRIDE { return m_hoveredPart; } | 94 virtual ScrollbarPart hoveredPart() const OVERRIDE { return m_hoveredPart; } |
94 | 95 |
95 virtual void styleChanged() OVERRIDE { } | 96 virtual void styleChanged() OVERRIDE { } |
96 | 97 |
97 virtual bool enabled() const OVERRIDE { return m_enabled; } | 98 virtual bool enabled() const OVERRIDE { return m_enabled; } |
98 virtual void setEnabled(bool) OVERRIDE; | 99 virtual void setEnabled(bool) OVERRIDE; |
99 | 100 |
100 // Called by the ScrollableArea when the scroll offset changes. | 101 // Called by the ScrollableArea when the scroll offset changes. |
101 void offsetDidChange(); | 102 void offsetDidChange(); |
102 | 103 |
103 void disconnectFromScrollableArea() { m_scrollableArea = 0; } | 104 void disconnectFromScrollableArea(); |
104 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 105 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
105 | 106 |
106 int pressedPos() const { return m_pressedPos; } | 107 int pressedPos() const { return m_pressedPos; } |
107 | 108 |
108 virtual void setHoveredPart(ScrollbarPart); | 109 virtual void setHoveredPart(ScrollbarPart); |
109 virtual void setPressedPart(ScrollbarPart); | 110 virtual void setPressedPart(ScrollbarPart); |
110 | 111 |
111 void setProportion(int visibleSize, int totalSize); | 112 void setProportion(int visibleSize, int totalSize); |
112 void setPressedPos(int p) { m_pressedPos = p; } | 113 void setPressedPos(int p) { m_pressedPos = p; } |
113 | 114 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void stopTimerIfNeeded(); | 162 void stopTimerIfNeeded(); |
162 void autoscrollPressedPart(double delay); | 163 void autoscrollPressedPart(double delay); |
163 ScrollDirection pressedPartScrollDirection(); | 164 ScrollDirection pressedPartScrollDirection(); |
164 ScrollGranularity pressedPartScrollGranularity(); | 165 ScrollGranularity pressedPartScrollGranularity(); |
165 | 166 |
166 ScrollableArea* m_scrollableArea; | 167 ScrollableArea* m_scrollableArea; |
167 ScrollbarOrientation m_orientation; | 168 ScrollbarOrientation m_orientation; |
168 ScrollbarControlSize m_controlSize; | 169 ScrollbarControlSize m_controlSize; |
169 ScrollbarTheme* m_theme; | 170 ScrollbarTheme* m_theme; |
170 | 171 |
| 172 #if ENABLE(OILPAN) |
| 173 // To simplify Oilpan finalization, keep a copy of the ScrollableArea's |
| 174 // scroll animator. Scrollbar is responsible for notifying the animator |
| 175 // when it is destructed. |
| 176 RefPtr<ScrollAnimator> m_animator; |
| 177 #endif |
| 178 |
171 int m_visibleSize; | 179 int m_visibleSize; |
172 int m_totalSize; | 180 int m_totalSize; |
173 float m_currentPos; | 181 float m_currentPos; |
174 float m_dragOrigin; | 182 float m_dragOrigin; |
175 | 183 |
176 ScrollbarPart m_hoveredPart; | 184 ScrollbarPart m_hoveredPart; |
177 ScrollbarPart m_pressedPart; | 185 ScrollbarPart m_pressedPart; |
178 int m_pressedPos; | 186 int m_pressedPos; |
179 float m_scrollPos; | 187 float m_scrollPos; |
180 bool m_draggingDocument; | 188 bool m_draggingDocument; |
(...skipping 12 matching lines...) Expand all Loading... |
193 virtual bool isScrollbar() const OVERRIDE { return true; } | 201 virtual bool isScrollbar() const OVERRIDE { return true; } |
194 | 202 |
195 float scrollableAreaCurrentPos() const; | 203 float scrollableAreaCurrentPos() const; |
196 }; | 204 }; |
197 | 205 |
198 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 206 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
199 | 207 |
200 } // namespace blink | 208 } // namespace blink |
201 | 209 |
202 #endif // Scrollbar_h | 210 #endif // Scrollbar_h |
OLD | NEW |