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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsPanel.js

Issue 2140753003: DevTools: remove BaseToolbarPaneWidget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 toolbar.element.classList.add("styles-pane-toolbar"); 127 toolbar.element.classList.add("styles-pane-toolbar");
128 toolbar.makeToggledGray(); 128 toolbar.makeToggledGray();
129 var toolbarPaneContainer = container.createChild("div", "styles-sidebar- toolbar-pane-container"); 129 var toolbarPaneContainer = container.createChild("div", "styles-sidebar- toolbar-pane-container");
130 this._toolbarPaneElement = createElementWithClass("div", "styles-sidebar -toolbar-pane"); 130 this._toolbarPaneElement = createElementWithClass("div", "styles-sidebar -toolbar-pane");
131 toolbarPaneContainer.appendChild(this._toolbarPaneElement); 131 toolbarPaneContainer.appendChild(this._toolbarPaneElement);
132 return container; 132 return container;
133 }, 133 },
134 134
135 /** 135 /**
136 * @param {?WebInspector.Widget} widget 136 * @param {?WebInspector.Widget} widget
137 * @param {!WebInspector.ToolbarToggle=} toggle
137 */ 138 */
138 showToolbarPane: function(widget) 139 showToolbarPane: function(widget, toggle)
139 { 140 {
141 if (this._pendingWidgetToggle)
142 this._pendingWidgetToggle.setToggled(false);
143 this._pendingWidgetToggle = toggle;
144
140 if (this._animatedToolbarPane !== undefined) 145 if (this._animatedToolbarPane !== undefined)
141 this._pendingWidget = widget; 146 this._pendingWidget = widget;
142 else 147 else
143 this._startToolbarPaneAnimation(widget); 148 this._startToolbarPaneAnimation(widget);
149
150 if (widget && toggle)
151 toggle.setToggled(true);
144 }, 152 },
145 153
146 /** 154 /**
147 * @param {?WebInspector.Widget} widget 155 * @param {?WebInspector.Widget} widget
148 */ 156 */
149 _startToolbarPaneAnimation: function(widget) 157 _startToolbarPaneAnimation: function(widget)
150 { 158 {
151 if (widget === this._currentToolbarPane) 159 if (widget === this._currentToolbarPane)
152 return; 160 return;
153 161
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 /** 1245 /**
1238 * @override 1246 * @override
1239 * @param {!WebInspector.DOMNode} node 1247 * @param {!WebInspector.DOMNode} node
1240 * @return {?{title: string, color: string}} 1248 * @return {?{title: string, color: string}}
1241 */ 1249 */
1242 decorate: function(node) 1250 decorate: function(node)
1243 { 1251 {
1244 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; 1252 return { color: "orange", title: WebInspector.UIString("Element state: % s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) };
1245 } 1253 }
1246 } 1254 }
1247
1248 /**
1249 * @constructor
1250 * @extends {WebInspector.ThrottledWidget}
1251 * @param {!WebInspector.ToolbarItem} toolbarItem
1252 */
1253 WebInspector.ElementsPanel.BaseToolbarPaneWidget = function(toolbarItem)
1254 {
1255 WebInspector.ThrottledWidget.call(this);
1256 this._toolbarItem = toolbarItem;
1257 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._nod eChanged, this);
1258 }
1259
1260 WebInspector.ElementsPanel.BaseToolbarPaneWidget.prototype = {
1261 _nodeChanged: function()
1262 {
1263 if (!this.isShowing())
1264 return;
1265
1266 var elementNode = WebInspector.SharedSidebarModel.elementNode(WebInspect or.context.flavor(WebInspector.DOMNode));
1267 this.onNodeChanged(elementNode);
1268 },
1269
1270 /**
1271 * @param {?WebInspector.DOMNode} newNode
1272 * @protected
1273 */
1274 onNodeChanged: function(newNode)
1275 {
1276 },
1277
1278 /**
1279 * @override
1280 */
1281 willHide: function()
1282 {
1283 this._toolbarItem.setToggled(false);
1284 WebInspector.ThrottledWidget.prototype.willHide.call(this);
1285 },
1286
1287 /**
1288 * @override
1289 */
1290 wasShown: function()
1291 {
1292 this._toolbarItem.setToggled(true);
1293 this._nodeChanged();
1294 WebInspector.ThrottledWidget.prototype.wasShown.call(this);
1295 },
1296
1297 __proto__: WebInspector.ThrottledWidget.prototype
1298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698