Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 | * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 17 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 20 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | */ |
| 24 | |
| 25 | #ifndef WebPluginScrollbarImpl_h |
| 26 | #define WebPluginScrollbarImpl_h |
| 27 | |
| 28 | #include "WebPluginScrollbar.h" |
| 29 | |
Ben Murdoch | 591b958 | 2013-07-10 11:41:44 +0100 | [diff] [blame] | 30 | #include "wtf/RefPtr.h" |
| 31 | #include "wtf/Vector.h" |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 32 | |
| 33 | namespace WebCore { |
| 34 | class IntPoint; |
| 35 | class IntRect; |
| 36 | class Scrollbar; |
| 37 | } |
| 38 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 39 | namespace blink { |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 40 | |
| 41 | class ScrollbarGroup; |
| 42 | |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 43 | class WebPluginScrollbarImpl FINAL : public WebPluginScrollbar { |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 44 | public: |
Torne (Richard Coles) | c0e19a6 | 2013-08-30 15:15:11 +0100 | [diff] [blame] | 45 | WebPluginScrollbarImpl(Orientation, ScrollbarGroup*, WebPluginScrollbarClient*); |
Torne (Richard Coles) | 0938029 | 2014-02-21 12:17:33 +0000 | [diff] [blame] | 46 | virtual ~WebPluginScrollbarImpl(); |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 47 | |
| 48 | void setScrollOffset(int); |
| 49 | void invalidateScrollbarRect(const WebCore::IntRect&); |
| 50 | // FIXME: Combine this with the other getTickmarks method |
| 51 | void getTickmarks(Vector<WebCore::IntRect>&) const; |
| 52 | WebCore::IntPoint convertFromContainingViewToScrollbar(const WebCore::IntPoint& parentPoint) const; |
| 53 | void scrollbarStyleChanged(); |
| 54 | |
| 55 | int scrollOffset() { return m_scrollOffset; } |
| 56 | WebCore::Scrollbar* scrollbar() { return m_scrollbar.get(); } |
| 57 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 58 | // blink::WebScrollbar methods |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 59 | virtual bool isOverlay() const OVERRIDE; |
| 60 | virtual int value() const OVERRIDE; |
| 61 | virtual WebPoint location() const OVERRIDE; |
| 62 | virtual WebSize size() const OVERRIDE; |
| 63 | virtual bool enabled() const OVERRIDE; |
| 64 | virtual int maximum() const OVERRIDE; |
| 65 | virtual int totalSize() const OVERRIDE; |
| 66 | virtual bool isScrollViewScrollbar() const OVERRIDE; |
| 67 | virtual bool isScrollableAreaActive() const OVERRIDE; |
| 68 | virtual void getTickmarks(WebVector<WebRect>& tickmarks) const OVERRIDE; |
| 69 | virtual WebScrollbar::ScrollbarControlSize controlSize() const OVERRIDE; |
| 70 | virtual WebScrollbar::ScrollbarPart pressedPart() const OVERRIDE; |
| 71 | virtual WebScrollbar::ScrollbarPart hoveredPart() const OVERRIDE; |
| 72 | virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; |
| 73 | virtual WebScrollbar::Orientation orientation() const OVERRIDE; |
Torne (Richard Coles) | 8abfc58 | 2013-09-12 12:10:38 +0100 | [diff] [blame] | 74 | virtual bool isLeftSideVerticalScrollbar() const OVERRIDE; |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 75 | virtual bool isCustomScrollbar() const OVERRIDE; |
| 76 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 77 | // blink::WebPluginScrollbar methods |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 78 | virtual void setLocation(const WebRect&) OVERRIDE; |
| 79 | virtual void setValue(int position) OVERRIDE; |
| 80 | virtual void setDocumentSize(int) OVERRIDE; |
| 81 | virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) OVERRIDE; |
| 82 | virtual void paint(WebCanvas*, const WebRect&) OVERRIDE; |
| 83 | virtual bool handleInputEvent(const WebInputEvent&) OVERRIDE; |
| 84 | virtual bool isAlphaLocked() const OVERRIDE; |
| 85 | virtual void setIsAlphaLocked(bool) OVERRIDE; |
| 86 | |
| 87 | private: |
| 88 | bool onMouseDown(const WebInputEvent&); |
| 89 | bool onMouseUp(const WebInputEvent&); |
| 90 | bool onMouseMove(const WebInputEvent&); |
| 91 | bool onMouseLeave(const WebInputEvent&); |
| 92 | bool onMouseWheel(const WebInputEvent&); |
| 93 | bool onKeyDown(const WebInputEvent&); |
| 94 | |
| 95 | ScrollbarGroup* m_group; |
| 96 | WebPluginScrollbarClient* m_client; |
| 97 | |
| 98 | int m_scrollOffset; |
| 99 | RefPtr<WebCore::Scrollbar> m_scrollbar; |
| 100 | }; |
| 101 | |
Torne (Richard Coles) | 51b2906 | 2013-11-28 11:56:03 +0000 | [diff] [blame] | 102 | } // namespace blink |
Torne (Richard Coles) | 5c87bf8 | 2012-11-14 11:46:17 +0000 | [diff] [blame] | 103 | |
| 104 | #endif |