OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (c) 2011, Google Inc. All rights reserved. | 3 * Copyright (c) 2011, Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #ifndef PopupContainer_h | 32 #ifndef PopupContainer_h |
33 #define PopupContainer_h | 33 #define PopupContainer_h |
34 | 34 |
35 #include "platform/PopupMenuStyle.h" | 35 #include "platform/PopupMenuStyle.h" |
36 #include "platform/geometry/FloatQuad.h" | 36 #include "platform/geometry/FloatQuad.h" |
| 37 #include "platform/heap/Handle.h" |
37 #include "web/PopupListBox.h" | 38 #include "web/PopupListBox.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 | 41 |
41 class ChromeClient; | 42 class ChromeClient; |
42 class FrameView; | 43 class FrameView; |
43 class PopupContainerClient; | 44 class PopupContainerClient; |
44 class PopupMenuClient; | 45 class PopupMenuClient; |
45 struct WebPopupMenuInfo; | 46 struct WebPopupMenuInfo; |
46 | 47 |
47 // This class wraps a PopupListBox. It positions the popup, paints the border | 48 // This class wraps a PopupListBox. It positions the popup, paints the border |
48 // around it, and forwards input events. | 49 // around it, and forwards input events. |
49 // FIXME(skobes): This class can probably be combined with PopupListBox. | 50 // FIXME(skobes): This class can probably be combined with PopupListBox. |
50 class PopupContainer FINAL : public Widget { | 51 class PopupContainer FINAL : public Widget { |
51 public: | 52 public: |
52 static PassRefPtr<PopupContainer> create(PopupMenuClient*, bool deviceSuppor
tsTouch); | 53 static PassRefPtrWillBeRawPtr<PopupContainer> create(PopupMenuClient*, bool
deviceSupportsTouch); |
53 | 54 |
54 // Whether a key event should be sent to this popup. | 55 // Whether a key event should be sent to this popup. |
55 bool isInterestedInEventForKey(int keyCode); | 56 bool isInterestedInEventForKey(int keyCode); |
56 | 57 |
57 // Widget | 58 // Widget |
58 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE; | 59 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE; |
59 virtual void hide() OVERRIDE; | 60 virtual void hide() OVERRIDE; |
60 virtual HostWindow* hostWindow() const OVERRIDE; | 61 virtual HostWindow* hostWindow() const OVERRIDE; |
61 virtual void invalidateRect(const IntRect&) OVERRIDE; | 62 virtual void invalidateRect(const IntRect&) OVERRIDE; |
62 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co
nst OVERRIDE; | 63 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint&) co
nst OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // While hovering popup menu window, we want to show tool tip message. | 118 // While hovering popup menu window, we want to show tool tip message. |
118 String getSelectedItemToolTip(); | 119 String getSelectedItemToolTip(); |
119 | 120 |
120 // This is public for testing. | 121 // This is public for testing. |
121 static IntRect layoutAndCalculateWidgetRectInternal(IntRect widgetRectInScre
en, int targetControlHeight, const FloatRect& windowRect, const FloatRect& scree
n, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize& tra
nsformOffset, PopupContent*, bool& needToResizeView); | 122 static IntRect layoutAndCalculateWidgetRectInternal(IntRect widgetRectInScre
en, int targetControlHeight, const FloatRect& windowRect, const FloatRect& scree
n, bool isRTL, const int rtlOffset, const int verticalOffset, const IntSize& tra
nsformOffset, PopupContent*, bool& needToResizeView); |
122 | 123 |
123 void disconnectClient() { m_listBox->disconnectClient(); } | 124 void disconnectClient() { m_listBox->disconnectClient(); } |
124 | 125 |
125 void updateFromElement() { m_listBox->updateFromElement(); } | 126 void updateFromElement() { m_listBox->updateFromElement(); } |
126 | 127 |
| 128 virtual void trace(Visitor*) OVERRIDE; |
| 129 |
127 private: | 130 private: |
128 friend class WTF::RefCounted<PopupContainer>; | 131 friend class WTF::RefCounted<PopupContainer>; |
129 | 132 |
130 PopupContainer(PopupMenuClient*, bool deviceSupportsTouch); | 133 PopupContainer(PopupMenuClient*, bool deviceSupportsTouch); |
131 virtual ~PopupContainer(); | 134 virtual ~PopupContainer(); |
132 | 135 |
133 // Paint the border. | 136 // Paint the border. |
134 void paintBorder(GraphicsContext*, const IntRect&); | 137 void paintBorder(GraphicsContext*, const IntRect&); |
135 | 138 |
136 // Layout and calculate popup widget size and location and returns it as Int
Rect. | 139 // Layout and calculate popup widget size and location and returns it as Int
Rect. |
137 IntRect layoutAndCalculateWidgetRect(int targetControlHeight, const IntSize&
transformOffset, const IntPoint& popupInitialCoordinate); | 140 IntRect layoutAndCalculateWidgetRect(int targetControlHeight, const IntSize&
transformOffset, const IntPoint& popupInitialCoordinate); |
138 | 141 |
139 void fitToListBox(); | 142 void fitToListBox(); |
140 | 143 |
141 void popupOpened(const IntRect& bounds); | 144 void popupOpened(const IntRect& bounds); |
142 void getPopupMenuInfo(WebPopupMenuInfo*); | 145 void getPopupMenuInfo(WebPopupMenuInfo*); |
143 | 146 |
144 // Returns the ChromeClient of the page this popup is associated with. | 147 // Returns the ChromeClient of the page this popup is associated with. |
145 ChromeClient& chromeClient(); | 148 ChromeClient& chromeClient(); |
146 | 149 |
147 RefPtr<PopupListBox> m_listBox; | 150 RefPtrWillBeMember<PopupListBox> m_listBox; |
148 RefPtr<FrameView> m_frameView; | 151 RefPtrWillBeMember<FrameView> m_frameView; |
149 | 152 |
150 // m_controlPosition contains the transformed position of the | 153 // m_controlPosition contains the transformed position of the |
151 // <select>/<input> associated with this popup. m_controlSize is the size | 154 // <select>/<input> associated with this popup. m_controlSize is the size |
152 // of the <select>/<input> without transform. | 155 // of the <select>/<input> without transform. |
153 // The popup menu will be positioned as follows: | 156 // The popup menu will be positioned as follows: |
154 // LTR : If the popup is positioned down it will align with the bottom left | 157 // LTR : If the popup is positioned down it will align with the bottom left |
155 // of m_controlPosition (p4) | 158 // of m_controlPosition (p4) |
156 // If the popup is positioned up it will align with the top left of | 159 // If the popup is positioned up it will align with the top left of |
157 // m_controlPosition (p1) | 160 // m_controlPosition (p1) |
158 // RTL : If the popup is positioned down it will align with the bottom right | 161 // RTL : If the popup is positioned down it will align with the bottom right |
159 // of m_controlPosition (p3) | 162 // of m_controlPosition (p3) |
160 // If the popup is positioned up it will align with the top right of | 163 // If the popup is positioned up it will align with the top right of |
161 // m_controlPosition (p2) | 164 // m_controlPosition (p2) |
162 FloatQuad m_controlPosition; | 165 FloatQuad m_controlPosition; |
163 IntSize m_controlSize; | 166 IntSize m_controlSize; |
164 | 167 |
165 // Whether the popup is currently open. | 168 // Whether the popup is currently open. |
166 bool m_popupOpen; | 169 bool m_popupOpen; |
167 | 170 |
168 PopupContainerClient* m_client; | 171 PopupContainerClient* m_client; |
169 }; | 172 }; |
170 | 173 |
171 } // namespace blink | 174 } // namespace blink |
172 | 175 |
173 #endif | 176 #endif |
OLD | NEW |