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

Side by Side Diff: Source/core/html/CustomContextMenuProvider.cpp

Issue 243403006: Implement contextmenu attribute with basic support of <menu> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added RuntimeEnabledFeature flag Created 6 years, 6 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6
7 #include "core/html/CustomContextMenuProvider.h"
8
9 #include "core/events/EventDispatcher.h"
10 #include "core/events/MouseEvent.h"
11 #include "core/html/HTMLMenuElement.h"
12 #include "platform/ContextMenu.h"
13
14 namespace WebCore {
15
16 void CustomContextMenuProvider::populateContextMenu(ContextMenu* menu)
17 {
18 for (size_t i = 0; i < m_items.size(); ++i)
19 menu->appendItem(m_items[i]);
20 }
21
22 void CustomContextMenuProvider::contextMenuItemSelected(const ContextMenuItem* i tem)
23 {
24 if (!m_menu)
25 return;
26
27 if (HTMLElement* element = m_menu->menuItemAt(item->action())) {
28 RefPtrWillBeRawPtr<SimulatedMouseEvent> click = SimulatedMouseEvent::cre ate(EventTypeNames::click, m_menu->document().domWindow(), Event::create());
29 click->setRelatedTarget(m_menu->subjectElement());
30 EventDispatcher::dispatchEvent(element, EventDispatchMediator::create(cl ick.release()));
31 }
32 }
33
34 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698