OLD | NEW |
| (Empty) |
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 AN
Y | |
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 AN
Y | |
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 O
N | |
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 "platform/heap/Handle.h" | |
29 #include "public/web/WebPluginScrollbar.h" | |
30 #include "wtf/RefPtr.h" | |
31 #include "wtf/Vector.h" | |
32 | |
33 namespace blink { | |
34 | |
35 class IntPoint; | |
36 class IntRect; | |
37 class Scrollbar; | |
38 class ScrollbarGroup; | |
39 | |
40 class WebPluginScrollbarImpl final : public WebPluginScrollbar { | |
41 public: | |
42 WebPluginScrollbarImpl(Orientation, ScrollbarGroup*, WebPluginScrollbarClien
t*); | |
43 virtual ~WebPluginScrollbarImpl(); | |
44 | |
45 void setScrollOffset(int); | |
46 void invalidateScrollbarRect(const IntRect&); | |
47 // FIXME: Combine this with the other getTickmarks method | |
48 void getTickmarks(Vector<IntRect>&) const; | |
49 IntPoint convertFromContainingViewToScrollbar(const IntPoint& parentPoint) c
onst; | |
50 void scrollbarStyleChanged(); | |
51 | |
52 int scrollOffset() { return m_scrollOffset; } | |
53 Scrollbar* scrollbar() { return m_scrollbar.get(); } | |
54 | |
55 // WebScrollbar methods | |
56 virtual bool isOverlay() const override; | |
57 virtual int value() const override; | |
58 virtual WebPoint location() const override; | |
59 virtual WebSize size() const override; | |
60 virtual bool enabled() const override; | |
61 virtual int maximum() const override; | |
62 virtual int totalSize() const override; | |
63 virtual bool isScrollableAreaActive() const override; | |
64 virtual void getTickmarks(WebVector<WebRect>& tickmarks) const override; | |
65 virtual WebScrollbar::ScrollbarControlSize controlSize() const override; | |
66 virtual WebScrollbar::ScrollbarPart pressedPart() const override; | |
67 virtual WebScrollbar::ScrollbarPart hoveredPart() const override; | |
68 virtual WebScrollbar::ScrollbarOverlayStyle scrollbarOverlayStyle() const ov
erride; | |
69 virtual WebScrollbar::Orientation orientation() const override; | |
70 virtual bool isLeftSideVerticalScrollbar() const override; | |
71 virtual bool isCustomScrollbar() const override; | |
72 | |
73 // WebPluginScrollbar methods | |
74 virtual void setLocation(const WebRect&) override; | |
75 virtual void setValue(int position) override; | |
76 virtual void setDocumentSize(int) override; | |
77 virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) ov
erride; | |
78 virtual void paint(WebCanvas*, const WebRect&) override; | |
79 virtual bool handleInputEvent(const WebInputEvent&) override; | |
80 virtual bool isAlphaLocked() const override; | |
81 virtual void setIsAlphaLocked(bool) override; | |
82 virtual float elasticOverscroll() const override; | |
83 virtual void setElasticOverscroll(float) override; | |
84 | |
85 private: | |
86 bool onMouseDown(const WebInputEvent&); | |
87 bool onMouseUp(const WebInputEvent&); | |
88 bool onMouseMove(const WebInputEvent&); | |
89 bool onMouseLeave(const WebInputEvent&); | |
90 bool onMouseWheel(const WebInputEvent&); | |
91 bool onKeyDown(const WebInputEvent&); | |
92 | |
93 ScrollbarGroup* m_group; | |
94 WebPluginScrollbarClient* m_client; | |
95 | |
96 int m_scrollOffset; | |
97 RefPtrWillBePersistent<Scrollbar> m_scrollbar; | |
98 }; | |
99 | |
100 } // namespace blink | |
101 | |
102 #endif | |
OLD | NEW |