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

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

Issue 721603002: If an element A has a parent element, then A's assigned context menu is the assigned context menu o… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed nits Created 6 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void ContextMenuController::populateCustomContextMenu(const Event& event) 88 void ContextMenuController::populateCustomContextMenu(const Event& event)
89 { 89 {
90 if (!RuntimeEnabledFeatures::contextMenuEnabled()) 90 if (!RuntimeEnabledFeatures::contextMenuEnabled())
91 return; 91 return;
92 92
93 Node* node = event.target()->toNode(); 93 Node* node = event.target()->toNode();
94 if (!node || !node->isHTMLElement()) 94 if (!node || !node->isHTMLElement())
95 return; 95 return;
96 96
97 HTMLElement& element = toHTMLElement(*node); 97 HTMLElement& element = toHTMLElement(*node);
98 RefPtrWillBeRawPtr<HTMLMenuElement> menuElement = element.contextMenu(); 98 RefPtrWillBeRawPtr<HTMLMenuElement> menuElement = element.assignedContextMen u();
99 if (!menuElement || !equalIgnoringCase(menuElement->fastGetAttribute(typeAtt r), "popup")) 99 if (!menuElement || !equalIgnoringCase(menuElement->fastGetAttribute(typeAtt r), "popup"))
100 return; 100 return;
101 RefPtrWillBeRawPtr<RelatedEvent> relatedEvent = RelatedEvent::create(EventTy peNames::show, true, true, node); 101 RefPtrWillBeRawPtr<RelatedEvent> relatedEvent = RelatedEvent::create(EventTy peNames::show, true, true, node);
102 if (!menuElement->dispatchEvent(relatedEvent.release())) 102 if (!menuElement->dispatchEvent(relatedEvent.release()))
103 return; 103 return;
104 if (menuElement != element.contextMenu()) 104 if (menuElement != element.assignedContextMenu())
105 return; 105 return;
106 m_menuProvider = CustomContextMenuProvider::create(*menuElement, element); 106 m_menuProvider = CustomContextMenuProvider::create(*menuElement, element);
107 m_menuProvider->populateContextMenu(m_contextMenu.get()); 107 m_menuProvider->populateContextMenu(m_contextMenu.get());
108 } 108 }
109 109
110 void ContextMenuController::handleContextMenuEvent(Event* event) 110 void ContextMenuController::handleContextMenuEvent(Event* event)
111 { 111 {
112 m_contextMenu = createContextMenu(event); 112 m_contextMenu = createContextMenu(event);
113 if (!m_contextMenu) 113 if (!m_contextMenu)
114 return; 114 return;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 ASSERT(item->type() == ActionType || item->type() == CheckableActionType); 183 ASSERT(item->type() == ActionType || item->type() == CheckableActionType);
184 184
185 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex tMenuItemLastCustomTag) 185 if (item->action() < ContextMenuItemBaseCustomTag || item->action() > Contex tMenuItemLastCustomTag)
186 return; 186 return;
187 187
188 ASSERT(m_menuProvider); 188 ASSERT(m_menuProvider);
189 m_menuProvider->contextMenuItemSelected(item); 189 m_menuProvider->contextMenuItemSelected(item);
190 } 190 }
191 191
192 } // namespace blink 192 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698