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

Unified Diff: Source/devtools/front_end/ElementsTreeOutline.js

Issue 75253002: DevTools: [Elements] Implement "Copy CSS Path" context menu item for elements (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Tentatively fix xpath test on Windows bot Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/DOMPresentationUtils.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/ElementsTreeOutline.js
diff --git a/Source/devtools/front_end/ElementsTreeOutline.js b/Source/devtools/front_end/ElementsTreeOutline.js
index ea406b3ebeb62d90ad8eee0f4d8255248c9e9d69..b1da8b756647993992d08150d90ee4606086bf9d 100644
--- a/Source/devtools/front_end/ElementsTreeOutline.js
+++ b/Source/devtools/front_end/ElementsTreeOutline.js
@@ -1335,7 +1335,6 @@ WebInspector.ElementsTreeElement.prototype = {
this._populateForcedPseudoStateItems(pseudoSubMenu);
contextMenu.appendSeparator();
}
-
this._populateNodeContextMenu(contextMenu);
this.treeOutline._populateContextMenu(contextMenu, this._node);
this._populateScrollIntoView(contextMenu);
@@ -1373,6 +1372,10 @@ WebInspector.ElementsTreeElement.prototype = {
var openTagElement = this.treeOutline.getCachedTreeElement(this.representedObject) || this;
contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTagElement._editAsHTML.bind(openTagElement));
contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this));
+
+ // Place it here so that all "Copy"-ing items stick together.
+ if (this.representedObject.nodeType() === Node.ELEMENT_NODE)
+ contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Copy CSS path" : "Copy CSS Path"), this._copyCSSPath.bind(this));
contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXPath.bind(this));
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this));
contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Inspect DOM properties" : "Inspect DOM Properties"), this._inspectDOMProperties.bind(this));
@@ -2196,9 +2199,14 @@ WebInspector.ElementsTreeElement.prototype = {
this._node.copyNode();
},
+ _copyCSSPath: function()
+ {
+ InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.cssPath(this._node, true));
+ },
+
_copyXPath: function()
{
- this._node.copyXPath(true);
+ InspectorFrontendHost.copyText(WebInspector.DOMPresentationUtils.xPath(this._node, true));
},
_inspectDOMProperties: function()
« no previous file with comments | « Source/devtools/front_end/DOMPresentationUtils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698