| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011, Google Inc. All rights reserved. | 2 * Copyright (c) 2011, 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class FrameView; | 42 class FrameView; |
| 43 class PopupMenuClient; | 43 class PopupMenuClient; |
| 44 | 44 |
| 45 class PopupContainer : public FramelessScrollView { | 45 class PopupContainer : public FramelessScrollView { |
| 46 public: | 46 public: |
| 47 enum PopupType { | 47 enum PopupType { |
| 48 Select, // HTML select popup. | 48 Select, // HTML select popup. |
| 49 Suggestion, // Autocomplete/autofill popup. | 49 Suggestion, // Autocomplete/autofill popup. |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 static PassRefPtr<PopupContainer> create(PopupMenuClient*, PopupType, | 52 static PassRefPtr<PopupContainer> create(PopupMenuClient*, PopupType, const
PopupContainerSettings&); |
| 53 const PopupContainerSettings&); | |
| 54 | 53 |
| 55 // Whether a key event should be sent to this popup. | 54 // Whether a key event should be sent to this popup. |
| 56 virtual bool isInterestedInEventForKey(int keyCode); | 55 bool isInterestedInEventForKey(int keyCode); |
| 57 | 56 |
| 58 // FramelessScrollView | 57 // FramelessScrollView |
| 59 virtual void paint(GraphicsContext*, const IntRect&); | 58 virtual void paint(GraphicsContext*, const IntRect&) OVERRIDE; |
| 60 virtual void hide(); | 59 virtual void hide() OVERRIDE; |
| 61 virtual bool handleMouseDownEvent(const PlatformMouseEvent&); | 60 virtual bool handleMouseDownEvent(const PlatformMouseEvent&) OVERRIDE; |
| 62 virtual bool handleMouseMoveEvent(const PlatformMouseEvent&); | 61 virtual bool handleMouseMoveEvent(const PlatformMouseEvent&) OVERRIDE; |
| 63 virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&); | 62 virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&) OVERRIDE; |
| 64 virtual bool handleWheelEvent(const PlatformWheelEvent&); | 63 virtual bool handleWheelEvent(const PlatformWheelEvent&) OVERRIDE; |
| 65 virtual bool handleKeyEvent(const PlatformKeyboardEvent&); | 64 virtual bool handleKeyEvent(const PlatformKeyboardEvent&) OVERRIDE; |
| 66 virtual bool handleTouchEvent(const PlatformTouchEvent&); | 65 virtual bool handleTouchEvent(const PlatformTouchEvent&) OVERRIDE; |
| 67 virtual bool handleGestureEvent(const PlatformGestureEvent&); | 66 virtual bool handleGestureEvent(const PlatformGestureEvent&) OVERRIDE; |
| 68 | 67 |
| 69 // PopupContainer methods | 68 // PopupContainer methods |
| 70 | 69 |
| 71 // Show the popup | 70 // Show the popup |
| 72 void showPopup(FrameView*); | 71 void showPopup(FrameView*); |
| 73 | 72 |
| 74 // Show the popup in the specified rect for the specified frame. | 73 // Show the popup in the specified rect for the specified frame. |
| 75 // Note: this code was somehow arbitrarily factored-out of the Popup class | 74 // Note: this code was somehow arbitrarily factored-out of the Popup class |
| 76 // so WebViewImpl can create a PopupContainer. This method is used for | 75 // so WebViewImpl can create a PopupContainer. This method is used for |
| 77 // displaying auto complete popup menus on Mac Chromium, and for all | 76 // displaying auto complete popup menus on Mac Chromium, and for all |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 130 |
| 132 // Returns the ChromeClient of the page this popup is associated with. | 131 // Returns the ChromeClient of the page this popup is associated with. |
| 133 ChromeClient* chromeClient(); | 132 ChromeClient* chromeClient(); |
| 134 | 133 |
| 135 RefPtr<PopupListBox> m_listBox; | 134 RefPtr<PopupListBox> m_listBox; |
| 136 RefPtr<FrameView> m_frameView; | 135 RefPtr<FrameView> m_frameView; |
| 137 | 136 |
| 138 PopupContainerSettings m_settings; | 137 PopupContainerSettings m_settings; |
| 139 PopupType m_popupType; | 138 PopupType m_popupType; |
| 140 | 139 |
| 141 // m_controlPosition contains the transformed position of the <select>/<inpu
t> associated with this popup. | 140 // m_controlPosition contains the transformed position of the |
| 142 // m_controlSize is the size of the <select>/<input> without transform. | 141 // <select>/<input> associated with this popup. m_controlSize is the size |
| 142 // of the <select>/<input> without transform. |
| 143 // The popup menu will be positioned as follows: | 143 // The popup menu will be positioned as follows: |
| 144 // LTR : If the popup is positioned down it will align with the bottom left
of m_controlPosition (p4) | 144 // LTR : If the popup is positioned down it will align with the bottom left |
| 145 // If the popup is positioned up it will align with the top left of m_
controlPosition (p1) | 145 // of m_controlPosition (p4) |
| 146 // RTL : If the popup is positioned down it will align with the bottom right
of m_controlPosition (p3) | 146 // If the popup is positioned up it will align with the top left of |
| 147 // If the popup is positioned up it will align with the top right of m
_controlPosition (p2) | 147 // m_controlPosition (p1) |
| 148 // RTL : If the popup is positioned down it will align with the bottom right |
| 149 // of m_controlPosition (p3) |
| 150 // If the popup is positioned up it will align with the top right of |
| 151 // m_controlPosition (p2) |
| 148 FloatQuad m_controlPosition; | 152 FloatQuad m_controlPosition; |
| 149 IntSize m_controlSize; | 153 IntSize m_controlSize; |
| 150 | 154 |
| 151 // Whether the popup is currently open. | 155 // Whether the popup is currently open. |
| 152 bool m_popupOpen; | 156 bool m_popupOpen; |
| 153 }; | 157 }; |
| 154 | 158 |
| 155 } // namespace WebCore | 159 } // namespace WebCore |
| 156 | 160 |
| 157 #endif | 161 #endif |
| OLD | NEW |