| 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 // | 97 void offsetDidChange(); |
| 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 can be moved without repainting. | |
| 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(); | |
| 106 | 98 |
| 107 void disconnectFromScrollableArea(); | 99 void disconnectFromScrollableArea(); |
| 108 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
| 109 | 101 |
| 110 int pressedPos() const { return m_pressedPos; } | 102 int pressedPos() const { return m_pressedPos; } |
| 111 | 103 |
| 112 virtual void setHoveredPart(ScrollbarPart); | 104 virtual void setHoveredPart(ScrollbarPart); |
| 113 virtual void setPressedPart(ScrollbarPart); | 105 virtual void setPressedPart(ScrollbarPart); |
| 114 | 106 |
| 115 void setProportion(int visibleSize, int totalSize); | 107 void setProportion(int visibleSize, int totalSize); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 142 IntRect convertFromContainingWidget(const IntRect&) const override; | 134 IntRect convertFromContainingWidget(const IntRect&) const override; |
| 143 | 135 |
| 144 IntPoint convertToContainingWidget(const IntPoint&) const override; | 136 IntPoint convertToContainingWidget(const IntPoint&) const override; |
| 145 IntPoint convertFromContainingWidget(const IntPoint&) const override; | 137 IntPoint convertFromContainingWidget(const IntPoint&) const override; |
| 146 | 138 |
| 147 void moveThumb(int pos, bool draggingDocument = false); | 139 void moveThumb(int pos, bool draggingDocument = false); |
| 148 | 140 |
| 149 float elasticOverscroll() const override { return m_elasticOverscroll; } | 141 float elasticOverscroll() const override { return m_elasticOverscroll; } |
| 150 void setElasticOverscroll(float elasticOverscroll) override { m_elasticOvers
croll = elasticOverscroll; } | 142 void setElasticOverscroll(float elasticOverscroll) override { m_elasticOvers
croll = elasticOverscroll; } |
| 151 | 143 |
| 152 // Use setNeedsPaintInvalidation to cause scrollbar parts to repaint. | |
| 153 bool trackNeedsRepaint() const { return m_trackNeedsRepaint; } | 144 bool trackNeedsRepaint() const { return m_trackNeedsRepaint; } |
| 154 void setTrackNeedsRepaint(bool trackNeedsRepaint) { m_trackNeedsRepaint = tr
ackNeedsRepaint; } | 145 void setTrackNeedsRepaint(bool trackNeedsRepaint) { m_trackNeedsRepaint = tr
ackNeedsRepaint; } |
| 155 bool thumbNeedsRepaint() const { return m_thumbNeedsRepaint; } | 146 bool thumbNeedsRepaint() const { return m_thumbNeedsRepaint; } |
| 156 void setThumbNeedsRepaint(bool thumbNeedsRepaint) { m_thumbNeedsRepaint = th
umbNeedsRepaint; } | 147 void setThumbNeedsRepaint(bool thumbNeedsRepaint) { m_thumbNeedsRepaint = th
umbNeedsRepaint; } |
| 157 | 148 |
| 158 bool overlapsResizer() const { return m_overlapsResizer; } | 149 bool overlapsResizer() const { return m_overlapsResizer; } |
| 159 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps
Resizer; } | 150 void setOverlapsResizer(bool overlapsResizer) { m_overlapsResizer = overlaps
Resizer; } |
| 160 | 151 |
| 161 // DisplayItemClient methods. | 152 // DisplayItemClient methods. |
| 162 String debugName() const final { return m_orientation == HorizontalScrollbar
? "HorizontalScrollbar" : "VerticalScrollbar"; } | 153 String debugName() const final { return m_orientation == HorizontalScrollbar
? "HorizontalScrollbar" : "VerticalScrollbar"; } |
| 163 // TODO(chrishtr): fix this. | 154 // TODO(chrishtr): fix this. |
| 164 IntRect visualRect() const override { return IntRect(); } | 155 IntRect visualRect() const override { return IntRect(); } |
| 165 | 156 |
| 166 // Marks the specified parts of the scrollbar as needing paint invalidation. | 157 void setNeedsPaintInvalidation(); |
| 167 // Uses the associated ScrollableArea to cause invalidation. | |
| 168 void setNeedsPaintInvalidation(ScrollbarPart = AllParts); | |
| 169 | 158 |
| 170 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. | 159 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. |
| 171 EAGERLY_FINALIZE(); | 160 EAGERLY_FINALIZE(); |
| 172 #if ENABLE(OILPAN) | 161 #if ENABLE(OILPAN) |
| 173 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 162 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
| 174 #endif | 163 #endif |
| 175 DECLARE_VIRTUAL_TRACE(); | 164 DECLARE_VIRTUAL_TRACE(); |
| 176 | 165 |
| 177 protected: | 166 protected: |
| 178 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); | 167 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); |
| 179 | 168 |
| 169 void updateThumb(); |
| 180 | 170 |
| 181 void autoscrollTimerFired(Timer<Scrollbar>*); | 171 void autoscrollTimerFired(Timer<Scrollbar>*); |
| 182 void startTimerIfNeeded(double delay); | 172 void startTimerIfNeeded(double delay); |
| 183 void stopTimerIfNeeded(); | 173 void stopTimerIfNeeded(); |
| 184 void autoscrollPressedPart(double delay); | 174 void autoscrollPressedPart(double delay); |
| 185 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); | 175 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); |
| 186 ScrollGranularity pressedPartScrollGranularity(); | 176 ScrollGranularity pressedPartScrollGranularity(); |
| 187 | 177 |
| 188 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 178 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
| 189 ScrollbarOrientation m_orientation; | 179 ScrollbarOrientation m_orientation; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 210 float m_elasticOverscroll; | 200 float m_elasticOverscroll; |
| 211 | 201 |
| 212 private: | 202 private: |
| 213 bool isScrollbar() const override { return true; } | 203 bool isScrollbar() const override { return true; } |
| 214 | 204 |
| 215 void invalidate() override { setNeedsPaintInvalidation(); } | 205 void invalidate() override { setNeedsPaintInvalidation(); } |
| 216 void invalidateRect(const IntRect&) override { setNeedsPaintInvalidation();
} | 206 void invalidateRect(const IntRect&) override { setNeedsPaintInvalidation();
} |
| 217 | 207 |
| 218 float scrollableAreaCurrentPos() const; | 208 float scrollableAreaCurrentPos() const; |
| 219 | 209 |
| 210 void updateThumbPosition(); |
| 211 void updateThumbProportion(); |
| 212 |
| 220 bool m_trackNeedsRepaint; | 213 bool m_trackNeedsRepaint; |
| 221 bool m_thumbNeedsRepaint; | 214 bool m_thumbNeedsRepaint; |
| 222 }; | 215 }; |
| 223 | 216 |
| 224 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 217 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
| 225 | 218 |
| 226 } // namespace blink | 219 } // namespace blink |
| 227 | 220 |
| 228 #endif // Scrollbar_h | 221 #endif // Scrollbar_h |
| OLD | NEW |