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

Unified Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 603643002: DevTools: properly inject elements panel context menu items. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comment addressed. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/ElementsTreeOutline.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/ElementsPanel.js
diff --git a/Source/devtools/front_end/elements/ElementsPanel.js b/Source/devtools/front_end/elements/ElementsPanel.js
index 80db94ddc8b0efd12ed5f3d22869381324b95bb5..a39441a8416d3167e2331961265592903b210151 100644
--- a/Source/devtools/front_end/elements/ElementsPanel.js
+++ b/Source/devtools/front_end/elements/ElementsPanel.js
@@ -57,7 +57,6 @@ WebInspector.ElementsPanel = function()
this.contentElement.classList.add("nowrap");
WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSettingChanged.bind(this));
- this.contentElement.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
this._splitView.sidebarElement().addEventListener("contextmenu", this._sidebarContextMenuEventFired.bind(this), false);
var crumbsContainer = stackElement.createChild("div");
@@ -130,7 +129,7 @@ WebInspector.ElementsPanel.prototype = {
*/
targetAdded: function(target)
{
- var treeOutline = new WebInspector.ElementsTreeOutline(target, true, true, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this));
+ var treeOutline = new WebInspector.ElementsTreeOutline(target, true, true, this._setPseudoClassForNode.bind(this));
treeOutline.wireToDOMModel();
treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this);
treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.NodePicked, this._onNodePicked, this);
@@ -451,16 +450,6 @@ WebInspector.ElementsPanel.prototype = {
}
},
- _contextMenuEventFired: function(event)
- {
- if (this.sidebarPanes.styles.isEditingSelector())
- return;
- var contextMenu = new WebInspector.ContextMenu(event);
- for (var i = 0; i < this._treeOutlines.length; ++i)
- this._treeOutlines[i].populateContextMenu(contextMenu, event);
- contextMenu.show();
- },
-
_domWordWrapSettingChanged: function(event)
{
if (event.data)
@@ -485,14 +474,6 @@ WebInspector.ElementsPanel.prototype = {
this.selectDOMNode(node, true);
},
- _populateContextMenu: function(contextMenu, node)
- {
- // Add debbuging-related actions
- contextMenu.appendSeparator();
- var pane = WebInspector.domBreakpointsSidebarPane;
- pane.populateNodeContextMenu(node, contextMenu);
- },
-
/**
* @param {!Element} element
* @param {!Event} event
@@ -1292,10 +1273,18 @@ WebInspector.ElementsPanel.prototype = {
&& !(object instanceof WebInspector.DeferredDOMNode)) {
return;
}
+
+ // Add debbuging-related actions
+ if (object instanceof WebInspector.DOMNode) {
+ contextMenu.appendSeparator();
+ WebInspector.domBreakpointsSidebarPane.populateNodeContextMenu(object, contextMenu);
+ }
+
// Skip adding "Reveal..." menu item for our own tree outline.
if (this.element.isAncestor(/** @type {!Node} */ (event.target)))
return;
var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Revealer, object);
+
contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal in Elements panel" : "Reveal in Elements Panel", commandCallback);
},
« no previous file with comments | « no previous file | Source/devtools/front_end/elements/ElementsTreeOutline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698