| 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 20 matching lines...) Expand all Loading... |
| 31 #include "platform/graphics/paint/DisplayItem.h" | 31 #include "platform/graphics/paint/DisplayItem.h" |
| 32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
| 33 #include "platform/scroll/ScrollTypes.h" | 33 #include "platform/scroll/ScrollTypes.h" |
| 34 #include "platform/scroll/ScrollbarThemeClient.h" | 34 #include "platform/scroll/ScrollbarThemeClient.h" |
| 35 #include "wtf/MathExtras.h" | 35 #include "wtf/MathExtras.h" |
| 36 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class GraphicsContext; | 40 class GraphicsContext; |
| 41 class HostWindow; |
| 41 class IntRect; | 42 class IntRect; |
| 42 class PlatformGestureEvent; | 43 class PlatformGestureEvent; |
| 43 class PlatformMouseEvent; | 44 class PlatformMouseEvent; |
| 44 class ScrollAnimatorBase; | 45 class ScrollAnimatorBase; |
| 45 class ScrollableArea; | 46 class ScrollableArea; |
| 46 class ScrollbarTheme; | 47 class ScrollbarTheme; |
| 47 | 48 |
| 48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { | 49 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { |
| 49 public: | 50 public: |
| 50 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize); | 51 static PassRefPtrWillBeRawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOr
ientation, ScrollbarControlSize, HostWindow*); |
| 51 | 52 |
| 52 // Theme object ownership remains with the caller and it must outlive the sc
rollbar. | 53 // Theme object ownership remains with the caller and it must outlive the sc
rollbar. |
| 53 static PassRefPtrWillBeRawPtr<Scrollbar> createForTesting(ScrollableArea*, S
crollbarOrientation, ScrollbarControlSize, ScrollbarTheme*); | 54 static PassRefPtrWillBeRawPtr<Scrollbar> createForTesting(ScrollableArea*, S
crollbarOrientation, ScrollbarControlSize, ScrollbarTheme*); |
| 54 | 55 |
| 55 ~Scrollbar() override; | 56 ~Scrollbar() override; |
| 56 | 57 |
| 57 // ScrollbarThemeClient implementation. | 58 // ScrollbarThemeClient implementation. |
| 58 int x() const override { return Widget::x(); } | 59 int x() const override { return Widget::x(); } |
| 59 int y() const override { return Widget::y(); } | 60 int y() const override { return Widget::y(); } |
| 60 int width() const override { return Widget::width(); } | 61 int width() const override { return Widget::width(); } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 86 ScrollbarControlSize controlSize() const override { return m_controlSize; } | 87 ScrollbarControlSize controlSize() const override { return m_controlSize; } |
| 87 | 88 |
| 88 ScrollbarPart pressedPart() const override { return m_pressedPart; } | 89 ScrollbarPart pressedPart() const override { return m_pressedPart; } |
| 89 ScrollbarPart hoveredPart() const override { return m_hoveredPart; } | 90 ScrollbarPart hoveredPart() const override { return m_hoveredPart; } |
| 90 | 91 |
| 91 void styleChanged() override { } | 92 void styleChanged() override { } |
| 92 void visibilityChanged() override; | 93 void visibilityChanged() override; |
| 93 bool enabled() const override { return m_enabled; } | 94 bool enabled() const override { return m_enabled; } |
| 94 void setEnabled(bool) override; | 95 void setEnabled(bool) override; |
| 95 | 96 |
| 97 int scrollbarThickness() const; |
| 98 |
| 96 // Called by the ScrollableArea when the scroll offset changes. | 99 // Called by the ScrollableArea when the scroll offset changes. |
| 97 void offsetDidChange(); | 100 void offsetDidChange(); |
| 98 | 101 |
| 99 void disconnectFromScrollableArea(); | 102 void disconnectFromScrollableArea(); |
| 100 ScrollableArea* scrollableArea() const { return m_scrollableArea; } | 103 ScrollableArea* scrollableArea() const { return m_scrollableArea; } |
| 101 | 104 |
| 102 int pressedPos() const { return m_pressedPos; } | 105 int pressedPos() const { return m_pressedPos; } |
| 103 | 106 |
| 104 virtual void setHoveredPart(ScrollbarPart); | 107 virtual void setHoveredPart(ScrollbarPart); |
| 105 virtual void setPressedPart(ScrollbarPart); | 108 virtual void setPressedPart(ScrollbarPart); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void setNeedsPaintInvalidation(ScrollbarPart invalidParts = NoPart); | 173 void setNeedsPaintInvalidation(ScrollbarPart invalidParts = NoPart); |
| 171 | 174 |
| 172 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. | 175 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. |
| 173 EAGERLY_FINALIZE(); | 176 EAGERLY_FINALIZE(); |
| 174 #if ENABLE(OILPAN) | 177 #if ENABLE(OILPAN) |
| 175 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 178 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
| 176 #endif | 179 #endif |
| 177 DECLARE_VIRTUAL_TRACE(); | 180 DECLARE_VIRTUAL_TRACE(); |
| 178 | 181 |
| 179 protected: | 182 protected: |
| 180 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, Scrol
lbarTheme* = 0); | 183 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, HostW
indow* = 0, ScrollbarTheme* = 0); |
| 181 | 184 |
| 182 void autoscrollTimerFired(Timer<Scrollbar>*); | 185 void autoscrollTimerFired(Timer<Scrollbar>*); |
| 183 void startTimerIfNeeded(double delay); | 186 void startTimerIfNeeded(double delay); |
| 184 void stopTimerIfNeeded(); | 187 void stopTimerIfNeeded(); |
| 185 void autoscrollPressedPart(double delay); | 188 void autoscrollPressedPart(double delay); |
| 186 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); | 189 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); |
| 187 ScrollGranularity pressedPartScrollGranularity(); | 190 ScrollGranularity pressedPartScrollGranularity(); |
| 188 | 191 |
| 189 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; | 192 RawPtrWillBeMember<ScrollableArea> m_scrollableArea; |
| 190 ScrollbarOrientation m_orientation; | 193 ScrollbarOrientation m_orientation; |
| 191 ScrollbarControlSize m_controlSize; | 194 ScrollbarControlSize m_controlSize; |
| 192 ScrollbarTheme& m_theme; | 195 ScrollbarTheme& m_theme; |
| 196 HostWindow* m_hostWindow; |
| 193 | 197 |
| 194 int m_visibleSize; | 198 int m_visibleSize; |
| 195 int m_totalSize; | 199 int m_totalSize; |
| 196 float m_currentPos; | 200 float m_currentPos; |
| 197 float m_dragOrigin; | 201 float m_dragOrigin; |
| 198 | 202 |
| 199 ScrollbarPart m_hoveredPart; | 203 ScrollbarPart m_hoveredPart; |
| 200 ScrollbarPart m_pressedPart; | 204 ScrollbarPart m_pressedPart; |
| 201 int m_pressedPos; | 205 int m_pressedPos; |
| 202 float m_scrollPos; | 206 float m_scrollPos; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 220 | 224 |
| 221 bool m_trackNeedsRepaint; | 225 bool m_trackNeedsRepaint; |
| 222 bool m_thumbNeedsRepaint; | 226 bool m_thumbNeedsRepaint; |
| 223 }; | 227 }; |
| 224 | 228 |
| 225 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 229 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
| 226 | 230 |
| 227 } // namespace blink | 231 } // namespace blink |
| 228 | 232 |
| 229 #endif // Scrollbar_h | 233 #endif // Scrollbar_h |
| OLD | NEW |