Chromium Code Reviews| 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 b11fcdf71827008af2200c0dfb54de8e49d3c3ad..a5bdd230a8cc0a71c7eb61d9eaedf4219f1c97e4 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,17 +880,15 @@ 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); |
| - if (this._showLayoutEditor) |
| - node.highlight(); |
| - else |
| + var domModel = WebInspector.DOMModel.fromTarget(node.target()); |
|
dgozman
2015/08/28 23:44:11
Not used.
sergeyv
2015/09/02 00:40:58
Done.
|
| + if (!this._showLayoutEditor) |
| node.highlightForTwoSeconds(); |
| this.selectDOMNode(node, true); |
| @@ -1103,20 +1097,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 +1291,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 |
| } |