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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 | 87 |
88 ScrollbarPart pressedPart() const override { return m_pressedPart; } | 88 ScrollbarPart pressedPart() const override { return m_pressedPart; } |
89 ScrollbarPart hoveredPart() const override { return m_hoveredPart; } | 89 ScrollbarPart hoveredPart() const override { return m_hoveredPart; } |
90 | 90 |
91 void styleChanged() override { } | 91 void styleChanged() override { } |
92 void visibilityChanged() override; | 92 void visibilityChanged() override; |
93 bool enabled() const override { return m_enabled; } | 93 bool enabled() const override { return m_enabled; } |
94 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 // |
98 // Will invalidate the scrollbar if either the track or the thumb is | |
99 // invalidated. The caller is responsible for issuing paint invalidations | |
100 // when only the thumb position changes, as the scrollbar is unaware of | |
101 // whether the thumb is painted in a separate layer. | |
skobes
2015/12/28 17:48:39
Technically the thumb is never a separate layer.
jbroman
2015/12/29 16:45:14
reworded to "...unaware of whether the thumb can b
| |
102 // | |
103 // Returns true if the scrollbar's offset was actually updated, so that the | |
104 // caller can issue additional invalidations as needed. | |
105 bool offsetDidChange(); | |
98 | 106 |
99 void disconnectFromScrollableArea(); | 107 void disconnectFromScrollableArea(); |
100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 108 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
101 | 109 |
102 int pressedPos() const { return m_pressedPos; } | 110 int pressedPos() const { return m_pressedPos; } |
103 | 111 |
104 virtual void setHoveredPart(ScrollbarPart); | 112 virtual void setHoveredPart(ScrollbarPart); |
105 virtual void setPressedPart(ScrollbarPart); | 113 virtual void setPressedPart(ScrollbarPart); |
106 | 114 |
107 void setProportion(int visibleSize, int totalSize); | 115 void setProportion(int visibleSize, int totalSize); |
(...skipping 26 matching lines...) Expand all Loading... | |
134 IntRect convertFromContainingWidget(const IntRect&) const override; | 142 IntRect convertFromContainingWidget(const IntRect&) const override; |
135 | 143 |
136 IntPoint convertToContainingWidget(const IntPoint&) const override; | 144 IntPoint convertToContainingWidget(const IntPoint&) const override; |
137 IntPoint convertFromContainingWidget(const IntPoint&) const override; | 145 IntPoint convertFromContainingWidget(const IntPoint&) const override; |
138 | 146 |
139 void moveThumb(int pos, bool draggingDocument = false); | 147 void moveThumb(int pos, bool draggingDocument = false); |
140 | 148 |
141 float elasticOverscroll() const override { return m_elasticOverscroll; } | 149 float elasticOverscroll() const override { return m_elasticOverscroll; } |
142 void setElasticOverscroll(float elasticOverscroll) override { m_elasticOvers croll = elasticOverscroll; } | 150 void setElasticOverscroll(float elasticOverscroll) override { m_elasticOvers croll = elasticOverscroll; } |
143 | 151 |
152 // Use setNeedsPaintInvalidation to cause scrollbar parts to repaint. | |
144 bool trackNeedsRepaint() const { return m_trackNeedsRepaint; } | 153 bool trackNeedsRepaint() const { return m_trackNeedsRepaint; } |
145 void setTrackNeedsRepaint(bool trackNeedsRepaint) { m_trackNeedsRepaint = tr ackNeedsRepaint; } | 154 void setTrackNeedsRepaint(bool trackNeedsRepaint) { m_trackNeedsRepaint = tr ackNeedsRepaint; } |
146 bool thumbNeedsRepaint() const { return m_thumbNeedsRepaint; } | 155 bool thumbNeedsRepaint() const { return m_thumbNeedsRepaint; } |
147 void setThumbNeedsRepaint(bool thumbNeedsRepaint) { m_thumbNeedsRepaint = th umbNeedsRepaint; } | 156 void setThumbNeedsRepaint(bool thumbNeedsRepaint) { m_thumbNeedsRepaint = th umbNeedsRepaint; } |
148 | 157 |
149 bool overlapsResizer() const { return m_overlapsResizer; } | 158 bool overlapsResizer() const { return m_overlapsResizer; } |
150 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps Resizer; } | 159 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps Resizer; } |
151 | 160 |
152 // DisplayItemClient methods. | 161 // DisplayItemClient methods. |
153 String debugName() const final { return m_orientation == HorizontalScrollbar ? "HorizontalScrollbar" : "VerticalScrollbar"; } | 162 String debugName() const final { return m_orientation == HorizontalScrollbar ? "HorizontalScrollbar" : "VerticalScrollbar"; } |
154 // TODO(chrishtr): fix this. | 163 // TODO(chrishtr): fix this. |
155 IntRect visualRect() const override { return IntRect(); } | 164 IntRect visualRect() const override { return IntRect(); } |
156 | 165 |
157 void setNeedsPaintInvalidation(); | 166 // Marks the specified parts of the scrollbar as needing paint invalidation. |
167 // Uses the associated ScrollableArea to cause invalidation. | |
168 void setNeedsPaintInvalidation(ScrollbarPart = AllParts); | |
158 | 169 |
159 // Promptly unregister from the theme manager + run finalizers of derived Sc rollbars. | 170 // Promptly unregister from the theme manager + run finalizers of derived Sc rollbars. |
160 EAGERLY_FINALIZE(); | 171 EAGERLY_FINALIZE(); |
161 #if ENABLE(OILPAN) | 172 #if ENABLE(OILPAN) |
162 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 173 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
163 #endif | 174 #endif |
164 DECLARE_VIRTUAL_TRACE(); | 175 DECLARE_VIRTUAL_TRACE(); |
165 | 176 |
166 protected: | 177 protected: |
167 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol lbarTheme* = 0); | 178 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol lbarTheme* = 0); |
168 | 179 |
169 void updateThumb(); | |
170 | 180 |
171 void autoscrollTimerFired(Timer<Scrollbar>*); | 181 void autoscrollTimerFired(Timer<Scrollbar>*); |
172 void startTimerIfNeeded(double delay); | 182 void startTimerIfNeeded(double delay); |
173 void stopTimerIfNeeded(); | 183 void stopTimerIfNeeded(); |
174 void autoscrollPressedPart(double delay); | 184 void autoscrollPressedPart(double delay); |
175 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); | 185 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); |
176 ScrollGranularity pressedPartScrollGranularity(); | 186 ScrollGranularity pressedPartScrollGranularity(); |
177 | 187 |
178 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 188 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
179 ScrollbarOrientation m_orientation; | 189 ScrollbarOrientation m_orientation; |
(...skipping 20 matching lines...) Expand all Loading... | |
200 float m_elasticOverscroll; | 210 float m_elasticOverscroll; |
201 | 211 |
202 private: | 212 private: |
203 bool isScrollbar() const override { return true; } | 213 bool isScrollbar() const override { return true; } |
204 | 214 |
205 void invalidate() override { setNeedsPaintInvalidation(); } | 215 void invalidate() override { setNeedsPaintInvalidation(); } |
206 void invalidateRect(const IntRect&) override { setNeedsPaintInvalidation(); } | 216 void invalidateRect(const IntRect&) override { setNeedsPaintInvalidation(); } |
207 | 217 |
208 float scrollableAreaCurrentPos() const; | 218 float scrollableAreaCurrentPos() const; |
209 | 219 |
210 void updateThumbPosition(); | |
211 void updateThumbProportion(); | |
212 | |
213 bool m_trackNeedsRepaint; | 220 bool m_trackNeedsRepaint; |
214 bool m_thumbNeedsRepaint; | 221 bool m_thumbNeedsRepaint; |
215 }; | 222 }; |
216 | 223 |
217 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar()); | 224 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr ollbar()); |
218 | 225 |
219 } // namespace blink | 226 } // namespace blink |
220 | 227 |
221 #endif // Scrollbar_h | 228 #endif // Scrollbar_h |
OLD | NEW |