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

Unified Diff: Source/devtools/front_end/ui/SidebarPane.js

Issue 1172643002: DevTools: migrate sidebar pane's titleElement to use Toolbar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined 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/ui/SidebarPane.js
diff --git a/Source/devtools/front_end/ui/SidebarPane.js b/Source/devtools/front_end/ui/SidebarPane.js
index 707f255d767fa0257d418280f4021ad1af3e0298..6c53c20abaddb7c51ea102ceef43e5d664609638 100644
--- a/Source/devtools/front_end/ui/SidebarPane.js
+++ b/Source/devtools/front_end/ui/SidebarPane.js
@@ -37,8 +37,6 @@ WebInspector.SidebarPane = function(title)
this.setMinimumSize(25, 0);
this.element.className = "sidebar-pane"; // Override
- this.titleElement = createElementWithClass("div", "sidebar-pane-toolbar");
- this.bodyElement = this.element.createChild("div", "body");
this._title = title;
this._expandCallback = null;
this._paneVisible = true;
@@ -46,6 +44,20 @@ WebInspector.SidebarPane = function(title)
WebInspector.SidebarPane.prototype = {
/**
+ * @return {!WebInspector.Toolbar}
+ */
+ toolbar: function()
+ {
+ if (!this._toolbar) {
+ this._toolbar = new WebInspector.Toolbar(undefined, true);
+ this._toolbar.element.addEventListener("click", consumeEvent);
+ this._toolbar.element.classList.add("sidebar-pane-toolbar");
+ this.element.insertBefore(this._toolbar.element, this.element.firstChild);
+ }
+ return this._toolbar;
+ },
+
+ /**
* @return {string}
*/
title: function()
@@ -109,7 +121,6 @@ WebInspector.SidebarPaneTitle = function(container, pane)
this.element.tabIndex = 0;
this.element.addEventListener("click", this._toggleExpanded.bind(this), false);
this.element.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
- this.element.appendChild(this._pane.titleElement);
}
WebInspector.SidebarPaneTitle.prototype = {
@@ -165,6 +176,8 @@ WebInspector.SidebarPaneStack.prototype = {
{
var paneTitle = new WebInspector.SidebarPaneTitle(this.element, pane);
this._titleByPane.set(pane, paneTitle);
+ if (pane._toolbar)
+ paneTitle.element.appendChild(pane._toolbar.element);
pane._attached(this._setPaneVisible.bind(this, pane), paneTitle._expand.bind(paneTitle));
},
@@ -204,7 +217,8 @@ WebInspector.SidebarTabbedPane.prototype = {
{
var title = pane.title();
this.appendTab(title, title, pane);
- pane.element.appendChild(pane.titleElement);
+ if (pane._toolbar)
+ pane.element.insertBefore(pane._toolbar.element, pane.element.firstChild);
pane._attached(this._setPaneVisible.bind(this, pane), this.selectTab.bind(this, title));
},

Powered by Google App Engine
This is Rietveld 408576698