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

Unified Diff: Source/devtools/front_end/elements/ElementsTreeOutline.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 | « Source/devtools/front_end/elements/ElementsPanel.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/elements/ElementsTreeOutline.js
diff --git a/Source/devtools/front_end/elements/ElementsTreeOutline.js b/Source/devtools/front_end/elements/ElementsTreeOutline.js
index 5e2cd24ba703d5f6b2e15722e8ce3b8abeb69cf3..0a4be13134291204b92d106da50177524b65cc87 100644
--- a/Source/devtools/front_end/elements/ElementsTreeOutline.js
+++ b/Source/devtools/front_end/elements/ElementsTreeOutline.js
@@ -34,10 +34,9 @@
* @param {!WebInspector.Target} target
* @param {boolean=} omitRootDOMNode
* @param {boolean=} selectEnabled
- * @param {function(!WebInspector.ContextMenu, !WebInspector.DOMNode)=} contextMenuCallback
* @param {function(!WebInspector.DOMNode, string, boolean)=} setPseudoClassCallback
*/
-WebInspector.ElementsTreeOutline = function(target, omitRootDOMNode, selectEnabled, contextMenuCallback, setPseudoClassCallback)
+WebInspector.ElementsTreeOutline = function(target, omitRootDOMNode, selectEnabled, setPseudoClassCallback)
{
this._target = target;
this._domModel = target.domModel;
@@ -53,6 +52,7 @@ WebInspector.ElementsTreeOutline = function(target, omitRootDOMNode, selectEnabl
this.element.addEventListener("dragend", this._ondragend.bind(this), false);
this.element.addEventListener("keydown", this._onkeydown.bind(this), false);
this.element.addEventListener("webkitAnimationEnd", this._onAnimationEnd.bind(this), false);
+ this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), false);
TreeOutline.call(this, this.element);
@@ -67,8 +67,6 @@ WebInspector.ElementsTreeOutline = function(target, omitRootDOMNode, selectEnabl
this._visible = false;
this._pickNodeMode = false;
- this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
- this._contextMenuCallback = contextMenuCallback;
this._setPseudoClassCallback = setPseudoClassCallback;
this._createNodeDecorators();
}
@@ -771,19 +769,10 @@ WebInspector.ElementsTreeOutline.prototype = {
_contextMenuEventFired: function(event)
{
var treeElement = this._treeElementFromEvent(event);
- if (!treeElement || treeElement.treeOutline !== this)
+ if (!treeElement)
return;
var contextMenu = new WebInspector.ContextMenu(event);
- contextMenu.appendApplicableItems(treeElement._node);
- contextMenu.show();
- },
-
- populateContextMenu: function(contextMenu, event)
- {
- var treeElement = this._treeElementFromEvent(event);
- if (!treeElement || treeElement.treeOutline !== this)
- return;
var isPseudoElement = !!treeElement._node.pseudoType();
var isTag = treeElement._node.nodeType() === Node.ELEMENT_NODE && !isPseudoElement;
@@ -803,9 +792,10 @@ WebInspector.ElementsTreeOutline.prototype = {
treeElement._populateNodeContextMenu(contextMenu);
} else if (isPseudoElement) {
treeElement._populateScrollIntoView(contextMenu);
- } else if (treeElement._node.isShadowRoot()) {
- this.treeOutline._populateContextMenu(contextMenu, treeElement._node);
}
+
+ contextMenu.appendApplicableItems(treeElement._node);
+ contextMenu.show();
},
_updateModifiedNodes: function()
@@ -814,12 +804,6 @@ WebInspector.ElementsTreeOutline.prototype = {
this._elementsTreeUpdater._updateModifiedNodes();
},
- _populateContextMenu: function(contextMenu, node)
- {
- if (this._contextMenuCallback)
- this._contextMenuCallback(contextMenu, node);
- },
-
handleShortcut: function(event)
{
var node = this.selectedDOMNode();
@@ -1632,7 +1616,6 @@ WebInspector.ElementsTreeElement.prototype = {
contextMenu.appendSeparator();
}
this._populateNodeContextMenu(contextMenu);
- this.treeOutline._populateContextMenu(contextMenu, this._node);
this._populateScrollIntoView(contextMenu);
},
« no previous file with comments | « Source/devtools/front_end/elements/ElementsPanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698