| 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 15 matching lines...) Expand all Loading... |
| 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/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" | |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 class GraphicsContext; | 39 class GraphicsContext; |
| 41 class HostWindow; | 40 class HostWindow; |
| 42 class IntRect; | 41 class IntRect; |
| 43 class PlatformGestureEvent; | 42 class PlatformGestureEvent; |
| 44 class PlatformMouseEvent; | 43 class PlatformMouseEvent; |
| 45 class ScrollAnimatorBase; | 44 class ScrollAnimatorBase; |
| 46 class ScrollableArea; | 45 class ScrollableArea; |
| 47 class ScrollbarTheme; | 46 class ScrollbarTheme; |
| 48 | 47 |
| 49 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { | 48 class PLATFORM_EXPORT Scrollbar : public Widget, public ScrollbarThemeClient { |
| 50 public: | 49 public: |
| 51 static RawPtr<Scrollbar> create(ScrollableArea*, ScrollbarOrientation, Scrol
lbarControlSize, HostWindow*); | 50 static Scrollbar* create(ScrollableArea* scrollableArea, ScrollbarOrientatio
n orientation, ScrollbarControlSize size, HostWindow* hostWindow) |
| 51 { |
| 52 return new Scrollbar(scrollableArea, orientation, size, hostWindow); |
| 53 } |
| 52 | 54 |
| 53 // Theme object ownership remains with the caller and it must outlive the sc
rollbar. | 55 // Theme object ownership remains with the caller and it must outlive the sc
rollbar. |
| 54 static RawPtr<Scrollbar> createForTesting(ScrollableArea*, ScrollbarOrientat
ion, ScrollbarControlSize, ScrollbarTheme*); | 56 static Scrollbar* createForTesting(ScrollableArea* scrollableArea, Scrollbar
Orientation orientation, ScrollbarControlSize size, ScrollbarTheme* theme) |
| 57 { |
| 58 return new Scrollbar(scrollableArea, orientation, size, nullptr, theme); |
| 59 } |
| 55 | 60 |
| 56 ~Scrollbar() override; | 61 ~Scrollbar() override; |
| 57 | 62 |
| 58 // ScrollbarThemeClient implementation. | 63 // ScrollbarThemeClient implementation. |
| 59 int x() const override { return Widget::x(); } | 64 int x() const override { return Widget::x(); } |
| 60 int y() const override { return Widget::y(); } | 65 int y() const override { return Widget::y(); } |
| 61 int width() const override { return Widget::width(); } | 66 int width() const override { return Widget::width(); } |
| 62 int height() const override { return Widget::height(); } | 67 int height() const override { return Widget::height(); } |
| 63 IntSize size() const override { return Widget::size(); } | 68 IntSize size() const override { return Widget::size(); } |
| 64 IntPoint location() const override { return Widget::location(); } | 69 IntPoint location() const override { return Widget::location(); } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // may be cached in a GPU texture (and is only guaranteed to be repainted if | 174 // may be cached in a GPU texture (and is only guaranteed to be repainted if |
| 170 // ThumbPart is invalidated). | 175 // ThumbPart is invalidated). |
| 171 // | 176 // |
| 172 // Even if no parts are invalidated, the scrollbar may need to be redrawn | 177 // Even if no parts are invalidated, the scrollbar may need to be redrawn |
| 173 // if, for instance, the thumb moves without changing the appearance of any | 178 // if, for instance, the thumb moves without changing the appearance of any |
| 174 // part. | 179 // part. |
| 175 void setNeedsPaintInvalidation(ScrollbarPart invalidParts); | 180 void setNeedsPaintInvalidation(ScrollbarPart invalidParts); |
| 176 | 181 |
| 177 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. | 182 // Promptly unregister from the theme manager + run finalizers of derived Sc
rollbars. |
| 178 EAGERLY_FINALIZE(); | 183 EAGERLY_FINALIZE(); |
| 179 #if ENABLE(OILPAN) | |
| 180 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); | 184 DECLARE_EAGER_FINALIZATION_OPERATOR_NEW(); |
| 181 #endif | |
| 182 DECLARE_VIRTUAL_TRACE(); | 185 DECLARE_VIRTUAL_TRACE(); |
| 183 | 186 |
| 184 protected: | 187 protected: |
| 185 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, HostW
indow* = 0, ScrollbarTheme* = 0); | 188 Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, HostW
indow* = 0, ScrollbarTheme* = 0); |
| 186 | 189 |
| 187 void autoscrollTimerFired(Timer<Scrollbar>*); | 190 void autoscrollTimerFired(Timer<Scrollbar>*); |
| 188 void startTimerIfNeeded(double delay); | 191 void startTimerIfNeeded(double delay); |
| 189 void stopTimerIfNeeded(); | 192 void stopTimerIfNeeded(); |
| 190 void autoscrollPressedPart(double delay); | 193 void autoscrollPressedPart(double delay); |
| 191 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); | 194 ScrollDirectionPhysical pressedPartScrollDirectionPhysical(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 231 |
| 229 bool m_trackNeedsRepaint; | 232 bool m_trackNeedsRepaint; |
| 230 bool m_thumbNeedsRepaint; | 233 bool m_thumbNeedsRepaint; |
| 231 }; | 234 }; |
| 232 | 235 |
| 233 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); | 236 DEFINE_TYPE_CASTS(Scrollbar, Widget, widget, widget->isScrollbar(), widget.isScr
ollbar()); |
| 234 | 237 |
| 235 } // namespace blink | 238 } // namespace blink |
| 236 | 239 |
| 237 #endif // Scrollbar_h | 240 #endif // Scrollbar_h |
| OLD | NEW |