Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: third_party/WebKit/Source/core/page/ContextMenuController.cpp

Issue 2785853002: Selection Action mode triggered like a context menu (Closed)
Patch Set: fix tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 if (!result.InnerNodeOrImageMapImage()) 156 if (!result.InnerNodeOrImageMapImage())
157 return nullptr; 157 return nullptr;
158 158
159 hit_test_result_ = result; 159 hit_test_result_ = result;
160 160
161 return WTF::WrapUnique(new ContextMenu); 161 return WTF::WrapUnique(new ContextMenu);
162 } 162 }
163 163
164 void ContextMenuController::ShowContextMenu(Event* event) { 164 void ContextMenuController::ShowContextMenu(Event* event) {
165 bool from_touch = false; 165 MouseEvent::SyntheticEventType synthetic_event_type =
166 MouseEvent::kRealOrIndistinguishable;
166 if (event && event->IsMouseEvent()) { 167 if (event && event->IsMouseEvent()) {
167 MouseEvent* mouse_event = static_cast<MouseEvent*>(event); 168 MouseEvent* mouse_event = static_cast<MouseEvent*>(event);
168 from_touch = mouse_event->FromTouch(); 169 synthetic_event_type = mouse_event->GetSyntheticEventType();
169 } 170 }
170 171
171 if (client_->ShowContextMenu(context_menu_.get(), from_touch) && event) 172 if (client_->ShowContextMenu(context_menu_.get(), synthetic_event_type) &&
173 event)
172 event->SetDefaultHandled(); 174 event->SetDefaultHandled();
173 } 175 }
174 176
175 void ContextMenuController::ContextMenuItemSelected( 177 void ContextMenuController::ContextMenuItemSelected(
176 const ContextMenuItem* item) { 178 const ContextMenuItem* item) {
177 DCHECK(item->GetType() == kActionType || 179 DCHECK(item->GetType() == kActionType ||
178 item->GetType() == kCheckableActionType); 180 item->GetType() == kCheckableActionType);
179 181
180 if (item->Action() < kContextMenuItemBaseCustomTag || 182 if (item->Action() < kContextMenuItemBaseCustomTag ||
181 item->Action() > kContextMenuItemLastCustomTag) 183 item->Action() > kContextMenuItemLastCustomTag)
182 return; 184 return;
183 185
184 DCHECK(menu_provider_); 186 DCHECK(menu_provider_);
185 menu_provider_->ContextMenuItemSelected(item); 187 menu_provider_->ContextMenuItemSelected(item);
186 } 188 }
187 189
188 } // namespace blink 190 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698