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