Index: Source/devtools/front_end/elements/StylesSidebarPane.js |
diff --git a/Source/devtools/front_end/elements/StylesSidebarPane.js b/Source/devtools/front_end/elements/StylesSidebarPane.js |
index 11bc809f476877aad95dceecc5f10341a89e7f63..9f9c14ee14cdcaabe1a4fd8b6300ecbe009b7a7d 100644 |
--- a/Source/devtools/front_end/elements/StylesSidebarPane.js |
+++ b/Source/devtools/front_end/elements/StylesSidebarPane.js |
@@ -45,6 +45,13 @@ WebInspector.StylesSidebarPane = function() |
filterContainerElement.appendChild(this._filterInput); |
var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar", hbox); |
+ if (Runtime.experiments.isEnabled("layoutEditor") && !Runtime.queryParam("remoteFrontend")) { |
+ this._layoutEditorButton = new WebInspector.ToolbarButton(WebInspector.UIString("Toggle Layout Editor"), "layout-editor-toolbar-item"); |
+ toolbar.appendToolbarItem(this._layoutEditorButton); |
+ this._layoutEditorButton.addEventListener("click", this._toggleLayoutEditor, this); |
+ toolbar.appendSeparator(); |
+ } |
+ |
toolbar.element.classList.add("styles-pane-toolbar", "toolbar-gray-toggled"); |
this._currentToolbarPane = null; |
@@ -136,6 +143,22 @@ WebInspector.StylesSidebarPane.ignoreErrorsForProperty = function(property) { |
} |
WebInspector.StylesSidebarPane.prototype = { |
+ _toggleLayoutEditor: function() |
+ { |
+ this._showLayoutEditor = !this._showLayoutEditor; |
+ this._layoutEditorButton.setToggled(this._showLayoutEditor); |
+ var targets = WebInspector.targetManager.targets(); |
+ |
+ if (this._showLayoutEditor) |
+ WebInspector.inspectElementModeController.disable(); |
+ else |
+ WebInspector.inspectElementModeController.enable(); |
+ |
+ var mode = this._showLayoutEditor ? DOMAgent.InspectMode.ShowLayoutEditor : DOMAgent.InspectMode.None; |
+ for (var domModel of WebInspector.DOMModel.instances()) |
+ domModel.setInspectMode(mode); |
+ }, |
+ |
onUndoOrRedoHappened: function() |
{ |
this.setNode(this.node()); |