<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185044] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185044">185044</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-05-31 12:50:16 -0700 (Sun, 31 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Resources tab navigation sidebar should have a type filter header
https://bugs.webkit.org/show_bug.cgi?id=145474
Reviewed by Joseph Pecoraro.
* Localizations/en.lproj/localizedStrings.js: Updated.
* UserInterface/Images/UpDownArrows.svg: Make styleable.
* UserInterface/Main.html: Added new files.
* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView): Drive-by fix. Mark All as exclusive.
* UserInterface/Views/MultipleScopeBarItem.js: Added.
(WebInspector.MultipleScopeBarItem):
(WebInspector.MultipleScopeBarItem.prototype.get element):
(WebInspector.MultipleScopeBarItem.prototype.get exclusive):
(WebInspector.MultipleScopeBarItem.prototype.get scopeBarItems):
(WebInspector.MultipleScopeBarItem.set scopeBarItems.createOption):
(WebInspector.MultipleScopeBarItem.prototype.set scopeBarItems):
(WebInspector.MultipleScopeBarItem.prototype.get selected):
(WebInspector.MultipleScopeBarItem.prototype.set selected):
(WebInspector.MultipleScopeBarItem.prototype.get selectedScopeBarItem):
(WebInspector.MultipleScopeBarItem.prototype.set selectedScopeBarItem):
(WebInspector.MultipleScopeBarItem.prototype._clicked):
(WebInspector.MultipleScopeBarItem.prototype._selectElementSelectionChanged):
(WebInspector.MultipleScopeBarItem.prototype._itemSelectionDidChange):
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype.matchTreeElementAgainstFilterFunctions):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.matchTextFilter):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.makeVisible):
(WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement):
(WebInspector.NavigationSidebarPanel.prototype._updateFilter):
(WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
Improve filtering so non-text filters can choose to auto-expand the tree.
* UserInterface/Views/ResourceSidebarPanel.css: Added.
(.sidebar > .panel.navigation.resource > :matches(.content, .empty-content-placeholder)):
(.sidebar > .panel.navigation.resource > .navigation-bar):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel):
(WebInspector.ResourceSidebarPanel.prototype.hasCustomFilters):
(WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match):
(WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
(WebInspector.ResourceSidebarPanel.prototype._scopeBarSelectionDidChange):
Make a ScopeBar and make it filter the TreeOutline when needed.
* UserInterface/Views/ScopeBar.css:
(.scope-bar > li.multiple):
(.scope-bar > li.multiple > select):
(.scope-bar > li.multiple.selected > select):
(.scope-bar > li.multiple > .arrows):
(.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .filled):
(.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .stroked):
* UserInterface/Views/ScopeBar.js:
(WebInspector.ScopeBar): Support shouldGroupNonExclusiveItems which will use MultipleScopeBarItem.
(WebInspector.ScopeBar.prototype._populate):
(WebInspector.ScopeBar.prototype._itemSelectionDidChange):
(WebInspector.ScopeBar.prototype.updateLayout): Deleted. Not needed for our current styles.
* UserInterface/Views/ScopeBarItem.js:
(WebInspector.ScopeBarItem):
(WebInspector.ScopeBarItem.prototype.get id):
(WebInspector.ScopeBarItem.prototype.get label):
(WebInspector.ScopeBarItem.prototype.get exclusive):
(WebInspector.ScopeBarItem.prototype.setSelected):
(WebInspector.ScopeBarItem.prototype._clicked):
(WebInspector.ScopeBarItem.prototype.get element): Deleted.
(WebInspector.ScopeBarItem.prototype._markElementSelected): Deleted.
Cleaned up and modernized a bit.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceImagesUpDownArrowssvg">trunk/Source/WebInspectorUI/UserInterface/Images/UpDownArrows.svg</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNavigationSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScopeBarcss">trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScopeBarjs">trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScopeBarItemjs">trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsMultipleScopeBarItemjs">trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPanelcss">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.css</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -1,3 +1,80 @@
</span><ins>+2015-05-29 Timothy Hatcher <timothy@apple.com>
+
+ Web Inspector: Resources tab navigation sidebar should have a type filter header
+ https://bugs.webkit.org/show_bug.cgi?id=145474
+
+ Reviewed by Joseph Pecoraro.
+
+ * Localizations/en.lproj/localizedStrings.js: Updated.
+
+ * UserInterface/Images/UpDownArrows.svg: Make styleable.
+
+ * UserInterface/Main.html: Added new files.
+
+ * UserInterface/Views/LogContentView.js:
+ (WebInspector.LogContentView): Drive-by fix. Mark All as exclusive.
+
+ * UserInterface/Views/MultipleScopeBarItem.js: Added.
+ (WebInspector.MultipleScopeBarItem):
+ (WebInspector.MultipleScopeBarItem.prototype.get element):
+ (WebInspector.MultipleScopeBarItem.prototype.get exclusive):
+ (WebInspector.MultipleScopeBarItem.prototype.get scopeBarItems):
+ (WebInspector.MultipleScopeBarItem.set scopeBarItems.createOption):
+ (WebInspector.MultipleScopeBarItem.prototype.set scopeBarItems):
+ (WebInspector.MultipleScopeBarItem.prototype.get selected):
+ (WebInspector.MultipleScopeBarItem.prototype.set selected):
+ (WebInspector.MultipleScopeBarItem.prototype.get selectedScopeBarItem):
+ (WebInspector.MultipleScopeBarItem.prototype.set selectedScopeBarItem):
+ (WebInspector.MultipleScopeBarItem.prototype._clicked):
+ (WebInspector.MultipleScopeBarItem.prototype._selectElementSelectionChanged):
+ (WebInspector.MultipleScopeBarItem.prototype._itemSelectionDidChange):
+
+ * UserInterface/Views/NavigationSidebarPanel.js:
+ (WebInspector.NavigationSidebarPanel.prototype.matchTreeElementAgainstFilterFunctions):
+ (WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.matchTextFilter):
+ (WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement.makeVisible):
+ (WebInspector.NavigationSidebarPanel.prototype.applyFiltersToTreeElement):
+ (WebInspector.NavigationSidebarPanel.prototype._updateFilter):
+ (WebInspector.NavigationSidebarPanel.prototype._treeElementAddedOrChanged):
+ Improve filtering so non-text filters can choose to auto-expand the tree.
+
+ * UserInterface/Views/ResourceSidebarPanel.css: Added.
+ (.sidebar > .panel.navigation.resource > :matches(.content, .empty-content-placeholder)):
+ (.sidebar > .panel.navigation.resource > .navigation-bar):
+
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WebInspector.ResourceSidebarPanel):
+ (WebInspector.ResourceSidebarPanel.prototype.hasCustomFilters):
+ (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters.match):
+ (WebInspector.ResourceSidebarPanel.prototype.matchTreeElementAgainstCustomFilters):
+ (WebInspector.ResourceSidebarPanel.prototype._scopeBarSelectionDidChange):
+ Make a ScopeBar and make it filter the TreeOutline when needed.
+
+ * UserInterface/Views/ScopeBar.css:
+ (.scope-bar > li.multiple):
+ (.scope-bar > li.multiple > select):
+ (.scope-bar > li.multiple.selected > select):
+ (.scope-bar > li.multiple > .arrows):
+ (.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .filled):
+ (.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .stroked):
+
+ * UserInterface/Views/ScopeBar.js:
+ (WebInspector.ScopeBar): Support shouldGroupNonExclusiveItems which will use MultipleScopeBarItem.
+ (WebInspector.ScopeBar.prototype._populate):
+ (WebInspector.ScopeBar.prototype._itemSelectionDidChange):
+ (WebInspector.ScopeBar.prototype.updateLayout): Deleted. Not needed for our current styles.
+
+ * UserInterface/Views/ScopeBarItem.js:
+ (WebInspector.ScopeBarItem):
+ (WebInspector.ScopeBarItem.prototype.get id):
+ (WebInspector.ScopeBarItem.prototype.get label):
+ (WebInspector.ScopeBarItem.prototype.get exclusive):
+ (WebInspector.ScopeBarItem.prototype.setSelected):
+ (WebInspector.ScopeBarItem.prototype._clicked):
+ (WebInspector.ScopeBarItem.prototype.get element): Deleted.
+ (WebInspector.ScopeBarItem.prototype._markElementSelected): Deleted.
+ Cleaned up and modernized a bit.
+
</ins><span class="cx"> 2015-05-29 Tobias Reiss <tobi+webkit@basecode.de>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Activity Viewer does not update on "clear all console messages"
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> localizedStrings["All"] = "All";
</span><span class="cx"> localizedStrings["All Changes"] = "All Changes";
</span><span class="cx"> localizedStrings["All Exceptions"] = "All Exceptions";
</span><ins>+localizedStrings["All Resources"] = "All Resources";
</ins><span class="cx"> localizedStrings["All Uncaught Exceptions"] = "All Uncaught Exceptions";
</span><span class="cx"> localizedStrings["An error occured trying to\nread the %s table."] = "An error occured trying to\nread the %s table.";
</span><span class="cx"> localizedStrings["An error occurred trying to load the resource."] = "An error occurred trying to load the resource.";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceImagesUpDownArrowssvg"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Images/UpDownArrows.svg (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Images/UpDownArrows.svg        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/UpDownArrows.svg        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> <?xml version="1.0" encoding="utf-8"?>
</span><span class="cx"> <!-- Copyright © 2014 Apple Inc. All rights reserved. -->
</span><span class="cx"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 5 12">
</span><del>- <path fill="none" stroke="black" stroke-linecap="square" d="M 0.5 3.5 L 2.5 1.5 L 4.5 3.5"/>
- <path fill="none" stroke="black" stroke-linecap="square" d="M 0.5 8.5 L 2.5 10.5 L 4.5 8.5"/>
</del><ins>+ <path class="stroked" fill="none" stroke="black" stroke-linecap="square" d="M 0.5 3.5 L 2.5 1.5 L 4.5 3.5"/>
+ <path class="stroked" fill="none" stroke="black" stroke-linecap="square" d="M 0.5 8.5 L 2.5 10.5 L 4.5 8.5"/>
</ins><span class="cx"> </svg>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -120,6 +120,7 @@
</span><span class="cx"> <link rel="stylesheet" href="Views/ReplayDashboardView.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/Resizer.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/ResourceIcons.css">
</span><ins>+ <link rel="stylesheet" href="Views/ResourceSidebarPanel.css">
</ins><span class="cx"> <link rel="stylesheet" href="Views/ResourceTreeElement.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/RulesStyleDetailsPanel.css">
</span><span class="cx"> <link rel="stylesheet" href="Views/ScopeBar.css">
</span><span class="lines">@@ -456,6 +457,7 @@
</span><span class="cx"> <script src="Views/LogContentView.js"></script>
</span><span class="cx"> <script src="Views/LogTreeElement.js"></script>
</span><span class="cx"> <script src="Views/MetricsStyleDetailsPanel.js"></script>
</span><ins>+ <script src="Views/MultipleScopeBarItem.js"></script>
</ins><span class="cx"> <script src="Views/NavigationBar.js"></script>
</span><span class="cx"> <script src="Views/NetworkTimelineOverviewGraph.js"></script>
</span><span class="cx"> <script src="Views/NetworkTimelineView.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLogContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> this._searchBar.addEventListener(WebInspector.SearchBar.Event.TextChanged, this._searchTextDidChange, this);
</span><span class="cx">
</span><span class="cx"> var scopeBarItems = [
</span><del>- new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.All, WebInspector.UIString("All")),
</del><ins>+ new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.All, WebInspector.UIString("All"), true),
</ins><span class="cx"> new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Errors, WebInspector.UIString("Errors")),
</span><span class="cx"> new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Warnings, WebInspector.UIString("Warnings")),
</span><span class="cx"> new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Logs, WebInspector.UIString("Logs"))
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsMultipleScopeBarItemjs"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js (0 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MultipleScopeBarItem.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -0,0 +1,170 @@
</span><ins>+/*
+ * 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.
+ */
+
+WebInspector.MultipleScopeBarItem = class MultipleScopeBarItem extends WebInspector.Object
+{
+ constructor(scopeBarItems)
+ {
+ super();
+
+ this._element = document.createElement("li");
+ this._element.classList.add("multiple");
+
+ this._titleElement = document.createElement("span");
+ this._element.appendChild(this._titleElement);
+ this._element.addEventListener("click", this._clicked.bind(this));
+
+ this._selectElement = document.createElement("select");
+ this._selectElement.addEventListener("change", this._selectElementSelectionChanged.bind(this));
+ this._element.appendChild(this._selectElement);
+
+ wrappedSVGDocument("Images/UpDownArrows.svg", "arrows", null, function(element) {
+ this._element.appendChild(element);
+ }.bind(this));
+
+ this.scopeBarItems = scopeBarItems;
+ }
+
+ // Public
+
+ get element()
+ {
+ return this._element;
+ }
+
+ get exclusive()
+ {
+ return false;
+ }
+
+ get scopeBarItems()
+ {
+ return this._scopeBarItems;
+ }
+
+ set scopeBarItems(scopeBarItems)
+ {
+ if (this._scopeBarItems) {
+ for (var scopeBarItem of this._scopeBarItems)
+ scopeBarItem.removeEventListener(null, null, this);
+ }
+
+ this._scopeBarItems = scopeBarItems || [];
+ this._selectedScopeBarItem = null;
+
+ this._selectElement.removeChildren();
+
+ function createOption(scopeBarItem)
+ {
+ var optionElement = document.createElement("option");
+ var maxPopupMenuLength = 130; // <rdar://problem/13445374> <select> with very long option has clipped text and popup menu is still very wide
+ optionElement.textContent = scopeBarItem.label.length <= maxPopupMenuLength ? scopeBarItem.label : scopeBarItem.label.substring(0, maxPopupMenuLength) + "\u2026";
+ return optionElement;
+ }
+
+ for (var scopeBarItem of this._scopeBarItems) {
+ if (scopeBarItem.selected && !this._selectedScopeBarItem)
+ this._selectedScopeBarItem = scopeBarItem;
+ else if (scopeBarItem.selected) {
+ // Only one selected item is allowed at a time.
+ // Deselect any other items after the first.
+ scopeBarItem.selected = false;
+ }
+
+ scopeBarItem.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+
+ this._selectElement.appendChild(createOption(scopeBarItem));
+ }
+
+ this._lastSelectedScopeBarItem = this._selectedScopeBarItem || this._scopeBarItems[0] || null;
+ this._titleElement.textContent = this._lastSelectedScopeBarItem ? this._lastSelectedScopeBarItem.label : "";
+
+ this._element.classList.toggle("selected", !!this._selectedScopeBarItem);
+ this._selectElement.selectedIndex = this._scopeBarItems.indexOf(this._selectedScopeBarItem);
+ }
+
+ get selected()
+ {
+ return !!this._selectedScopeBarItem;
+ }
+
+ set selected(selected)
+ {
+ this.selectedScopeBarItem = selected ? this._lastSelectedScopeBarItem : null;
+ }
+
+ get selectedScopeBarItem()
+ {
+ return this._selectedScopeBarItem;
+ }
+
+ set selectedScopeBarItem(selectedScopeBarItem)
+ {
+ this._ignoreItemSelectedEvent = true;
+
+ if (this._selectedScopeBarItem) {
+ this._selectedScopeBarItem.selected = false;
+ this._lastSelectedScopeBarItem = this._selectedScopeBarItem;
+ } else if (!this._lastSelectedScopeBarItem)
+ this._lastSelectedScopeBarItem = selectedScopeBarItem;
+
+ this._element.classList.toggle("selected", !!selectedScopeBarItem);
+ this._selectedScopeBarItem = selectedScopeBarItem || null;
+ this._selectElement.selectedIndex = this._scopeBarItems.indexOf(this._selectedScopeBarItem);
+
+ if (this._selectedScopeBarItem) {
+ this._titleElement.textContent = this._selectedScopeBarItem.label;
+ this._selectedScopeBarItem.selected = true;
+ }
+
+ var withModifier = WebInspector.modifierKeys.metaKey && !WebInspector.modifierKeys.ctrlKey && !WebInspector.modifierKeys.altKey && !WebInspector.modifierKeys.shiftKey;
+ this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged, {withModifier});
+
+ this._ignoreItemSelectedEvent = false;
+ }
+
+ // Private
+
+ _clicked(event)
+ {
+ // Only support click to select when the item is not selected yet.
+ // Clicking when selected will cause the menu it appear instead.
+ if (this._element.classList.contains("selected"))
+ return;
+ this.selected = true;
+ }
+
+ _selectElementSelectionChanged(event)
+ {
+ this.selectedScopeBarItem = this._scopeBarItems[this._selectElement.selectedIndex];
+ }
+
+ _itemSelectionDidChange(event)
+ {
+ if (this._ignoreItemSelectedEvent)
+ return;
+ this.selectedScopeBarItem = event.target.selected ? event.target : null;
+ }
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNavigationSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -306,13 +306,14 @@
</span><span class="cx">
</span><span class="cx"> matchTreeElementAgainstFilterFunctions(treeElement)
</span><span class="cx"> {
</span><del>- if (!this._filterFunctions.length)
</del><ins>+ if (!this._filterFunctions || !this._filterFunctions.length)
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> for (var filterFunction of this._filterFunctions) {
</span><span class="cx"> if (filterFunction(treeElement))
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -333,7 +334,7 @@
</span><span class="cx">
</span><span class="cx"> var filterableData = treeElement.filterableData || {};
</span><span class="cx">
</span><del>- var matchedBuiltInFilters = false;
</del><ins>+ var flags = {expandTreeElement: false};
</ins><span class="cx">
</span><span class="cx"> var self = this;
</span><span class="cx"> function matchTextFilter(inputs)
</span><span class="lines">@@ -350,7 +351,7 @@
</span><span class="cx"> if (!input)
</span><span class="cx"> continue;
</span><span class="cx"> if (self._textFilterRegex.test(input)) {
</span><del>- matchedBuiltInFilters = true;
</del><ins>+ flags.expandTreeElement = true;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -370,7 +371,7 @@
</span><span class="cx"> currentAncestor.hidden = false;
</span><span class="cx">
</span><span class="cx"> // Only expand if the built-in filters matched, not custom filters.
</span><del>- if (matchedBuiltInFilters && !currentAncestor.expanded) {
</del><ins>+ if (flags.expandTreeElement && !currentAncestor.expanded) {
</ins><span class="cx"> currentAncestor.__wasExpandedDuringFiltering = true;
</span><span class="cx"> currentAncestor.expand();
</span><span class="cx"> }
</span><span class="lines">@@ -379,12 +380,12 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (matchTextFilter(filterableData.text) && this.matchTreeElementAgainstFilterFunctions(treeElement) && this.matchTreeElementAgainstCustomFilters(treeElement)) {
</del><ins>+ if (matchTextFilter(filterableData.text) && this.matchTreeElementAgainstFilterFunctions(treeElement, flags) && this.matchTreeElementAgainstCustomFilters(treeElement, flags)) {
</ins><span class="cx"> // Make this element visible since it matches.
</span><span class="cx"> makeVisible();
</span><span class="cx">
</span><span class="cx"> // If this tree element didn't match a built-in filter and was expanded earlier during filtering, collapse it again.
</span><del>- if (!matchedBuiltInFilters && treeElement.expanded && treeElement.__wasExpandedDuringFiltering) {
</del><ins>+ if (!flags.expandTreeElement && treeElement.expanded && treeElement.__wasExpandedDuringFiltering) {
</ins><span class="cx"> delete treeElement.__wasExpandedDuringFiltering;
</span><span class="cx"> treeElement.collapse();
</span><span class="cx"> }
</span><span class="lines">@@ -519,7 +520,7 @@
</span><span class="cx">
</span><span class="cx"> // Don't populate if we don't have any active filters.
</span><span class="cx"> // We only need to populate when a filter needs to reveal.
</span><del>- var dontPopulate = !this._filterBar.hasActiveFilters();
</del><ins>+ var dontPopulate = !this._filterBar.hasActiveFilters() && !this.hasCustomFilters();
</ins><span class="cx">
</span><span class="cx"> // Update the whole tree.
</span><span class="cx"> var currentTreeElement = this._contentTreeOutline.children[0];
</span><span class="lines">@@ -544,7 +545,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Don't populate if we don't have any active filters.
</span><span class="cx"> // We only need to populate when a filter needs to reveal.
</span><del>- var dontPopulate = !this._filterBar.hasActiveFilters();
</del><ins>+ var dontPopulate = !this._filterBar.hasActiveFilters() && !this.hasCustomFilters();
</ins><span class="cx">
</span><span class="cx"> // Apply the filters to the tree element and its descendants.
</span><span class="cx"> var currentTreeElement = treeElement;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPanelcssfromrev185042trunkSourceWebInspectorUIUserInterfaceViewsScopeBarcss"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.css (from rev 185042, trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.css) (0 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.css         (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.css        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * 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.resource > :matches(.content, .empty-content-placeholder) {
+ top: 29px;
+}
+
+.sidebar > .panel.navigation.resource > .navigation-bar {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -33,6 +33,26 @@
</span><span class="cx">
</span><span class="cx"> this.filterBar.placeholder = WebInspector.UIString("Filter Resource List");
</span><span class="cx">
</span><ins>+ this._navigationBar = new WebInspector.NavigationBar;
+ this.element.appendChild(this._navigationBar.element);
+
+ var scopeItemPrefix = "resource-sidebar-";
+ var scopeBarItems = [];
+
+ scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix + "type-all", WebInspector.UIString("All Resources"), true));
+
+ for (var key in WebInspector.Resource.Type) {
+ var value = WebInspector.Resource.Type[key];
+ var scopeBarItem = new WebInspector.ScopeBarItem(scopeItemPrefix + value, WebInspector.Resource.displayNameForType(value, true));
+ scopeBarItem.__resourceType = value;
+ scopeBarItems.push(scopeBarItem);
+ }
+
+ this._scopeBar = new WebInspector.ScopeBar("resource-sidebar-scope-bar", scopeBarItems, scopeBarItems[0], true);
+ this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged, this._scopeBarSelectionDidChange, this);
+
+ this._navigationBar.addNavigationItem(this._scopeBar);
+
</ins><span class="cx"> WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
</span><span class="cx">
</span><span class="cx"> WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange, this._mainFrameDidChange, this);
</span><span class="lines">@@ -152,6 +172,49 @@
</span><span class="cx"> return scriptTreeElement;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // 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 Resources" 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()
+ {
+ if (treeElement instanceof WebInspector.FrameTreeElement)
+ return selectedScopeBarItem.__resourceType === WebInspector.Resource.Type.Document;
+
+ if (treeElement instanceof WebInspector.ScriptTreeElement)
+ return selectedScopeBarItem.__resourceType === WebInspector.Resource.Type.Script;
+
+ console.assert(treeElement instanceof WebInspector.ResourceTreeElement, "Unknown treeElement", treeElement);
+ if (!(treeElement instanceof WebInspector.ResourceTreeElement))
+ return false;
+
+ return treeElement.resource.type === selectedScopeBarItem.__resourceType;
+ }
+
+ var matched = match();
+ if (matched)
+ flags.expandTreeElement = true;
+ return matched;
+ }
+
</ins><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _mainResourceDidChange(event)
</span><span class="lines">@@ -299,4 +362,9 @@
</span><span class="cx"> if (WebInspector.debuggableType === WebInspector.DebuggableType.JavaScript)
</span><span class="cx"> this.contentTreeOutline.element.classList.remove(WebInspector.NavigationSidebarPanel.HideDisclosureButtonsStyleClassName);
</span><span class="cx"> }
</span><ins>+
+ _scopeBarSelectionDidChange(event)
+ {
+ this.updateFilter();
+ }
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScopeBarcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.css (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.css        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.css        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -41,6 +41,44 @@
</span><span class="cx"> text-align: center;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.scope-bar > li.multiple {
+ position: relative;
+}
+
+.scope-bar > li.multiple > select {
+ display: none;
+ opacity: 0;
+
+ /* Positioned so the text in the menu aligns with the content text. */
+ position: absolute;
+ top: -5px;
+ left: -4px;
+ right: 0;
+ bottom: 0;
+}
+
+.scope-bar > li.multiple.selected > select {
+ display: block;
+}
+
+.scope-bar > li.multiple > .arrows {
+ width: 5px;
+ height: 12px;
+ display: inline-block;
+ vertical-align: -2px;
+ margin-left: 6px;
+ margin-top: -1px;
+ margin-bottom: -1px;
+}
+
+.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .filled {
+ fill: white !important;
+}
+
+.scope-bar > li.multiple:matches(.selected, :hover, :active) > .arrows svg .stroked {
+ stroke: white !important;
+}
+
</ins><span class="cx"> .scope-bar > li:matches(.selected, :active) {
</span><span class="cx"> transition-duration: 75ms;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScopeBarjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBar.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.ScopeBar = class ScopeBar extends WebInspector.NavigationItem
</span><span class="cx"> {
</span><del>- constructor(identifier, items, defaultItem)
</del><ins>+ constructor(identifier, items, defaultItem, shouldGroupNonExclusiveItems)
</ins><span class="cx"> {
</span><span class="cx"> super(identifier);
</span><span class="cx">
</span><span class="lines">@@ -33,8 +33,8 @@
</span><span class="cx">
</span><span class="cx"> this._items = items;
</span><span class="cx"> this._defaultItem = defaultItem;
</span><ins>+ this._shouldGroupNonExclusiveItems = shouldGroupNonExclusiveItems || false;
</ins><span class="cx">
</span><del>- this._itemsById = [];
</del><span class="cx"> this._populate();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">
</span><span class="cx"> item(id)
</span><span class="cx"> {
</span><del>- return this._itemsById[id];
</del><ins>+ return this._itemsById.get(id);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get selectedItems()
</span><span class="lines">@@ -64,38 +64,35 @@
</span><span class="cx"> }, this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- updateLayout(expandOnly)
</del><ins>+ // Private
+
+ _populate()
</ins><span class="cx"> {
</span><del>- if (expandOnly)
- return;
</del><ins>+ this._itemsById = new Map;
</ins><span class="cx">
</span><del>- for (var i = 0; i < this._items.length; ++i) {
- var item = this._items[i];
- var isSelected = item.selected;
</del><ins>+ if (this._shouldGroupNonExclusiveItems) {
+ var nonExclusiveItems = [];
</ins><span class="cx">
</span><del>- if (!isSelected)
- item.element.classList.add(WebInspector.ScopeBarItem.SelectedStyleClassName);
</del><ins>+ for (var item of this._items) {
+ this._itemsById.set(item.id, item);
</ins><span class="cx">
</span><del>- var selectedWidth = item.element.offsetWidth;
- if (selectedWidth)
- item.element.style.minWidth = selectedWidth + "px";
</del><ins>+ if (item.exclusive)
+ this._element.appendChild(item.element);
+ else
+ nonExclusiveItems.push(item);
</ins><span class="cx">
</span><del>- if (!isSelected)
- item.element.classList.remove(WebInspector.ScopeBarItem.SelectedStyleClassName);
- }
- }
</del><ins>+ item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+ }
</ins><span class="cx">
</span><del>- // Private
</del><ins>+ this._multipleItem = new WebInspector.MultipleScopeBarItem(nonExclusiveItems);
+ this._element.appendChild(this._multipleItem.element);
+ } else {
+ for (var item of this._items) {
+ this._itemsById.set(item.id, item);
+ this._element.appendChild(item.element);
</ins><span class="cx">
</span><del>- _populate()
- {
- var item;
- for (var i = 0; i < this._items.length; ++i) {
- item = this._items[i];
- this._itemsById[item.id] = item;
- this._element.appendChild(item.element);
-
- item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
</del><ins>+ item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged, this._itemSelectionDidChange, this);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!this.selectedItems.length && this._defaultItem)
</span><span class="lines">@@ -108,17 +105,17 @@
</span><span class="cx"> var item;
</span><span class="cx">
</span><span class="cx"> // An exclusive item was selected, unselect everything else.
</span><del>- if (sender.isExclusive && sender.selected) {
</del><ins>+ if (sender.exclusive && sender.selected) {
</ins><span class="cx"> for (var i = 0; i < this._items.length; ++i) {
</span><span class="cx"> item = this._items[i];
</span><span class="cx"> if (item !== sender)
</span><span class="cx"> item.selected = false;
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><del>- var replacesCurrentSelection = !event.data.withModifier;
</del><ins>+ var replacesCurrentSelection = this._shouldGroupNonExclusiveItems || !event.data.withModifier;
</ins><span class="cx"> for (var i = 0; i < this._items.length; ++i) {
</span><span class="cx"> item = this._items[i];
</span><del>- if (item.isExclusive && item !== sender && sender.selected)
</del><ins>+ if (item.exclusive && item !== sender && sender.selected)
</ins><span class="cx"> item.selected = false;
</span><span class="cx"> else if (sender.selected && replacesCurrentSelection && sender !== item)
</span><span class="cx"> item.selected = false;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScopeBarItemjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js (185043 => 185044)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js        2015-05-31 19:21:20 UTC (rev 185043)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeBarItem.js        2015-05-31 19:50:16 UTC (rev 185044)
</span><span class="lines">@@ -25,31 +25,46 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.ScopeBarItem = class ScopeBarItem extends WebInspector.Object
</span><span class="cx"> {
</span><del>- constructor(id, label, isExclusive)
</del><ins>+ constructor(id, label, exclusive)
</ins><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx">
</span><del>- this.id = id;
- this.label = label;
- this.isExclusive = isExclusive;
</del><ins>+ this._element = document.createElement("li");
+ this._element.classList.toggle("exclusive", exclusive);
+ this._element.textContent = label;
+ this._element.addEventListener("click", this._clicked.bind(this));
</ins><span class="cx">
</span><ins>+ this._id = id;
+ this._label = label;
+ this._exclusive = exclusive;
+
</ins><span class="cx"> this._selectedSetting = new WebInspector.Setting("scopebaritem-" + id, false);
</span><span class="cx">
</span><del>- this._markElementSelected(this._selectedSetting.value);
</del><ins>+ this._element.classList.toggle("selected", this._selectedSetting.value);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><span class="cx"> get element()
</span><span class="cx"> {
</span><del>- if (!this._element) {
- this._element = document.createElement("li");
- this._element.textContent = this.label;
- this._element.addEventListener("click", this._clicked.bind(this), false);
- }
</del><span class="cx"> return this._element;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ get id()
+ {
+ return this._id;
+ }
+
+ get label()
+ {
+ return this._label;
+ }
+
+ get exclusive()
+ {
+ return this._exclusive;
+ }
+
</ins><span class="cx"> get selected()
</span><span class="cx"> {
</span><span class="cx"> return this._selectedSetting.value;
</span><span class="lines">@@ -65,8 +80,7 @@
</span><span class="cx"> if (this._selectedSetting.value === selected)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- this._markElementSelected(selected);
-
</del><ins>+ this._element.classList.toggle("selected", selected);
</ins><span class="cx"> this._selectedSetting.value = selected;
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged, {withModifier});
</span><span class="lines">@@ -74,23 +88,12 @@
</span><span class="cx">
</span><span class="cx"> // Private
</span><span class="cx">
</span><del>- _markElementSelected(selected)
- {
- if (selected)
- this.element.classList.add(WebInspector.ScopeBarItem.SelectedStyleClassName);
- else
- this.element.classList.remove(WebInspector.ScopeBarItem.SelectedStyleClassName);
- }
-
</del><span class="cx"> _clicked(event)
</span><span class="cx"> {
</span><del>- var withModifier = (event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey);
- this.setSelected(!this.selected, withModifier);
</del><ins>+ this.setSelected(!this.selected, event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey);
</ins><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector.ScopeBarItem.SelectedStyleClassName = "selected";
-
</del><span class="cx"> WebInspector.ScopeBarItem.Event = {
</span><span class="cx"> SelectionChanged: "scope-bar-item-selection-did-change"
</span><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>