Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: Source/web/WebPopupMenuImpl.h

Issue 736883002: Implement <select> Popup Menu using PagePopup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009 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 are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29 */
30
31 #ifndef WebPopupMenuImpl_h
32 #define WebPopupMenuImpl_h
33
34 #include "public/platform/WebContentLayerClient.h"
35 #include "public/platform/WebPoint.h"
36 #include "public/platform/WebSize.h"
37 #include "public/web/WebPopupMenu.h"
38 #include "web/PopupContainerClient.h"
39 #include "wtf/OwnPtr.h"
40 #include "wtf/RefCounted.h"
41
42 namespace blink {
43 class WebContentLayer;
44 class WebGestureEvent;
45 class WebKeyboardEvent;
46 class WebLayerTreeView;
47 class WebMouseEvent;
48 class WebMouseWheelEvent;
49 class WebTouchEvent;
50 struct WebRect;
51
52 class WebPopupMenuImpl : public WebPopupMenu, public PopupContainerClient, publi c WebContentLayerClient, public RefCounted<WebPopupMenuImpl> {
53 WTF_MAKE_FAST_ALLOCATED;
54 public:
55 // WebWidget functions:
56 virtual void close() override final;
57 virtual WebSize size() override final { return m_size; }
58 virtual void willStartLiveResize() override final;
59 virtual void resize(const WebSize&) override final;
60 virtual void willEndLiveResize() override final;
61 virtual void beginFrame(const WebBeginFrameArgs&) override final;
62 virtual void layout() override final;
63 virtual void paint(WebCanvas*, const WebRect&) override final;
64 virtual void themeChanged() override final;
65 virtual bool handleInputEvent(const WebInputEvent&) override final;
66 virtual void mouseCaptureLost() override final;
67 virtual void setFocus(bool enable) override final;
68 virtual bool setComposition(
69 const WebString& text,
70 const WebVector<WebCompositionUnderline>& underlines,
71 int selectionStart, int selectionEnd) override final;
72 virtual bool confirmComposition() override final;
73 virtual bool confirmComposition(ConfirmCompositionBehavior selectionBehavior ) override final;
74 virtual bool confirmComposition(const WebString& text) override final;
75 virtual bool compositionRange(size_t* location, size_t* length) override fin al;
76 virtual bool caretOrSelectionRange(size_t* location, size_t* length) overrid e final;
77 virtual void setTextDirection(WebTextDirection) override final;
78 virtual bool isAcceleratedCompositingActive() const override final { return false; }
79 virtual bool isPopupMenu() const override final { return true; }
80 virtual void willCloseLayerTreeView() override final;
81
82 // WebContentLayerClient
83 virtual void paintContents(WebCanvas*, const WebRect& clip, bool canPaintLCD Test, WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) ove rride final;
84 virtual void paintContents(WebDisplayItemList*, const WebRect& clip, bool ca nPaintLCDTest, WebContentLayerClient::GraphicsContextStatus = GraphicsContextEna bled) override final { }
85
86 // WebPopupMenuImpl
87 void initialize(PopupContainer* widget, const WebRect& bounds);
88
89 WebWidgetClient* client() { return m_client; }
90
91 void handleMouseMove(const WebMouseEvent&);
92 void handleMouseLeave(const WebMouseEvent&);
93 void handleMouseDown(const WebMouseEvent&);
94 void handleMouseUp(const WebMouseEvent&);
95 void handleMouseDoubleClick(const WebMouseEvent&);
96 void handleMouseWheel(const WebMouseWheelEvent&);
97 bool handleGestureEvent(const WebGestureEvent&);
98 bool handleTouchEvent(const WebTouchEvent&);
99 bool handleKeyEvent(const WebKeyboardEvent&);
100
101 protected:
102 friend class WebPopupMenu; // For WebPopupMenu::create.
103 friend class WTF::RefCounted<WebPopupMenuImpl>;
104
105 explicit WebPopupMenuImpl(WebWidgetClient*);
106 ~WebPopupMenuImpl();
107
108 // HostWindow methods:
109 virtual void invalidateContentsAndRootView(const IntRect&) override final;
110 virtual void invalidateContentsForSlowScroll(const IntRect&) override final;
111 virtual void scheduleAnimation() override final;
112 virtual IntRect rootViewToScreen(const IntRect&) const override final;
113 virtual WebScreenInfo screenInfo() const override final;
114
115 // PopupContainerClient methods:
116 virtual void popupClosed(PopupContainer*) override final;
117
118 WebWidgetClient* m_client;
119 WebSize m_size;
120
121 WebLayerTreeView* m_layerTreeView;
122 OwnPtr<WebContentLayer> m_rootLayer;
123
124 WebPoint m_lastMousePosition;
125
126 // This is a non-owning ref. The popup will notify us via popupClosed()
127 // before it is destroyed.
128 PopupContainer* m_widget;
129 };
130
131 DEFINE_TYPE_CASTS(WebPopupMenuImpl, WebWidget, widget, widget->isPopupMenu(), wi dget.isPopupMenu());
132 // WebPopupMenuImpl is the only implementation of PopupContainerClient, so
133 // no need for further checking.
134 DEFINE_TYPE_CASTS(WebPopupMenuImpl, PopupContainerClient, client, true, true);
135
136 } // namespace blink
137
138 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698