OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebPopupMenuImpl_h | 31 #ifndef WebPopupMenuImpl_h |
32 #define WebPopupMenuImpl_h | 32 #define WebPopupMenuImpl_h |
33 | 33 |
34 #include "platform/scroll/FramelessScrollViewClient.h" | |
35 #include "public/platform/WebContentLayerClient.h" | 34 #include "public/platform/WebContentLayerClient.h" |
36 #include "public/platform/WebPoint.h" | 35 #include "public/platform/WebPoint.h" |
37 #include "public/platform/WebSize.h" | 36 #include "public/platform/WebSize.h" |
38 #include "public/web/WebPopupMenu.h" | 37 #include "public/web/WebPopupMenu.h" |
| 38 #include "web/PopupContainerClient.h" |
39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 class LocalFrame; | 43 class LocalFrame; |
44 class FramelessScrollView; | |
45 class KeyboardEvent; | 44 class KeyboardEvent; |
46 class Page; | 45 class Page; |
47 class PlatformKeyboardEvent; | 46 class PlatformKeyboardEvent; |
48 class Range; | 47 class Range; |
49 class WebContentLayer; | 48 class WebContentLayer; |
50 class WebGestureEvent; | 49 class WebGestureEvent; |
51 class WebKeyboardEvent; | 50 class WebKeyboardEvent; |
52 class WebLayerTreeView; | 51 class WebLayerTreeView; |
53 class WebMouseEvent; | 52 class WebMouseEvent; |
54 class WebMouseWheelEvent; | 53 class WebMouseWheelEvent; |
55 class WebRange; | 54 class WebRange; |
56 class WebTouchEvent; | 55 class WebTouchEvent; |
57 class Widget; | 56 class Widget; |
58 struct WebRect; | 57 struct WebRect; |
59 | 58 |
60 class WebPopupMenuImpl : public WebPopupMenu, public FramelessScrollViewClient,
public WebContentLayerClient, public RefCounted<WebPopupMenuImpl> { | 59 class WebPopupMenuImpl : public WebPopupMenu, public PopupContainerClient, publi
c WebContentLayerClient, public RefCounted<WebPopupMenuImpl> { |
61 WTF_MAKE_FAST_ALLOCATED; | 60 WTF_MAKE_FAST_ALLOCATED; |
62 public: | 61 public: |
63 // WebWidget functions: | 62 // WebWidget functions: |
64 virtual void close() OVERRIDE FINAL; | 63 virtual void close() OVERRIDE FINAL; |
65 virtual WebSize size() OVERRIDE FINAL { return m_size; } | 64 virtual WebSize size() OVERRIDE FINAL { return m_size; } |
66 virtual void willStartLiveResize() OVERRIDE FINAL; | 65 virtual void willStartLiveResize() OVERRIDE FINAL; |
67 virtual void resize(const WebSize&) OVERRIDE FINAL; | 66 virtual void resize(const WebSize&) OVERRIDE FINAL; |
68 virtual void willEndLiveResize() OVERRIDE FINAL; | 67 virtual void willEndLiveResize() OVERRIDE FINAL; |
69 virtual void beginFrame(const WebBeginFrameArgs&) OVERRIDE FINAL; | 68 virtual void beginFrame(const WebBeginFrameArgs&) OVERRIDE FINAL; |
70 virtual void layout() OVERRIDE FINAL; | 69 virtual void layout() OVERRIDE FINAL; |
(...skipping 14 matching lines...) Expand all Loading... |
85 virtual void setTextDirection(WebTextDirection) OVERRIDE FINAL; | 84 virtual void setTextDirection(WebTextDirection) OVERRIDE FINAL; |
86 virtual bool isAcceleratedCompositingActive() const OVERRIDE FINAL { return
false; } | 85 virtual bool isAcceleratedCompositingActive() const OVERRIDE FINAL { return
false; } |
87 virtual bool isPopupMenu() const OVERRIDE FINAL { return true; } | 86 virtual bool isPopupMenu() const OVERRIDE FINAL { return true; } |
88 virtual void willCloseLayerTreeView() OVERRIDE FINAL; | 87 virtual void willCloseLayerTreeView() OVERRIDE FINAL; |
89 | 88 |
90 // WebContentLayerClient | 89 // WebContentLayerClient |
91 virtual void paintContents(WebCanvas*, const WebRect& clip, bool canPaintLCD
Test, WebFloatRect& opaque, | 90 virtual void paintContents(WebCanvas*, const WebRect& clip, bool canPaintLCD
Test, WebFloatRect& opaque, |
92 WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) O
VERRIDE FINAL; | 91 WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) O
VERRIDE FINAL; |
93 | 92 |
94 // WebPopupMenuImpl | 93 // WebPopupMenuImpl |
95 void initialize(FramelessScrollView* widget, const WebRect& bounds); | 94 void initialize(PopupContainer* widget, const WebRect& bounds); |
96 | 95 |
97 WebWidgetClient* client() { return m_client; } | 96 WebWidgetClient* client() { return m_client; } |
98 | 97 |
99 void handleMouseMove(const WebMouseEvent&); | 98 void handleMouseMove(const WebMouseEvent&); |
100 void handleMouseLeave(const WebMouseEvent&); | 99 void handleMouseLeave(const WebMouseEvent&); |
101 void handleMouseDown(const WebMouseEvent&); | 100 void handleMouseDown(const WebMouseEvent&); |
102 void handleMouseUp(const WebMouseEvent&); | 101 void handleMouseUp(const WebMouseEvent&); |
103 void handleMouseDoubleClick(const WebMouseEvent&); | 102 void handleMouseDoubleClick(const WebMouseEvent&); |
104 void handleMouseWheel(const WebMouseWheelEvent&); | 103 void handleMouseWheel(const WebMouseWheelEvent&); |
105 bool handleGestureEvent(const WebGestureEvent&); | 104 bool handleGestureEvent(const WebGestureEvent&); |
106 bool handleTouchEvent(const WebTouchEvent&); | 105 bool handleTouchEvent(const WebTouchEvent&); |
107 bool handleKeyEvent(const WebKeyboardEvent&); | 106 bool handleKeyEvent(const WebKeyboardEvent&); |
108 | 107 |
109 protected: | 108 protected: |
110 friend class WebPopupMenu; // For WebPopupMenu::create. | 109 friend class WebPopupMenu; // For WebPopupMenu::create. |
111 friend class WTF::RefCounted<WebPopupMenuImpl>; | 110 friend class WTF::RefCounted<WebPopupMenuImpl>; |
112 | 111 |
113 explicit WebPopupMenuImpl(WebWidgetClient*); | 112 explicit WebPopupMenuImpl(WebWidgetClient*); |
114 ~WebPopupMenuImpl(); | 113 ~WebPopupMenuImpl(); |
115 | 114 |
116 // HostWindow methods: | 115 // HostWindow methods: |
117 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE FINAL; | 116 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE FINAL; |
118 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE FINAL; | 117 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE FINAL; |
119 virtual void scheduleAnimation() OVERRIDE FINAL; | 118 virtual void scheduleAnimation() OVERRIDE FINAL; |
120 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE FINAL; | 119 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE FINAL; |
121 virtual WebScreenInfo screenInfo() const OVERRIDE FINAL; | 120 virtual WebScreenInfo screenInfo() const OVERRIDE FINAL; |
122 | 121 |
123 // FramelessScrollViewClient methods: | 122 // PopupContainerClient methods: |
124 virtual void popupClosed(FramelessScrollView*) OVERRIDE FINAL; | 123 virtual void popupClosed(PopupContainer*) OVERRIDE FINAL; |
125 | 124 |
126 WebWidgetClient* m_client; | 125 WebWidgetClient* m_client; |
127 WebSize m_size; | 126 WebSize m_size; |
128 | 127 |
129 WebLayerTreeView* m_layerTreeView; | 128 WebLayerTreeView* m_layerTreeView; |
130 OwnPtr<WebContentLayer> m_rootLayer; | 129 OwnPtr<WebContentLayer> m_rootLayer; |
131 | 130 |
132 WebPoint m_lastMousePosition; | 131 WebPoint m_lastMousePosition; |
133 | 132 |
134 // This is a non-owning ref. The popup will notify us via popupClosed() | 133 // This is a non-owning ref. The popup will notify us via popupClosed() |
135 // before it is destroyed. | 134 // before it is destroyed. |
136 FramelessScrollView* m_widget; | 135 PopupContainer* m_widget; |
137 }; | 136 }; |
138 | 137 |
139 DEFINE_TYPE_CASTS(WebPopupMenuImpl, WebWidget, widget, widget->isPopupMenu(), wi
dget.isPopupMenu()); | 138 DEFINE_TYPE_CASTS(WebPopupMenuImpl, WebWidget, widget, widget->isPopupMenu(), wi
dget.isPopupMenu()); |
140 // WebPopupMenuImpl is the only implementation of FramelessScrollViewClient, so | 139 // WebPopupMenuImpl is the only implementation of PopupContainerClient, so |
141 // no need for further checking. | 140 // no need for further checking. |
142 DEFINE_TYPE_CASTS(WebPopupMenuImpl, FramelessScrollViewClient, client, true, tru
e); | 141 DEFINE_TYPE_CASTS(WebPopupMenuImpl, PopupContainerClient, client, true, true); |
143 | 142 |
144 } // namespace blink | 143 } // namespace blink |
145 | 144 |
146 #endif | 145 #endif |
OLD | NEW |