OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 151 |
152 if (!event->isMouseEvent()) | 152 if (!event->isMouseEvent()) |
153 return nullptr; | 153 return nullptr; |
154 | 154 |
155 MouseEvent* mouseEvent = toMouseEvent(event); | 155 MouseEvent* mouseEvent = toMouseEvent(event); |
156 return createContextMenu(event->target()->toNode()->document().frame(), mous
eEvent->absoluteLocation()); | 156 return createContextMenu(event->target()->toNode()->document().frame(), mous
eEvent->absoluteLocation()); |
157 } | 157 } |
158 | 158 |
159 PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* fra
me, const LayoutPoint& location) | 159 PassOwnPtr<ContextMenu> ContextMenuController::createContextMenu(LocalFrame* fra
me, const LayoutPoint& location) |
160 { | 160 { |
161 HitTestResult result(location); | 161 HitTestRequest::HitTestRequestType type = HitTestRequest::ReadOnly | HitTest
Request::Active; |
| 162 HitTestResult result(type, location); |
162 | 163 |
163 if (frame) | 164 if (frame) |
164 result = frame->eventHandler().hitTestResultAtPoint(location, HitTestReq
uest::ReadOnly | HitTestRequest::Active); | 165 result = frame->eventHandler().hitTestResultAtPoint(location, type); |
165 | 166 |
166 if (!result.innerNonSharedNode()) | 167 if (!result.innerNonSharedNode()) |
167 return nullptr; | 168 return nullptr; |
168 | 169 |
169 m_hitTestResult = result; | 170 m_hitTestResult = result; |
170 | 171 |
171 return adoptPtr(new ContextMenu); | 172 return adoptPtr(new ContextMenu); |
172 } | 173 } |
173 | 174 |
174 void ContextMenuController::showContextMenu(Event* event) | 175 void ContextMenuController::showContextMenu(Event* event) |
175 { | 176 { |
176 m_client->showContextMenu(m_contextMenu.get()); | 177 m_client->showContextMenu(m_contextMenu.get()); |
177 if (event) | 178 if (event) |
178 event->setDefaultHandled(); | 179 event->setDefaultHandled(); |
179 } | 180 } |
180 | 181 |
181 void ContextMenuController::contextMenuItemSelected(const ContextMenuItem* item) | 182 void ContextMenuController::contextMenuItemSelected(const ContextMenuItem* item) |
182 { | 183 { |
183 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); | 184 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); |
184 | 185 |
185 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex
tMenuItemLastCustomTag) | 186 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex
tMenuItemLastCustomTag) |
186 return; | 187 return; |
187 | 188 |
188 ASSERT(m_menuProvider); | 189 ASSERT(m_menuProvider); |
189 m_menuProvider->contextMenuItemSelected(item); | 190 m_menuProvider->contextMenuItemSelected(item); |
190 } | 191 } |
191 | 192 |
192 } // namespace blink | 193 } // namespace blink |
OLD | NEW |