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 dde173bfa2576aa126ad5c02248fac63bdf1e132..da30f7346128775438ccc99f78416781b30f5816 100644 |
--- a/Source/devtools/front_end/elements/ElementsPanel.js |
+++ b/Source/devtools/front_end/elements/ElementsPanel.js |
@@ -271,8 +271,6 @@ WebInspector.ElementsPanel.prototype = { |
if (this.isShowing()) |
this.wasShown(); |
- if (this._showLayoutEditor) |
- domModel.setHighlighter(new WebInspector.ElementsPanel.LayoutEditorNodeHighlighter(target, treeOutline)); |
}, |
/** |
@@ -288,8 +286,6 @@ WebInspector.ElementsPanel.prototype = { |
treeOutline.unwireFromDOMModel(); |
this._treeOutlines.remove(treeOutline); |
treeOutline.element.remove(); |
- if (this._showLayoutEditor) |
- domModel.setHighlighter(null); |
}, |
_updateTreeOutlineVisibleWidth: function() |
@@ -884,16 +880,16 @@ WebInspector.ElementsPanel.prototype = { |
*/ |
revealAndSelectNode: function(node) |
{ |
- if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.enabled()) { |
- InspectorFrontendHost.bringToFront(); |
- WebInspector.inspectElementModeController.disable(); |
- } |
+ if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.started()) |
+ WebInspector.inspectElementModeController.stop(); |
this._omitDefaultSelection = true; |
- WebInspector.inspectorView.setCurrentPanel(this); |
+ |
+ WebInspector.inspectorView.setCurrentPanel(this, this._showLayoutEditor); |
node = WebInspector.moduleSetting("showUAShadowDOM").get() ? node : this._leaveUserAgentShadowDOM(node); |
+ var domModel = WebInspector.DOMModel.fromTarget(node.target()); |
if (this._showLayoutEditor) |
- node.highlight(); |
+ node.highlightWithConfig({mode: "all", showLayoutEditor: true}); |
else |
node.highlightForTwoSeconds(); |
@@ -1103,20 +1099,18 @@ WebInspector.ElementsPanel.prototype = { |
this._showLayoutEditor = !this._showLayoutEditor; |
this._layoutEditorButton.setToggled(this._showLayoutEditor); |
var targets = WebInspector.targetManager.targets(); |
+ |
+ if (this._showLayoutEditor) |
+ WebInspector.inspectElementModeController.disable(); |
+ else |
+ WebInspector.inspectElementModeController.enable(); |
+ |
for (var target of targets) { |
var domModel = WebInspector.DOMModel.fromTarget(target); |
if (!domModel) |
continue; |
- var treeOutline = /** @type {!WebInspector.ElementsTreeOutline} */(this._modelToTreeOutline.get(domModel)); |
- if (this._showLayoutEditor) |
- domModel.setHighlighter(new WebInspector.ElementsPanel.LayoutEditorNodeHighlighter(target, treeOutline)); |
- else |
- domModel.setHighlighter(null); |
- |
- // We need to correct (turn on/off layout editor) the config which is used by inspect element mode, so we re-enable it. |
- if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.enabled()) |
- domModel.setInspectModeEnabled(true, WebInspector.moduleSetting("showUAShadowDOM").get()); |
+ domModel.setInspectModeEnabled(this._showLayoutEditor, "showLayoutEditor"); |
} |
WebInspector.DOMModel.hideDOMNodeHighlight(); |
}, |
@@ -1299,57 +1293,4 @@ WebInspector.ElementsPanel.HiddenMarkerDecorator.prototype = { |
{ |
return { color: "#555", title: WebInspector.UIString("Element is hidden") }; |
} |
-} |
- |
-/** |
- * @constructor |
- * @extends {WebInspector.DefaultDOMNodeHighlighter} |
- * @param {!WebInspector.Target} target |
- * @param {!WebInspector.ElementsTreeOutline} treeOutline |
- */ |
-WebInspector.ElementsPanel.LayoutEditorNodeHighlighter = function(target, treeOutline) |
-{ |
- WebInspector.DefaultDOMNodeHighlighter.call(this, target.domAgent()); |
- this._treeOutline = treeOutline; |
-} |
- |
-WebInspector.ElementsPanel.LayoutEditorNodeHighlighter.prototype = { |
- /** |
- * @override |
- * @param {?WebInspector.DOMNode} node |
- * @param {!DOMAgent.HighlightConfig} config |
- * @param {!DOMAgent.BackendNodeId=} backendNodeId |
- * @param {!RuntimeAgent.RemoteObjectId=} objectId |
- */ |
- highlightDOMNode: function(node, config, backendNodeId, objectId) |
- { |
- config.showLayoutEditor = config.showInfo; |
- var selectedNode = this._treeOutline.selectedDOMNode(); |
- if (objectId || node || backendNodeId || !selectedNode) |
- WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.call(this, node, config, backendNodeId, objectId); |
- else |
- WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.call(this, selectedNode, config); |
- }, |
- |
- /** |
- * @override |
- * @param {boolean} enabled |
- * @param {boolean} inspectUAShadowDOM |
- * @param {!DOMAgent.HighlightConfig} config |
- * @param {function(?Protocol.Error)=} callback |
- */ |
- setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callback) |
- { |
- config.showLayoutEditor = config.showInfo; |
- WebInspector.DefaultDOMNodeHighlighter.prototype.setInspectModeEnabled.call(this, enabled, inspectUAShadowDOM, config, callback); |
- |
- if (enabled) |
- return; |
- |
- var selectedNode = this._treeOutline.selectedDOMNode(); |
- if (selectedNode) |
- WebInspector.DefaultDOMNodeHighlighter.prototype.highlightDOMNode.call(this, selectedNode, config); |
- }, |
- |
- __proto__: WebInspector.DefaultDOMNodeHighlighter.prototype |
} |