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