Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (183331 => 183332)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-04-26 01:21:38 UTC (rev 183332)
@@ -1,5 +1,44 @@
2015-04-23 Timothy Hatcher <[email protected]>
+ Web Inspector: Make Console work in a tab world
+ https://bugs.webkit.org/show_bug.cgi?id=144112
+
+ Reviewed by Joseph Pecoraro.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.contentLoaded):
+ (WebInspector.isShowingConsoleTab):
+ (WebInspector.UIString):
+ (WebInspector.toggleNavigationSidebar):
+ (WebInspector.toggleDetailsSidebar):
+ (WebInspector.tabContentViewClassForRepresentedObject):
+ (WebInspector.linkifyStringAsFragment):
+ * UserInterface/Images/Console.svg: Added.
+ * UserInterface/Protocol/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.showConsole):
+ * UserInterface/Views/ConsoleTabContentView.js: Added.
+ (WebInspector.ConsoleTabContentView):
+ (WebInspector.ConsoleTabContentView.prototype.shown):
+ (WebInspector.ConsoleTabContentView.prototype.showRepresentedObject):
+ (WebInspector.ConsoleTabContentView.prototype.canShowRepresentedObject):
+ (WebInspector.ConsoleTabContentView.prototype.get supportsSplitContentBrowser):
+ * UserInterface/Views/DefaultDashboardView.js:
+ (WebInspector.DefaultDashboardView.prototype._consoleItemWasClicked):
+ * UserInterface/Views/LogContentView.js:
+ (WebInspector.LogContentView):
+ (WebInspector.LogContentView.prototype.get navigationItems):
+ (WebInspector.LogContentView.prototype.shown):
+ (WebInspector.LogContentView.prototype.didAppendConsoleMessageView):
+ (WebInspector.LogContentView.prototype._showConsoleTab):
+ * UserInterface/Views/LogIcon.css:
+ (.log-icon .icon):
+ * UserInterface/Views/Main.css:
+ (#split-content-browser .hierarchical-path-component.log-icon .icon):
+ (#split-content-browser .hierarchical-path-component.log-icon .title):
+ (#split-content-browser .hierarchical-path-component.log-icon select):
+
+2015-04-23 Timothy Hatcher <[email protected]>
+
Web Inspector: Make showing a content view work in the tab world
https://bugs.webkit.org/show_bug.cgi?id=144110
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2015-04-26 01:21:38 UTC (rev 183332)
@@ -227,7 +227,7 @@
this._consoleRepresentedObject = new WebInspector.LogObject;
this._consoleTreeElement = new WebInspector.LogTreeElement(this._consoleRepresentedObject);
- this.consoleContentView = WebInspector.contentBrowser.contentViewForRepresentedObject(this._consoleRepresentedObject);
+ this.consoleContentView = WebInspector.splitContentBrowser.contentViewForRepresentedObject(this._consoleRepresentedObject);
this.consoleLogViewController = this.consoleContentView.logViewController;
// FIXME: The sidebars should be flipped in RTL languages.
@@ -250,7 +250,7 @@
this._reloadPageKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
this._reloadPageIgnoringCacheKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "R", this._reloadPageIgnoringCache.bind(this));
- this._consoleKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "C", this.toggleConsoleView.bind(this));
+ this._consoleKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "C", this._showConsoleTab.bind(this));
this._inspectModeKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "C", this._toggleInspectMode.bind(this));
@@ -427,12 +427,8 @@
WebInspector.contentBrowserTreeElementForRepresentedObject = function(contentBrowser, representedObject)
{
// The console does not have a sidebar, so return a tree element here so something is shown.
- if (representedObject instanceof WebInspector.LogObject)
+ if (representedObject === this._consoleRepresentedObject)
return this._consoleTreeElement;
-
- var sidebarPanel = this.sidebarPanelForRepresentedObject(representedObject);
- if (sidebarPanel)
- return sidebarPanel.treeElementForRepresentedObject(representedObject);
return null;
};
@@ -575,16 +571,16 @@
return !this.splitContentBrowser.element.classList.contains("hidden");
};
-WebInspector.currentViewSupportsSplitContentBrowser = function()
+WebInspector.doesCurrentTabSupportSplitContentBrowser = function()
{
- var currentContentView = this.contentBrowser.currentContentView;
+ var currentContentView = this.tabBrowser.selectedTabContentView;
return !currentContentView || currentContentView.supportsSplitContentBrowser;
};
WebInspector.toggleSplitConsole = function()
{
- if (!this.currentViewSupportsSplitContentBrowser()) {
- this.toggleConsoleView();
+ if (!this.doesCurrentTabSupportSplitContentBrowser()) {
+ this.showConsoleTab();
return;
}
@@ -596,8 +592,8 @@
WebInspector.showSplitConsole = function()
{
- if (!this.currentViewSupportsSplitContentBrowser()) {
- this.showFullHeightConsole();
+ if (!this.doesCurrentTabSupportSplitContentBrowser()) {
+ this.showConsoleTab();
return;
}
@@ -606,18 +602,14 @@
this._showingSplitConsoleSetting.value = true;
if (this.splitContentBrowser.currentContentView !== this.consoleContentView) {
- var wasShowingFullConsole = this.isShowingConsoleView();
-
- // Be sure to close any existing log view in the main content browser before showing it in the
+ // Be sure to close the view in the tab content browser before showing it in the
// split content browser. We can only show a content view in one browser at a time.
- this.contentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.LogContentView);
+ if (this.consoleContentView.parentContainer)
+ this.consoleContentView.parentContainer.closeContentView(this.consoleContentView);
this.splitContentBrowser.showContentView(this.consoleContentView);
-
- if (wasShowingFullConsole && !this.contentBrowser.currentContentView)
- this.resourceSidebarPanel.showDefaultContentView();
} else {
// This causes the view to know it was shown and focus the prompt.
- this.splitContentBrowser.contentViewContainer.shown();
+ this.splitContentBrowser.shown();
}
this.quickConsole.consoleLogVisibilityChanged(true);
@@ -625,65 +617,42 @@
WebInspector.hideSplitConsole = function()
{
+ if (!this.isShowingSplitConsole())
+ return;
+
this.splitContentBrowser.element.classList.add("hidden");
this._showingSplitConsoleSetting.value = false;
// This causes the view to know it was hidden.
- this.splitContentBrowser.contentViewContainer.hidden();
+ this.splitContentBrowser.hidden();
this.quickConsole.consoleLogVisibilityChanged(false);
};
-WebInspector.showFullHeightConsole = function(requestedScope)
+WebInspector.showConsoleTab = function(requestedScope)
{
- this.splitContentBrowser.element.classList.add("hidden");
+ this.hideSplitConsole();
- this._showingSplitConsoleSetting.value = false;
-
var scope = requestedScope || WebInspector.LogContentView.Scopes.All;
// If the requested scope is already selected and the console is showing, then switch back to All.
- if (this.isShowingConsoleView() && this.consoleContentView.scopeBar.item(scope).selected)
+ if (this.isShowingConsoleTab() && this.consoleContentView.scopeBar.item(scope).selected)
scope = WebInspector.LogContentView.Scopes.All;
if (requestedScope || !this.consoleContentView.scopeBar.selectedItems.length)
this.consoleContentView.scopeBar.item(scope).selected = true;
- if (!this.contentBrowser.currentContentView || this.contentBrowser.currentContentView !== this.consoleContentView) {
- // Be sure to close any existing log view in the split content browser before showing it in the
- // main content browser. We can only show a content view in one browser at a time.
- this.splitContentBrowser.contentViewContainer.closeAllContentViewsOfPrototype(WebInspector.LogContentView);
- this.contentBrowser.showContentView(this.consoleContentView);
- }
+ this.showRepresentedObject(this._consoleRepresentedObject);
- console.assert(this.isShowingConsoleView());
- console.assert(this._consoleToolbarButton.activated);
-
- this.quickConsole.consoleLogVisibilityChanged(true);
+ console.assert(this.isShowingConsoleTab());
};
-WebInspector.isShowingConsoleView = function()
+WebInspector.isShowingConsoleTab = function()
{
- return this.contentBrowser.currentContentView instanceof WebInspector.LogContentView;
+ return this.tabBrowser.selectedTabContentView instanceof WebInspector.ConsoleTabContentView;
};
-WebInspector.showConsoleView = function(scope)
-{
- this.showFullHeightConsole(scope);
-};
-
-WebInspector.toggleConsoleView = function()
-{
- if (this.isShowingConsoleView()) {
- if (this.contentBrowser.canGoBack())
- this.contentBrowser.goBack();
- else
- this.resourceSidebarPanel.showDefaultContentView();
- } else
- this.showFullHeightConsole();
-};
-
WebInspector.UIString = function(string, vararg)
{
if (WebInspector.dontLocalizeUserInterface)
@@ -1661,6 +1630,11 @@
this.domTreeManager.inspectModeEnabled = !this.domTreeManager.inspectModeEnabled;
};
+WebInspector._showConsoleTab = function(event)
+{
+ this.showConsoleTab();
+};
+
WebInspector._focusedContentView = function()
{
if (this.contentBrowser.element.isSelfOrAncestor(this.currentFocusElement))
Added: trunk/Source/WebInspectorUI/UserInterface/Images/Console.svg (0 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Images/Console.svg (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/Console.svg 2015-04-26 01:21:38 UTC (rev 183332)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright © 2015 Apple Inc. All rights reserved. -->
+<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg">
+ <rect x="0.5" y="0.5" width="15" height="15" rx="2" class="stroked" fill="none" stroke="black"/>
+ <path d="M 4 4 L 8 8 L 4 12" class="stroked" fill="none" stroke="black"/>
+ <path d="M 8 4.5 L 12 4.5" class="stroked" fill="none" stroke="black"/>
+ <path d="M 10 8 L 12 8" class="stroked" fill="none" stroke="black"/>
+ <path d="M 8 11.5 L 12 11.5" class="stroked" fill="none" stroke="black"/>
+</svg>
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/InspectorFrontendAPI.js 2015-04-26 01:21:38 UTC (rev 183332)
@@ -63,7 +63,7 @@
showConsole: function()
{
- WebInspector.showConsoleView();
+ WebInspector.showConsoleTab();
WebInspector.quickConsole.prompt.focus();
Added: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js (0 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleTabContentView.js 2015-04-26 01:21:38 UTC (rev 183332)
@@ -0,0 +1,80 @@
+/*
+ * 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.ConsoleTabContentView = function(identifier)
+{
+ var tabBarItem = new WebInspector.TabBarItem("Images/Console.svg", WebInspector.UIString("Console"));
+
+ WebInspector.ContentBrowserTabContentView.call(this, identifier || "console", "console", tabBarItem, null, null, true);
+};
+
+WebInspector.ConsoleTabContentView.prototype = {
+ constructor: WebInspector.ConsoleTabContentView,
+ __proto__: WebInspector.ContentBrowserTabContentView.prototype,
+
+ // Public
+
+ get type()
+ {
+ return WebInspector.ConsoleTabContentView.Type;
+ },
+
+ shown: function()
+ {
+ WebInspector.ContentBrowserTabContentView.prototype.shown.call(this);
+
+ if (this.contentBrowser.currentContentView === WebInspector.consoleContentView)
+ return;
+
+ // Be sure to close the view in the split content browser before showing it in the
+ // tab content browser. We can only show a content view in one browser at a time.
+ if (WebInspector.consoleContentView.parentContainer)
+ WebInspector.consoleContentView.parentContainer.closeContentView(WebInspector.consoleContentView);
+
+ this.contentBrowser.showContentView(WebInspector.consoleContentView);
+
+ console.assert(this.contentBrowser.currentContentView === WebInspector.consoleContentView);
+ },
+
+ showRepresentedObject: function(representedObject, cookie)
+ {
+ // Do nothing. The shown function will handle things. Calling
+ // ContentBrowserTabContentView.shown will cause a new LogContentView
+ // to be created instead of reusing WebInspector.consoleContentView.
+ console.assert(representedObject instanceof WebInspector.LogObject);
+ },
+
+ canShowRepresentedObject: function(representedObject)
+ {
+ return representedObject instanceof WebInspector.LogObject;
+ },
+
+ get supportsSplitContentBrowser()
+ {
+ return false;
+ }
+};
+
+WebInspector.ConsoleTabContentView.Type = "console";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js 2015-04-26 01:21:38 UTC (rev 183332)
@@ -122,7 +122,7 @@
_consoleItemWasClicked(scope)
{
- WebInspector.showConsoleView(scope);
+ WebInspector.showConsoleTab(scope);
}
_setConsoleItemValue(itemName, newValue)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2015-04-26 01:21:38 UTC (rev 183332)
@@ -79,13 +79,10 @@
this._clearLogOnReloadSetting = new WebInspector.Setting("clear-log-on-reload", true);
- var toolTip = WebInspector.UIString("Show split console");
- var altToolTip = WebInspector.UIString("Show full-height console");
+ var toolTip = WebInspector.UIString("Show console tab");
+ this._showConsoleTabNavigationItem = new WebInspector.ButtonNavigationItem("show-tab", toolTip, platformImagePath("SplitToggleUp.svg"), 16, 16);
+ this._showConsoleTabNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._showConsoleTab, this);
- this._toggleSplitNavigationItem = new WebInspector.ToggleButtonNavigationItem("split-toggle", toolTip, altToolTip, platformImagePath("SplitToggleDown.svg"), platformImagePath("SplitToggleUp.svg"), 16, 16);
- this._toggleSplitNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._toggleSplit, this);
- this._toggleSplitNavigationItem.toggled = WebInspector.isShowingSplitConsole();
-
this.messagesElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), false);
WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared, this._sessionsCleared, this);
@@ -118,7 +115,10 @@
get navigationItems()
{
- return [this._searchBar, this._scopeBar, this._clearLogNavigationItem, this._toggleSplitNavigationItem];
+ var navigationItems = [this._searchBar, this._scopeBar, this._clearLogNavigationItem];
+ if (WebInspector.isShowingSplitConsole())
+ navigationItems.push(this._showConsoleTabNavigationItem);
+ return navigationItems;
},
get scopeBar()
@@ -140,8 +140,6 @@
shown: function()
{
- this._toggleSplitNavigationItem.toggled = WebInspector.isShowingSplitConsole();
-
this.prompt.focus();
},
@@ -204,7 +202,7 @@
if (type !== WebInspector.ConsoleMessage.MessageType.Result)
return;
- if (!WebInspector.isShowingConsoleView())
+ if (!WebInspector.isShowingConsoleTab())
WebInspector.showSplitConsole();
this._logViewController.scrollToBottom();
@@ -639,12 +637,9 @@
this._ignoreDidClearMessages = false;
},
- _toggleSplit: function()
+ _showConsoleTab: function()
{
- if (WebInspector.isShowingSplitConsole())
- WebInspector.showFullHeightConsole();
- else
- WebInspector.showSplitConsole();
+ WebInspector.showConsoleTab();
},
_toggleClearLogOnReloadSetting: function()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogIcon.css (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Views/LogIcon.css 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogIcon.css 2015-04-26 01:21:38 UTC (rev 183332)
@@ -24,5 +24,5 @@
*/
.log-icon .icon {
- content: -webkit-image-set(url(../Images/Log.png) 1x, url(../Images/[email protected]) 2x);
+ content: url(../Images/Console.svg);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Main.css (183331 => 183332)
--- trunk/Source/WebInspectorUI/UserInterface/Views/Main.css 2015-04-26 01:20:59 UTC (rev 183331)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Main.css 2015-04-26 01:21:38 UTC (rev 183332)
@@ -174,6 +174,20 @@
cursor: default;
}
+#split-content-browser .hierarchical-path-component.log-icon .icon {
+ margin-left: 6px;
+ margin-right: 6px;
+ opacity: 0.7;
+}
+
+#split-content-browser .hierarchical-path-component.log-icon .title {
+ color: rgba(0, 0, 0, 0.75);
+}
+
+#split-content-browser .hierarchical-path-component.log-icon select {
+ display: none;
+}
+
#details-sidebar {
width: 300px;
}