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

Unified Diff: Source/devtools/front_end/elements/ElementStatePaneWidget.js

Issue 1176413002: Devtools: Fix disabled element state pane button after reloading (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months 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
Index: Source/devtools/front_end/elements/ElementStatePaneWidget.js
diff --git a/Source/devtools/front_end/elements/ElementStatePaneWidget.js b/Source/devtools/front_end/elements/ElementStatePaneWidget.js
index 8fee07412dd97e3992e9d43c1089db489a232bda..1076e1c4c1a117c759ddac0923f60ed4480a0753 100644
--- a/Source/devtools/front_end/elements/ElementStatePaneWidget.js
+++ b/Source/devtools/front_end/elements/ElementStatePaneWidget.js
@@ -92,13 +92,8 @@ WebInspector.ElementStatePaneWidget.prototype = {
onNodeChanged: function(newNode)
{
this._updateTarget(newNode? newNode.target() : null);
- this.toolbarItem().setEnabled(!!newNode);
- if (!newNode) {
- if (this.isShowing())
- this.detach();
- return;
- }
- this._updateInputs(newNode);
+ if (newNode)
+ this._updateInputs(newNode);
},
/**
@@ -126,6 +121,8 @@ WebInspector.ElementStatePaneWidget.ButtonProvider = function()
this._button = new WebInspector.ToolbarButton(WebInspector.UIString("Toggle Element State"), "pin-toolbar-item");
this._button.addEventListener("click", this._clicked, this);
this._view = new WebInspector.ElementStatePaneWidget(this.item());
+ WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._nodeChanged, this);
+ this._nodeChanged();
}
WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = {
@@ -142,5 +139,13 @@ WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = {
item: function()
{
return this._button;
+ },
+
+ _nodeChanged: function()
+ {
+ var enabled = !!WebInspector.context.flavor(WebInspector.DOMNode);
+ this._button.setEnabled(enabled);
+ if (!enabled && this._button.toggled())
+ WebInspector.ElementsPanel.instance().sidebarPanes.styles.showToolbarPane(null);
}
}
« no previous file with comments | « Source/devtools/front_end/animation/AnimationControlPane.js ('k') | Source/devtools/front_end/elements/StylesSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698