| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 HitTestResult result(type, location); | 165 HitTestResult result(type, location); |
| 166 | 166 |
| 167 if (frame) | 167 if (frame) |
| 168 result = frame->eventHandler().hitTestResultAtPoint(location, type); | 168 result = frame->eventHandler().hitTestResultAtPoint(location, type); |
| 169 | 169 |
| 170 if (!result.innerNodeOrImageMapImage()) | 170 if (!result.innerNodeOrImageMapImage()) |
| 171 return nullptr; | 171 return nullptr; |
| 172 | 172 |
| 173 m_hitTestResult = result; | 173 m_hitTestResult = result; |
| 174 | 174 |
| 175 return wrapUnique(new ContextMenu); | 175 return WTF::wrapUnique(new ContextMenu); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void ContextMenuController::showContextMenu(Event* event) { | 178 void ContextMenuController::showContextMenu(Event* event) { |
| 179 bool fromTouch = false; | 179 bool fromTouch = false; |
| 180 if (event && event->isMouseEvent()) { | 180 if (event && event->isMouseEvent()) { |
| 181 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); | 181 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); |
| 182 fromTouch = mouseEvent->fromTouch(); | 182 fromTouch = mouseEvent->fromTouch(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 if (m_client->showContextMenu(m_contextMenu.get(), fromTouch) && event) | 185 if (m_client->showContextMenu(m_contextMenu.get(), fromTouch) && event) |
| 186 event->setDefaultHandled(); | 186 event->setDefaultHandled(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void ContextMenuController::contextMenuItemSelected( | 189 void ContextMenuController::contextMenuItemSelected( |
| 190 const ContextMenuItem* item) { | 190 const ContextMenuItem* item) { |
| 191 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); | 191 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); |
| 192 | 192 |
| 193 if (item->action() < ContextMenuItemBaseCustomTag || | 193 if (item->action() < ContextMenuItemBaseCustomTag || |
| 194 item->action() > ContextMenuItemLastCustomTag) | 194 item->action() > ContextMenuItemLastCustomTag) |
| 195 return; | 195 return; |
| 196 | 196 |
| 197 ASSERT(m_menuProvider); | 197 ASSERT(m_menuProvider); |
| 198 m_menuProvider->contextMenuItemSelected(item); | 198 m_menuProvider->contextMenuItemSelected(item); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace blink | 201 } // namespace blink |
| OLD | NEW |