OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 #include "platform/geometry/FloatQuad.h" | 43 #include "platform/geometry/FloatQuad.h" |
44 #include "platform/geometry/IntPoint.h" | 44 #include "platform/geometry/IntPoint.h" |
45 #include "platform/text/TextDirection.h" | 45 #include "platform/text/TextDirection.h" |
46 #include "public/platform/WebVector.h" | 46 #include "public/platform/WebVector.h" |
47 #include "public/web/WebExternalPopupMenu.h" | 47 #include "public/web/WebExternalPopupMenu.h" |
48 #include "public/web/WebFrameClient.h" | 48 #include "public/web/WebFrameClient.h" |
49 #include "public/web/WebMenuItemInfo.h" | 49 #include "public/web/WebMenuItemInfo.h" |
50 #include "public/web/WebPopupMenuInfo.h" | 50 #include "public/web/WebPopupMenuInfo.h" |
51 #include "web/WebLocalFrameImpl.h" | 51 #include "web/WebLocalFrameImpl.h" |
52 #include "web/WebViewImpl.h" | 52 #include "web/WebViewImpl.h" |
| 53 #include "wtf/PtrUtil.h" |
53 | 54 |
54 namespace blink { | 55 namespace blink { |
55 | 56 |
56 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, HTMLSelectElement& owner
Element, WebViewImpl& webView) | 57 ExternalPopupMenu::ExternalPopupMenu(LocalFrame& frame, HTMLSelectElement& owner
Element, WebViewImpl& webView) |
57 : m_ownerElement(ownerElement) | 58 : m_ownerElement(ownerElement) |
58 , m_localFrame(frame) | 59 , m_localFrame(frame) |
59 , m_webView(webView) | 60 , m_webView(webView) |
60 , m_dispatchEventTimer(this, &ExternalPopupMenu::dispatchEvent) | 61 , m_dispatchEventTimer(this, &ExternalPopupMenu::dispatchEvent) |
61 , m_webExternalPopupMenu(0) | 62 , m_webExternalPopupMenu(0) |
62 { | 63 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 105 } |
105 } | 106 } |
106 | 107 |
107 void ExternalPopupMenu::show() | 108 void ExternalPopupMenu::show() |
108 { | 109 { |
109 if (!showInternal()) | 110 if (!showInternal()) |
110 return; | 111 return; |
111 #if OS(MACOSX) | 112 #if OS(MACOSX) |
112 const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); | 113 const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); |
113 if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { | 114 if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { |
114 m_syntheticEvent = adoptPtr(new WebMouseEvent); | 115 m_syntheticEvent = wrapUnique(new WebMouseEvent); |
115 *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent); | 116 *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent); |
116 m_syntheticEvent->type = WebInputEvent::MouseUp; | 117 m_syntheticEvent->type = WebInputEvent::MouseUp; |
117 m_dispatchEventTimer.startOneShot(0, BLINK_FROM_HERE); | 118 m_dispatchEventTimer.startOneShot(0, BLINK_FROM_HERE); |
118 // FIXME: show() is asynchronous. If preparing a popup is slow and a | 119 // FIXME: show() is asynchronous. If preparing a popup is slow and a |
119 // user released the mouse button before showing the popup, mouseup and | 120 // user released the mouse button before showing the popup, mouseup and |
120 // click events are correctly dispatched. Dispatching the synthetic | 121 // click events are correctly dispatched. Dispatching the synthetic |
121 // mouseup event is redundant in this case. | 122 // mouseup event is redundant in this case. |
122 } | 123 } |
123 #endif | 124 #endif |
124 } | 125 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 if (ownerElement.itemIsDisplayNone(*items[i])) | 294 if (ownerElement.itemIsDisplayNone(*items[i])) |
294 continue; | 295 continue; |
295 if (popupMenuItemIndex == i) | 296 if (popupMenuItemIndex == i) |
296 return indexTracker; | 297 return indexTracker; |
297 ++indexTracker; | 298 ++indexTracker; |
298 } | 299 } |
299 return -1; | 300 return -1; |
300 } | 301 } |
301 | 302 |
302 } // namespace blink | 303 } // namespace blink |
OLD | NEW |