Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (186653 => 186654)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-07-10 00:09:11 UTC (rev 186653)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-07-10 00:11:09 UTC (rev 186654)
@@ -1,5 +1,22 @@
2015-07-09 Timothy Hatcher <timo...@apple.com>
+ Web Inspector: Storage tab should have a scope bar in the sidebar
+ https://bugs.webkit.org/show_bug.cgi?id=146799
+
+ Reviewed by Mark Lam.
+
+ * Localizations/en.lproj/localizedStrings.js: Updated.
+ * UserInterface/Main.html: Added StorageSidebarPanel.css.
+ * UserInterface/Views/StorageSidebarPanel.css: Added.
+ * UserInterface/Views/StorageSidebarPanel.js:
+ (WebInspector.StorageSidebarPanel):
+ (WebInspector.StorageSidebarPanel.prototype.hasCustomFilters):
+ (WebInspector.StorageSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match):
+ (WebInspector.StorageSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
+ (WebInspector.StorageSidebarPanel.prototype._scopeBarSelectionDidChange):
+
+2015-07-09 Timothy Hatcher <timo...@apple.com>
+
Web Inspector: Make the TabBar work better with AX
https://bugs.webkit.org/show_bug.cgi?id=146806
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (186653 => 186654)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-07-10 00:09:11 UTC (rev 186653)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2015-07-10 00:11:09 UTC (rev 186654)
@@ -51,6 +51,7 @@
localizedStrings["All Changes"] = "All Changes";
localizedStrings["All Exceptions"] = "All Exceptions";
localizedStrings["All Resources"] = "All Resources";
+localizedStrings["All Storage"] = "All Storage";
localizedStrings["All Uncaught Exceptions"] = "All Uncaught Exceptions";
localizedStrings["An error occured trying to\nread the %s table."] = "An error occured trying to\nread the %s table.";
localizedStrings["An error occurred trying to load the resource."] = "An error occurred trying to load the resource.";
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (186653 => 186654)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-07-10 00:09:11 UTC (rev 186653)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2015-07-10 00:11:09 UTC (rev 186654)
@@ -136,6 +136,7 @@
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
+ <link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
<link rel="stylesheet" href=""
Added: trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.css (0 => 186654)
--- trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.css 2015-07-10 00:11:09 UTC (rev 186654)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+.sidebar > .panel.navigation.storage > :matches(.content, .empty-content-placeholder) {
+ top: 29px;
+}
+
+.sidebar > .panel.navigation.storage > .navigation-bar {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js (186653 => 186654)
--- trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js 2015-07-10 00:09:11 UTC (rev 186653)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/StorageSidebarPanel.js 2015-07-10 00:11:09 UTC (rev 186654)
@@ -33,6 +33,34 @@
this.filterBar.placeholder = WebInspector.UIString("Filter Storage List");
+ this._navigationBar = new WebInspector.NavigationBar;
+ this.element.appendChild(this._navigationBar.element);
+
+ var scopeItemPrefix = "storage-sidebar-";
+ var scopeBarItems = [];
+
+ scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix + "type-all", WebInspector.UIString("All Storage"), true));
+
+ var storageTypes = [{identifier: "application-cache", title: WebInspector.UIString("Application Cache"), classes: [WebInspector.ApplicationCacheFrameTreeElement, WebInspector.ApplicationCacheManifestTreeElement]},
+ {identifier: "cookies", title: WebInspector.UIString("Cookies"), classes: [WebInspector.CookieStorageTreeElement]},
+ {identifier: "database", title: WebInspector.UIString("Databases"), classes: [WebInspector.DatabaseHostTreeElement, WebInspector.DatabaseTableTreeElement, WebInspector.DatabaseTreeElement]},
+ {identifier: "indexed-database", title: WebInspector.UIString("Indexed Databases"), classes: [WebInspector.IndexedDatabaseHostTreeElement, WebInspector.IndexedDatabaseObjectStoreTreeElement, WebInspector.IndexedDatabaseTreeElement]},
+ {identifier: "local-sotrage", title: WebInspector.UIString("Local Storage"), classes: [WebInspector.DOMStorageTreeElement], localStorage: true},
+ {identifier: "session-sotrage", title: WebInspector.UIString("Session Storage"), classes: [WebInspector.DOMStorageTreeElement], localStorage: false}];
+
+ storageTypes.sort(function(a, b) { return a.title.localeCompare(b.title); });
+
+ for (var info of storageTypes) {
+ var scopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + info.identifier, info.title);
+ scopeBarItem.__storageTypeInfo = info;
+ scopeBarItems.push(scopeBarItem);
+ }
+
+ this._scopeBar = new WebInspector.ScopeBar("storage-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
+ this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+
+ this._navigationBar.addNavigationItem(this._scopeBar);
+
this._localStorageRootTreeElement = null;
this._sessionStorageRootTreeElement = null;
@@ -91,6 +119,46 @@
WebInspector.applicationCacheManager.removeEventListener(null, null, this);
}
+ // Protected
+
+ hasCustomFilters()
+ {
+ console.assert(this._scopeBar.selectedItems.length === 1);
+ var selectedScopeBarItem = this._scopeBar.selectedItems[0];
+ return selectedScopeBarItem && !selectedScopeBarItem.exclusive;
+ }
+
+ matchTreeElementAgainstCustomFilters(treeElement, flags)
+ {
+ console.assert(this._scopeBar.selectedItems.length === 1);
+ var selectedScopeBarItem = this._scopeBar.selectedItems[0];
+
+ // Show everything if there is no selection or "All Storage" is selected (the exclusive item).
+ if (!selectedScopeBarItem || selectedScopeBarItem.exclusive)
+ return true;
+
+ // Folders are hidden on the first pass, but visible childen under the folder will force the folder visible again.
+ if (treeElement instanceof WebInspector.FolderTreeElement)
+ return false;
+
+ function match()
+ {
+ for (var constructor of selectedScopeBarItem.__storageTypeInfo.classes) {
+ if (constructor === WebInspector.DOMStorageTreeElement && treeElement instanceof constructor)
+ return treeElement.representedObject.isLocalStorage() === selectedScopeBarItem.__storageTypeInfo.localStorage;
+ if (treeElement instanceof constructor)
+ return true;
+ }
+
+ return false;
+ }
+
+ var matched = match();
+ if (matched)
+ flags.expandTreeElement = true;
+ return matched;
+ }
+
// Private
_treeElementSelected(treeElement, selectedByUser)
@@ -291,4 +359,9 @@
this._applicationCacheRootTreeElement = null;
this._applicationCacheURLTreeElementMap = {};
}
+
+ _scopeBarSelectionDidChange(event)
+ {
+ this.updateFilter();
+ }
};