Reviewers: dgozman
CL:
https://codereview.chromium.org/2648253006/Message:
Please take a look.
Description:
[DevTools] Hide empty toolbars
BUG=684608
Affected files (+10, -2 lines):
M third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
M third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
Index: third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
index 58a3e642cdab996bb9782eb1741aa93a34e3d2c1..ccbef798afc87718b90c55e21aa1e8b21e909824 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
@@ -639,9 +639,10 @@ Resources.ResourcesPanel = class extends UI.PanelWithSidebar {
this.visibleView = view;
this._storageViewToolbar.removeToolbarItems();
- var toolbarItems = view instanceof UI.SimpleView ? view.syncToolbarItems() : null;
- for (var i = 0; toolbarItems && i < toolbarItems.length; ++i)
+ var toolbarItems = (view instanceof UI.SimpleView && view.syncToolbarItems()) || [];
+ for (var i = 0; i < toolbarItems.length; ++i)
this._storageViewToolbar.appendToolbarItem(toolbarItems[i]);
+ this._storageViewToolbar.setVisible(toolbarItems.length > 0);
}
closeVisibleView() {
Index: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index 8e6f552001bba2f712cf2fb3412318eddf459255..b3c75cb232d02aaab47434cdfa67fe096d721529 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -355,6 +355,13 @@ UI.Toolbar = class {
}
}
}
+
+ /**
+ * @param {boolean} visible
+ */
+ setVisible(visible) {
+ this.element.classList.toggle('hidden', !visible);
+ }
};
/**