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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 m_webExternalPopupMenu = 0; | 79 m_webExternalPopupMenu = 0; |
80 } | 80 } |
81 | 81 |
82 WebPopupMenuInfo info; | 82 WebPopupMenuInfo info; |
83 getPopupMenuInfo(info, *m_popupMenuClient); | 83 getPopupMenuInfo(info, *m_popupMenuClient); |
84 if (info.items.isEmpty()) | 84 if (info.items.isEmpty()) |
85 return; | 85 return; |
86 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(m_localFrame.get(
)); | 86 WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(m_localFrame.get(
)); |
87 m_webExternalPopupMenu = webframe->client()->createExternalPopupMenu(info, t
his); | 87 m_webExternalPopupMenu = webframe->client()->createExternalPopupMenu(info, t
his); |
88 if (m_webExternalPopupMenu) { | 88 if (m_webExternalPopupMenu) { |
89 // FIXME: Standardize viewport coordinate conversions. crbug.com/371902. | 89 IntRect rectInViewport = m_localFrame->view()->soonToBeRemovedContentsTo
UnscaledViewport(rect); |
90 IntRect rectInViewport = m_localFrame->view()->contentsToWindow(rect); | |
91 if (m_webView.pinchVirtualViewportEnabled()) | |
92 rectInViewport.moveBy(-flooredIntPoint(m_webView.page()->frameHost()
.pinchViewport().location())); | |
93 m_webExternalPopupMenu->show(rectInViewport); | 90 m_webExternalPopupMenu->show(rectInViewport); |
94 #if OS(MACOSX) | 91 #if OS(MACOSX) |
95 const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); | 92 const WebInputEvent* currentEvent = WebViewImpl::currentInputEvent(); |
96 if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { | 93 if (currentEvent && currentEvent->type == WebInputEvent::MouseDown) { |
97 m_syntheticEvent = adoptPtr(new WebMouseEvent); | 94 m_syntheticEvent = adoptPtr(new WebMouseEvent); |
98 *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent)
; | 95 *m_syntheticEvent = *static_cast<const WebMouseEvent*>(currentEvent)
; |
99 m_syntheticEvent->type = WebInputEvent::MouseUp; | 96 m_syntheticEvent->type = WebInputEvent::MouseUp; |
100 m_dispatchEventTimer.startOneShot(0, FROM_HERE); | 97 m_dispatchEventTimer.startOneShot(0, FROM_HERE); |
101 // FIXME: show() is asynchronous. If preparing a popup is slow and | 98 // FIXME: show() is asynchronous. If preparing a popup is slow and |
102 // a user released the mouse button before showing the popup, | 99 // a user released the mouse button before showing the popup, |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 if (popupMenuClient.itemStyle(i).isDisplayNone()) | 251 if (popupMenuClient.itemStyle(i).isDisplayNone()) |
255 continue; | 252 continue; |
256 if (popupMenuItemIndex == i) | 253 if (popupMenuItemIndex == i) |
257 return indexTracker; | 254 return indexTracker; |
258 ++indexTracker; | 255 ++indexTracker; |
259 } | 256 } |
260 return -1; | 257 return -1; |
261 } | 258 } |
262 | 259 |
263 } // namespace blink | 260 } // namespace blink |
OLD | NEW |