Index: Source/devtools/front_end/elements/ElementsTreeElement.js |
diff --git a/Source/devtools/front_end/elements/ElementsTreeElement.js b/Source/devtools/front_end/elements/ElementsTreeElement.js |
index 80a38f371509baeb4425564fd393c7825819917f..8894e6df867fc7e57486c55c772578e5666cad6f 100644 |
--- a/Source/devtools/front_end/elements/ElementsTreeElement.js |
+++ b/Source/devtools/front_end/elements/ElementsTreeElement.js |
@@ -40,8 +40,8 @@ WebInspector.ElementsTreeElement = function(node, elementCloseTag) |
TreeElement.call(this); |
this._node = node; |
- this._decorationsElement = createElementWithClass("div", "hidden"); |
- this.listItemElement.appendChild(this._decorationsElement); |
+ this._gutterContainer = this.listItemElement.createChild("div", "gutter-container"); |
+ this._decorationsElement = this._gutterContainer.createChild("div", "hidden"); |
this._elementCloseTag = elementCloseTag; |
@@ -164,6 +164,14 @@ WebInspector.ElementsTreeElement.prototype = { |
}, |
/** |
+ * @return {!Element} |
+ */ |
+ gutterElement: function() |
+ { |
+ return this._gutterContainer; |
+ }, |
+ |
+ /** |
* @param {string} searchQuery |
*/ |
highlightSearchResults: function(searchQuery) |
@@ -772,10 +780,11 @@ WebInspector.ElementsTreeElement.prototype = { |
/** |
* @param {function(string, string)} commitCallback |
+ * @param {function()} disposeCallback |
* @param {?Protocol.Error} error |
* @param {string} initialValue |
*/ |
- _startEditingAsHTML: function(commitCallback, error, initialValue) |
+ _startEditingAsHTML: function(commitCallback, disposeCallback, error, initialValue) |
{ |
if (error) |
return; |
@@ -824,6 +833,7 @@ WebInspector.ElementsTreeElement.prototype = { |
*/ |
function dispose() |
{ |
+ disposeCallback(); |
delete this._editing; |
this.treeOutline.setMultilineEditing(null); |
@@ -1067,7 +1077,7 @@ WebInspector.ElementsTreeElement.prototype = { |
highlightElement.appendChild(nodeInfo); |
this.title = highlightElement; |
this.updateDecorations(); |
- this.listItemElement.insertBefore(this._decorationsElement, this.listItemElement.firstChild); |
+ this.listItemElement.insertBefore(this._gutterContainer, this.listItemElement.firstChild); |
delete this._highlightResult; |
} |
@@ -1120,7 +1130,7 @@ WebInspector.ElementsTreeElement.prototype = { |
(n === node ? decorations : descendantDecorations).push(decoration); |
} |
- Promise.all(promises).then(setTitle.bind(this)); |
+ Promise.all(promises).then(setTitle.bind(this)).then(this._updateGutter.bind(this)); |
/** |
* @this {WebInspector.ElementsTreeElement} |
@@ -1181,6 +1191,11 @@ WebInspector.ElementsTreeElement.prototype = { |
} |
}, |
+ _updateGutter: function() |
+ { |
+ this._gutterContainer.classList.toggle("has-decorations", this._decorationsElement.hasChildNodes()); |
+ }, |
+ |
/** |
* @param {!Node} parentElement |
* @param {string} name |
@@ -1533,8 +1548,14 @@ WebInspector.ElementsTreeElement.prototype = { |
node.setOuterHTML(value, selectNode); |
} |
+ function disposeCallback() |
+ { |
+ if (callback) |
+ callback(false); |
+ } |
+ |
var node = this._node; |
- node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); |
+ node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange, disposeCallback)); |
}, |
_copyCSSPath: function() |