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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class PlatformGestureEvent; | 42 class PlatformGestureEvent; |
43 class PlatformMouseEvent; | 43 class PlatformMouseEvent; |
44 class ScrollAnimator; | 44 class ScrollAnimator; |
45 class ScrollableArea; | 45 class ScrollableArea; |
46 class ScrollbarTheme; | 46 class ScrollbarTheme; |
47 | 47 |
48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { | 48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { |
49 public: | 49 public: |
50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize); | 50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize); |
51 | 51 |
52 virtual ~Scrollbar(); | 52 ~Scrollbar() override; |
53 | 53 |
54 // ScrollbarThemeClient implementation. | 54 // ScrollbarThemeClient implementation. |
55 virtual int x() const override { return Widget::x(); } | 55 int x() const override { return Widget::x(); } |
56 virtual int y() const override { return Widget::y(); } | 56 int y() const override { return Widget::y(); } |
57 virtual int width() const override { return Widget::width(); } | 57 int width() const override { return Widget::width(); } |
58 virtual int height() const override { return Widget::height(); } | 58 int height() const override { return Widget::height(); } |
59 virtual IntSize size() const override { return Widget::size(); } | 59 IntSize size() const override { return Widget::size(); } |
60 virtual IntPoint location() const override { return Widget::location(); } | 60 IntPoint location() const override { return Widget::location(); } |
61 | 61 |
62 virtual Widget* parent() const override { return Widget::parent(); } | 62 Widget* parent() const override { return Widget::parent(); } |
63 virtual Widget* root() const override { return Widget::root(); } | 63 Widget* root() const override { return Widget::root(); } |
64 | 64 |
65 virtual void setFrameRect(const IntRect&) override; | 65 void setFrameRect(const IntRect&) override; |
66 virtual IntRect frameRect() const override { return Widget::frameRect(); } | 66 IntRect frameRect() const override { return Widget::frameRect(); } |
67 | 67 |
68 virtual void invalidate() override { Widget::invalidate(); } | 68 void invalidate() override { Widget::invalidate(); } |
69 virtual void invalidateRect(const IntRect&) override; | 69 void invalidateRect(const IntRect&) override; |
70 | 70 |
71 virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const override; | 71 ScrollbarOverlayStyle scrollbarOverlayStyle() const override; |
72 virtual void getTickmarks(Vector<IntRect>&) const override; | 72 void getTickmarks(Vector<IntRect>&) const override; |
73 virtual bool isScrollableAreaActive() const override; | 73 bool isScrollableAreaActive() const override; |
74 | 74 |
75 virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) ov
erride { return Widget::convertFromContainingWindow(windowPoint); } | 75 IntPoint convertFromContainingWindow(const IntPoint& windowPoint) override {
return Widget::convertFromContainingWindow(windowPoint); } |
76 | 76 |
77 virtual bool isCustomScrollbar() const override { return false; } | 77 bool isCustomScrollbar() const override { return false; } |
78 virtual ScrollbarOrientation orientation() const override { return m_orienta
tion; } | 78 ScrollbarOrientation orientation() const override { return m_orientation; } |
79 virtual bool isLeftSideVerticalScrollbar() const override; | 79 bool isLeftSideVerticalScrollbar() const override; |
80 | 80 |
81 virtual int value() const override { return lroundf(m_currentPos); } | 81 int value() const override { return lroundf(m_currentPos); } |
82 virtual float currentPos() const override { return m_currentPos; } | 82 float currentPos() const override { return m_currentPos; } |
83 virtual int visibleSize() const override { return m_visibleSize; } | 83 int visibleSize() const override { return m_visibleSize; } |
84 virtual int totalSize() const override { return m_totalSize; } | 84 int totalSize() const override { return m_totalSize; } |
85 virtual int maximum() const override { return m_totalSize - m_visibleSize; } | 85 int maximum() const override { return m_totalSize - m_visibleSize; } |
86 virtual ScrollbarControlSize controlSize() const override { return m_control
Size; } | 86 ScrollbarControlSize controlSize() const override { return m_controlSize; } |
87 | 87 |
88 virtual ScrollbarPart pressedPart() const override { return m_pressedPart; } | 88 ScrollbarPart pressedPart() const override { return m_pressedPart; } |
89 virtual ScrollbarPart hoveredPart() const override { return m_hoveredPart; } | 89 ScrollbarPart hoveredPart() const override { return m_hoveredPart; } |
90 | 90 |
91 virtual void styleChanged() override { } | 91 void styleChanged() override { } |
92 | 92 |
93 virtual bool enabled() const override { return m_enabled; } | 93 bool enabled() const override { return m_enabled; } |
94 virtual void setEnabled(bool) override; | 94 void setEnabled(bool) override; |
95 | 95 |
96 // Called by the ScrollableArea when the scroll offset changes. | 96 // Called by the ScrollableArea when the scroll offset changes. |
97 void offsetDidChange(); | 97 void offsetDidChange(); |
98 | 98 |
99 void disconnectFromScrollableArea(); | 99 void disconnectFromScrollableArea(); |
100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
101 | 101 |
102 int pressedPos() const { return m_pressedPos; } | 102 int pressedPos() const { return m_pressedPos; } |
103 | 103 |
104 virtual void setHoveredPart(ScrollbarPart); | 104 virtual void setHoveredPart(ScrollbarPart); |
105 virtual void setPressedPart(ScrollbarPart); | 105 virtual void setPressedPart(ScrollbarPart); |
106 | 106 |
107 void setProportion(int visibleSize, int totalSize); | 107 void setProportion(int visibleSize, int totalSize); |
108 void setPressedPos(int p) { m_pressedPos = p; } | 108 void setPressedPos(int p) { m_pressedPos = p; } |
109 | 109 |
110 virtual void paint(GraphicsContext*, const IntRect& damageRect) final; | 110 void paint(GraphicsContext*, const IntRect& damageRect) final; |
111 | 111 |
112 virtual bool isOverlayScrollbar() const override; | 112 bool isOverlayScrollbar() const override; |
113 bool shouldParticipateInHitTesting(); | 113 bool shouldParticipateInHitTesting(); |
114 | 114 |
115 bool isWindowActive() const; | 115 bool isWindowActive() const; |
116 | 116 |
117 bool gestureEvent(const PlatformGestureEvent&); | 117 bool gestureEvent(const PlatformGestureEvent&); |
118 | 118 |
119 // These methods are used for platform scrollbars to give :hover feedback.
They will not get called | 119 // These methods are used for platform scrollbars to give :hover feedback.
They will not get called |
120 // when the mouse went down in a scrollbar, since it is assumed the scrollba
r will start | 120 // when the mouse went down in a scrollbar, since it is assumed the scrollba
r will start |
121 // grabbing all events in that case anyway. | 121 // grabbing all events in that case anyway. |
122 void mouseMoved(const PlatformMouseEvent&); | 122 void mouseMoved(const PlatformMouseEvent&); |
123 void mouseEntered(); | 123 void mouseEntered(); |
124 void mouseExited(); | 124 void mouseExited(); |
125 | 125 |
126 // Used by some platform scrollbars to know when they've been released from
capture. | 126 // Used by some platform scrollbars to know when they've been released from
capture. |
127 void mouseUp(const PlatformMouseEvent&); | 127 void mouseUp(const PlatformMouseEvent&); |
128 void mouseDown(const PlatformMouseEvent&); | 128 void mouseDown(const PlatformMouseEvent&); |
129 | 129 |
130 ScrollbarTheme* theme() const { return m_theme; } | 130 ScrollbarTheme* theme() const { return m_theme; } |
131 | 131 |
132 bool suppressInvalidation() const { return m_suppressInvalidation; } | 132 bool suppressInvalidation() const { return m_suppressInvalidation; } |
133 void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; } | 133 void setSuppressInvalidation(bool s) { m_suppressInvalidation = s; } |
134 | 134 |
135 virtual IntRect convertToContainingView(const IntRect&) const override; | 135 IntRect convertToContainingView(const IntRect&) const override; |
136 virtual IntRect convertFromContainingView(const IntRect&) const override; | 136 IntRect convertFromContainingView(const IntRect&) const override; |
137 | 137 |
138 virtual IntPoint convertToContainingView(const IntPoint&) const override; | 138 IntPoint convertToContainingView(const IntPoint&) const override; |
139 virtual IntPoint convertFromContainingView(const IntPoint&) const override; | 139 IntPoint convertFromContainingView(const IntPoint&) const override; |
140 | 140 |
141 void moveThumb(int pos, bool draggingDocument = false); | 141 void moveThumb(int pos, bool draggingDocument = false); |
142 | 142 |
143 virtual bool isAlphaLocked() const override { return m_isAlphaLocked; } | 143 bool isAlphaLocked() const override { return m_isAlphaLocked; } |
144 virtual void setIsAlphaLocked(bool flag) override { m_isAlphaLocked = flag;
} | 144 void setIsAlphaLocked(bool flag) override { m_isAlphaLocked = flag; } |
145 | 145 |
146 virtual float elasticOverscroll() const override { return m_elasticOverscrol
l; } | 146 float elasticOverscroll() const override { return m_elasticOverscroll; } |
147 virtual void setElasticOverscroll(float elasticOverscroll) override { m_elas
ticOverscroll = elasticOverscroll; } | 147 void setElasticOverscroll(float elasticOverscroll) override { m_elasticOvers
croll = elasticOverscroll; } |
148 | 148 |
149 bool overlapsResizer() const { return m_overlapsResizer; } | 149 bool overlapsResizer() const { return m_overlapsResizer; } |
150 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps
Resizer; } | 150 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps
Resizer; } |
151 | 151 |
152 virtual DisplayItemClient displayItemClient() const override { return toDisp
layItemClient(this); } | 152 DisplayItemClient displayItemClient() const override { return toDisplayItemC
lient(this); } |
153 virtual String debugName() const override { return m_orientation == Horizont
alScrollbar ? "HorizontalScrollbar" : "VerticalScrollbar"; } | 153 String debugName() const override { return m_orientation == HorizontalScroll
bar ? "HorizontalScrollbar" : "VerticalScrollbar"; } |
154 | 154 |
155 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. | 155 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. |
156 EAGERLY_FINALIZE(); | 156 EAGERLY_FINALIZE(); |
157 #if ENABLE(OILPAN) | 157 #if ENABLE(OILPAN) |
158 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 158 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
159 #endif | 159 #endif |
160 DECLARE_VIRTUAL_TRACE(); | 160 DECLARE_VIRTUAL_TRACE(); |
161 | 161 |
162 protected: | 162 protected: |
163 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); | 163 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 Timer<Scrollbar> m_scrollTimer; | 195 Timer<Scrollbar> m_scrollTimer; |
196 bool m_overlapsResizer; | 196 bool m_overlapsResizer; |
197 | 197 |
198 bool m_suppressInvalidation; | 198 bool m_suppressInvalidation; |
199 | 199 |
200 bool m_isAlphaLocked; | 200 bool m_isAlphaLocked; |
201 | 201 |
202 float m_elasticOverscroll; | 202 float m_elasticOverscroll; |
203 | 203 |
204 private: | 204 private: |
205 virtual bool isScrollbar() const override { return true; } | 205 bool isScrollbar() const override { return true; } |
206 | 206 |
207 float scrollableAreaCurrentPos() const; | 207 float scrollableAreaCurrentPos() const; |
208 }; | 208 }; |
209 | 209 |
210 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 210 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
211 | 211 |
212 } // namespace blink | 212 } // namespace blink |
213 | 213 |
214 #endif // Scrollbar_h | 214 #endif // Scrollbar_h |
OLD | NEW |