blob: df1a04992d1ae9e0c5cea06261ae5911cdaa5c91 [file] [log] [blame]
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +00001/*
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 Murdoch591b9582013-07-10 11:41:44 +010030#include "wtf/RefPtr.h"
31#include "wtf/Vector.h"
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000032
33namespace WebCore {
34class IntPoint;
35class IntRect;
36class Scrollbar;
37}
38
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000039namespace blink {
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000040
41class ScrollbarGroup;
42
Torne (Richard Coles)09380292014-02-21 12:17:33 +000043class WebPluginScrollbarImpl FINAL : public WebPluginScrollbar {
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000044public:
Torne (Richard Coles)c0e19a62013-08-30 15:15:11 +010045 WebPluginScrollbarImpl(Orientation, ScrollbarGroup*, WebPluginScrollbarClient*);
Torne (Richard Coles)09380292014-02-21 12:17:33 +000046 virtual ~WebPluginScrollbarImpl();
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000047
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)51b29062013-11-28 11:56:03 +000058 // blink::WebScrollbar methods
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000059 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)8abfc582013-09-12 12:10:38 +010074 virtual bool isLeftSideVerticalScrollbar() const OVERRIDE;
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000075 virtual bool isCustomScrollbar() const OVERRIDE;
76
Torne (Richard Coles)51b29062013-11-28 11:56:03 +000077 // blink::WebPluginScrollbar methods
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +000078 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
87private:
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)51b29062013-11-28 11:56:03 +0000102} // namespace blink
Torne (Richard Coles)5c87bf82012-11-14 11:46:17 +0000103
104#endif