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 | 46 |
45 class PLATFORM_EXPORT Scrollbar : public Widget, | 47 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { |
46 public ScrollbarThemeClient { | |
47 | 48 |
48 public: | 49 public: |
49 static PassRefPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, S
crollbarControlSize); | 50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize); |
50 | 51 |
51 virtual ~Scrollbar(); | 52 virtual ~Scrollbar(); |
52 | 53 |
53 // ScrollbarThemeClient implementation. | 54 // ScrollbarThemeClient implementation. |
54 virtual int x() const override { return Widget::x(); } | 55 virtual int x() const override { return Widget::x(); } |
55 virtual int y() const override { return Widget::y(); } | 56 virtual int y() const override { return Widget::y(); } |
56 virtual int width() const override { return Widget::width(); } | 57 virtual int width() const override { return Widget::width(); } |
57 virtual int height() const override { return Widget::height(); } | 58 virtual int height() const override { return Widget::height(); } |
58 virtual IntSize size() const override { return Widget::size(); } | 59 virtual IntSize size() const override { return Widget::size(); } |
59 virtual IntPoint location() const override { return Widget::location(); } | 60 virtual IntPoint location() const override { return Widget::location(); } |
(...skipping 29 matching lines...) Expand all Loading... |
89 virtual ScrollbarPart hoveredPart() const override { return m_hoveredPart; } | 90 virtual ScrollbarPart hoveredPart() const override { return m_hoveredPart; } |
90 | 91 |
91 virtual void styleChanged() override { } | 92 virtual void styleChanged() override { } |
92 | 93 |
93 virtual bool enabled() const override { return m_enabled; } | 94 virtual bool enabled() const override { return m_enabled; } |
94 virtual void setEnabled(bool) override; | 95 virtual void setEnabled(bool) override; |
95 | 96 |
96 // Called by the ScrollableArea when the scroll offset changes. | 97 // Called by the ScrollableArea when the scroll offset changes. |
97 void offsetDidChange(); | 98 void offsetDidChange(); |
98 | 99 |
99 void disconnectFromScrollableArea() { m_scrollableArea = 0; } | 100 void disconnectFromScrollableArea(); |
100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 101 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
101 | 102 |
102 int pressedPos() const { return m_pressedPos; } | 103 int pressedPos() const { return m_pressedPos; } |
103 | 104 |
104 virtual void setHoveredPart(ScrollbarPart); | 105 virtual void setHoveredPart(ScrollbarPart); |
105 virtual void setPressedPart(ScrollbarPart); | 106 virtual void setPressedPart(ScrollbarPart); |
106 | 107 |
107 void setProportion(int visibleSize, int totalSize); | 108 void setProportion(int visibleSize, int totalSize); |
108 void setPressedPos(int p) { m_pressedPos = p; } | 109 void setPressedPos(int p) { m_pressedPos = p; } |
109 | 110 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void stopTimerIfNeeded(); | 159 void stopTimerIfNeeded(); |
159 void autoscrollPressedPart(double delay); | 160 void autoscrollPressedPart(double delay); |
160 ScrollDirection pressedPartScrollDirection(); | 161 ScrollDirection pressedPartScrollDirection(); |
161 ScrollGranularity pressedPartScrollGranularity(); | 162 ScrollGranularity pressedPartScrollGranularity(); |
162 | 163 |
163 ScrollableArea* m_scrollableArea; | 164 ScrollableArea* m_scrollableArea; |
164 ScrollbarOrientation m_orientation; | 165 ScrollbarOrientation m_orientation; |
165 ScrollbarControlSize m_controlSize; | 166 ScrollbarControlSize m_controlSize; |
166 ScrollbarTheme* m_theme; | 167 ScrollbarTheme* m_theme; |
167 | 168 |
| 169 #if ENABLE(OILPAN) |
| 170 // To simplify Oilpan finalization, keep a copy of the ScrollableArea's |
| 171 // scroll animator. Scrollbar is responsible for notifying the animator |
| 172 // when it is destructed. |
| 173 RefPtr<ScrollAnimator> m_animator; |
| 174 #endif |
| 175 |
168 int m_visibleSize; | 176 int m_visibleSize; |
169 int m_totalSize; | 177 int m_totalSize; |
170 float m_currentPos; | 178 float m_currentPos; |
171 float m_dragOrigin; | 179 float m_dragOrigin; |
172 | 180 |
173 ScrollbarPart m_hoveredPart; | 181 ScrollbarPart m_hoveredPart; |
174 ScrollbarPart m_pressedPart; | 182 ScrollbarPart m_pressedPart; |
175 int m_pressedPos; | 183 int m_pressedPos; |
176 float m_scrollPos; | 184 float m_scrollPos; |
177 bool m_draggingDocument; | 185 bool m_draggingDocument; |
(...skipping 12 matching lines...) Expand all Loading... |
190 virtual bool isScrollbar() const override { return true; } | 198 virtual bool isScrollbar() const override { return true; } |
191 | 199 |
192 float scrollableAreaCurrentPos() const; | 200 float scrollableAreaCurrentPos() const; |
193 }; | 201 }; |
194 | 202 |
195 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 203 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
196 | 204 |
197 } // namespace blink | 205 } // namespace blink |
198 | 206 |
199 #endif // Scrollbar_h | 207 #endif // Scrollbar_h |
OLD | NEW |