| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef Scrollbar_h | 26 #ifndef Scrollbar_h |
| 27 #define Scrollbar_h | 27 #define Scrollbar_h |
| 28 | 28 |
| 29 #include "platform/FrameViewBase.h" |
| 29 #include "platform/Timer.h" | 30 #include "platform/Timer.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 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class GraphicsContext; | 39 class GraphicsContext; |
| 40 class HostWindow; | 40 class HostWindow; |
| 41 class IntRect; | 41 class IntRect; |
| 42 class ScrollableArea; | 42 class ScrollableArea; |
| 43 class ScrollbarTheme; | 43 class ScrollbarTheme; |
| 44 class WebGestureEvent; | 44 class WebGestureEvent; |
| 45 class WebMouseEvent; | 45 class WebMouseEvent; |
| 46 | 46 |
| 47 class PLATFORM_EXPORT Scrollbar : public Widget, | 47 class PLATFORM_EXPORT Scrollbar : public FrameViewBase, |
| 48 public ScrollbarThemeClient, | 48 public ScrollbarThemeClient, |
| 49 public DisplayItemClient { | 49 public DisplayItemClient { |
| 50 public: | 50 public: |
| 51 static Scrollbar* create(ScrollableArea* scrollableArea, | 51 static Scrollbar* create(ScrollableArea* scrollableArea, |
| 52 ScrollbarOrientation orientation, | 52 ScrollbarOrientation orientation, |
| 53 ScrollbarControlSize size, | 53 ScrollbarControlSize size, |
| 54 HostWindow* hostWindow) { | 54 HostWindow* hostWindow) { |
| 55 return new Scrollbar(scrollableArea, orientation, size, hostWindow); | 55 return new Scrollbar(scrollableArea, orientation, size, hostWindow); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Theme object ownership remains with the caller and it must outlive the | 58 // Theme object ownership remains with the caller and it must outlive the |
| 59 // scrollbar. | 59 // scrollbar. |
| 60 static Scrollbar* createForTesting(ScrollableArea* scrollableArea, | 60 static Scrollbar* createForTesting(ScrollableArea* scrollableArea, |
| 61 ScrollbarOrientation orientation, | 61 ScrollbarOrientation orientation, |
| 62 ScrollbarControlSize size, | 62 ScrollbarControlSize size, |
| 63 ScrollbarTheme* theme) { | 63 ScrollbarTheme* theme) { |
| 64 return new Scrollbar(scrollableArea, orientation, size, nullptr, theme); | 64 return new Scrollbar(scrollableArea, orientation, size, nullptr, theme); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ~Scrollbar() override; | 67 ~Scrollbar() override; |
| 68 | 68 |
| 69 // ScrollbarThemeClient implementation. | 69 // ScrollbarThemeClient implementation. |
| 70 int x() const override { return Widget::x(); } | 70 int x() const override { return FrameViewBase::x(); } |
| 71 int y() const override { return Widget::y(); } | 71 int y() const override { return FrameViewBase::y(); } |
| 72 int width() const override { return Widget::width(); } | 72 int width() const override { return FrameViewBase::width(); } |
| 73 int height() const override { return Widget::height(); } | 73 int height() const override { return FrameViewBase::height(); } |
| 74 IntSize size() const override { return Widget::size(); } | 74 IntSize size() const override { return FrameViewBase::size(); } |
| 75 IntPoint location() const override { return Widget::location(); } | 75 IntPoint location() const override { return FrameViewBase::location(); } |
| 76 | 76 |
| 77 Widget* parent() const override { return Widget::parent(); } | 77 FrameViewBase* parent() const override { return FrameViewBase::parent(); } |
| 78 Widget* root() const override { return Widget::root(); } | 78 FrameViewBase* root() const override { return FrameViewBase::root(); } |
| 79 | 79 |
| 80 void setFrameRect(const IntRect&) override; | 80 void setFrameRect(const IntRect&) override; |
| 81 IntRect frameRect() const override { return Widget::frameRect(); } | 81 IntRect frameRect() const override { return FrameViewBase::frameRect(); } |
| 82 | 82 |
| 83 ScrollbarOverlayColorTheme getScrollbarOverlayColorTheme() const override; | 83 ScrollbarOverlayColorTheme getScrollbarOverlayColorTheme() const override; |
| 84 void getTickmarks(Vector<IntRect>&) const override; | 84 void getTickmarks(Vector<IntRect>&) const override; |
| 85 bool isScrollableAreaActive() const override; | 85 bool isScrollableAreaActive() const override; |
| 86 | 86 |
| 87 IntPoint convertFromRootFrame( | 87 IntPoint convertFromRootFrame( |
| 88 const IntPoint& pointInRootFrame) const override { | 88 const IntPoint& pointInRootFrame) const override { |
| 89 return Widget::convertFromRootFrame(pointInRootFrame); | 89 return FrameViewBase::convertFromRootFrame(pointInRootFrame); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool isCustomScrollbar() const override { return false; } | 92 bool isCustomScrollbar() const override { return false; } |
| 93 ScrollbarOrientation orientation() const override { return m_orientation; } | 93 ScrollbarOrientation orientation() const override { return m_orientation; } |
| 94 bool isLeftSideVerticalScrollbar() const override; | 94 bool isLeftSideVerticalScrollbar() const override; |
| 95 | 95 |
| 96 int value() const override { return lroundf(m_currentPos); } | 96 int value() const override { return lroundf(m_currentPos); } |
| 97 float currentPos() const override { return m_currentPos; } | 97 float currentPos() const override { return m_currentPos; } |
| 98 int visibleSize() const override { return m_visibleSize; } | 98 int visibleSize() const override { return m_visibleSize; } |
| 99 int totalSize() const override { return m_totalSize; } | 99 int totalSize() const override { return m_totalSize; } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 float scrollableAreaTargetPos() const; | 254 float scrollableAreaTargetPos() const; |
| 255 bool thumbWillBeUnderMouse() const; | 255 bool thumbWillBeUnderMouse() const; |
| 256 | 256 |
| 257 int m_themeScrollbarThickness; | 257 int m_themeScrollbarThickness; |
| 258 bool m_trackNeedsRepaint; | 258 bool m_trackNeedsRepaint; |
| 259 bool m_thumbNeedsRepaint; | 259 bool m_thumbNeedsRepaint; |
| 260 LayoutRect m_visualRect; | 260 LayoutRect m_visualRect; |
| 261 }; | 261 }; |
| 262 | 262 |
| 263 DEFINE_TYPE_CASTS(Scrollbar, | 263 DEFINE_TYPE_CASTS(Scrollbar, |
| 264 Widget, | 264 FrameViewBase, |
| 265 widget, | 265 frameViewBase, |
| 266 widget->isScrollbar(), | 266 frameViewBase->isScrollbar(), |
| 267 widget.isScrollbar()); | 267 frameViewBase.isScrollbar()); |
| 268 | 268 |
| 269 } // namespace blink | 269 } // namespace blink |
| 270 | 270 |
| 271 #endif // Scrollbar_h | 271 #endif // Scrollbar_h |
| OLD | NEW |