Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (172419 => 172420)
--- trunk/Source/WebInspectorUI/ChangeLog 2014-08-11 23:40:52 UTC (rev 172419)
+++ trunk/Source/WebInspectorUI/ChangeLog 2014-08-11 23:41:15 UTC (rev 172420)
@@ -1,3 +1,42 @@
+2014-08-11 Brian J. Burg <[email protected]>
+
+ Web Inspector: show a replay dashboard when capturing or replaying
+ https://bugs.webkit.org/show_bug.cgi?id=135170
+
+ Reviewed by Timothy Hatcher.
+
+ This patch adds a replay dashboard with record/play/pause buttons. It
+ is shown automatically when the user starts capturing an execution from
+ the replay menu in the Timelines sidebar panel.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.loaded):
+ (WebInspector._captureDidStart):
+ * UserInterface/Controllers/DashboardManager.js:
+ (WebInspector.DashboardManager):
+ * UserInterface/Images/ReplayPauseButton.svg: Added.
+ * UserInterface/Images/ReplayPlayButton.svg: Added.
+ * UserInterface/Images/ReplayRecordingButton.svg: Added.
+ * UserInterface/Main.html:
+ * UserInterface/Models/ReplayDashboard.js: Copied from Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js.
+ (WebInspector.ReplayDashboard):
+ * UserInterface/Views/DashboardView.js:
+ (WebInspector.DashboardView):
+ * UserInterface/Views/ReplayDashboardView.css: Copied from Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js.
+ (.toolbar .dashboard.replay):
+ (.toolbar .dashboard.replay div.navigation-bar):
+ (.toolbar .dashboard.replay .item.button > .glyph):
+ (.toolbar.label-only .dashboard.replay .item.button > .glyph):
+ * UserInterface/Views/ReplayDashboardView.js: Added.
+ (WebInspector.ReplayDashboardView):
+ (WebInspector.ReplayDashboardView.prototype._captureButtonItemClicked):
+ (WebInspector.ReplayDashboardView.prototype._replayButtonItemClicked):
+ (WebInspector.ReplayDashboardView.prototype._captureStarted):
+ (WebInspector.ReplayDashboardView.prototype._captureStopped):
+ (WebInspector.ReplayDashboardView.prototype._playbackStarted):
+ (WebInspector.ReplayDashboardView.prototype._playbackPaused):
+ (WebInspector.ReplayDashboardView.prototype._playbackFinished):
+
2014-08-08 Brian J. Burg <[email protected]>
Web Inspector: DebuggerManager commands should return promises
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (172419 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2014-08-11 23:40:52 UTC (rev 172419)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2014-08-11 23:41:15 UTC (rev 172420)
@@ -124,6 +124,7 @@
ConsoleAgent.enable();
// Register for events.
+ this.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStarted, this._captureDidStart, this);
this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.InspectModeStateChanged, this._inspectModeStateChanged, this);
@@ -742,6 +743,11 @@
event.preventDefault();
}
+WebInspector._captureDidStart = function(event)
+{
+ this.dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.replay);
+}
+
WebInspector._debuggerDidPause = function(event)
{
this.debuggerSidebarPanel.show();
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js (172419 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js 2014-08-11 23:40:52 UTC (rev 172419)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js 2014-08-11 23:41:15 UTC (rev 172420)
@@ -29,6 +29,7 @@
this._dashboards = {};
this._dashboards.default = new WebInspector.DefaultDashboard;
this._dashboards.debugger = new WebInspector.DebuggerDashboard;
+ this._dashboards.replay = new WebInspector.ReplayDashboard;
};
WebInspector.DashboardManager.prototype = {
Added: trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPauseButton.svg (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPauseButton.svg (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPauseButton.svg 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="36px" height="36px" viewBox="0 0 36 36" enable-background="" 0 0 36 36" xml:space="preserve">
+<g>
+ <rect x="5.656" y="4.202" width="9.255" height="27.597"/>
+ <rect x="21.09" y="4.202" width="9.254" height="27.597"/>
+</g>
+</svg>
Added: trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPlayButton.svg (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPlayButton.svg (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/ReplayPlayButton.svg 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="36px" height="36px" viewBox="0 0 36 36" enable-background="" 0 0 36 36" xml:space="preserve">
+<polygon fill="#38AF4A" points="5.625,4.21 30.375,18 5.625,31.79 "/>
+</svg>
Added: trunk/Source/WebInspectorUI/UserInterface/Images/ReplayRecordingButton.svg (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Images/ReplayRecordingButton.svg (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/ReplayRecordingButton.svg 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+ width="36px" height="36px" viewBox="0 0 36 36" enable-background="" 0 0 36 36" xml:space="preserve">
+<circle fill="#EE2D24" cx="18" cy="18" r="13.605"/>
+</svg>
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (172419 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2014-08-11 23:40:52 UTC (rev 172419)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2014-08-11 23:41:15 UTC (rev 172420)
@@ -106,6 +106,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=""
@@ -249,6 +250,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
@@ -420,6 +422,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
Copied: trunk/Source/WebInspectorUI/UserInterface/Models/ReplayDashboard.js (from rev 172418, trunk/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js) (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Models/ReplayDashboard.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ReplayDashboard.js 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2014 University of Washington. 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.ReplayDashboard = function() {
+ WebInspector.Object.call(this);
+};
+
+WebInspector.ReplayDashboard.prototype = {
+ constructor: WebInspector.ReplayDashboard,
+ __proto__: WebInspector.Object.prototype,
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DashboardView.js (172419 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DashboardView.js 2014-08-11 23:40:52 UTC (rev 172419)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DashboardView.js 2014-08-11 23:41:15 UTC (rev 172420)
@@ -35,6 +35,9 @@
if (representedObject instanceof WebInspector.DebuggerDashboard)
return new WebInspector.DebuggerDashboardView(representedObject);
+ if (representedObject instanceof WebInspector.ReplayDashboard)
+ return new WebInspector.ReplayDashboardView(representedObject);
+
throw "Can't make a DashboardView for an unknown representedObject.";
}
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.css (from rev 172418, trunk/Source/WebInspectorUI/UserInterface/Controllers/DashboardManager.js) (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.css (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.css 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2014 University of Washington. 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.
+ */
+.toolbar .dashboard.replay {
+ display: -webkit-flex;
+ -webkit-flex-wrap: nowrap;
+ -webkit-justify-content: center;
+ -webkit-align-items: center;
+
+ text-align: center;
+ text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0;
+ color: rgb(60, 60, 60);
+ padding: 0 5px;
+}
+
+.toolbar .dashboard.replay div.navigation-bar {
+ border-bottom: none !important;
+}
+
+.toolbar .dashboard.replay .item.button > .glyph {
+ /* ButtonNavigationItem is not aware of alternate button sizes, so override here. */
+ width: 16px !important;
+ height: 16px !important;
+}
+
+.toolbar.label-only .dashboard.replay .item.button > .glyph {
+ /* The default styles here will try to elide buttons in label-only mode. */
+ display: -webkit-flex !important;
+
+ /* ButtonNavigationItem is not aware of alternate button sizes, so override here. */
+ width: 14px !important;
+ height: 14px !important;
+}
+
Added: trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js (0 => 172420)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ReplayDashboardView.js 2014-08-11 23:41:15 UTC (rev 172420)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2014 University of Washington. 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.ReplayDashboardView = function(representedObject)
+{
+ WebInspector.DashboardView.call(this, representedObject, "replay");
+
+ this._navigationBar = new WebInspector.NavigationBar;
+ this.element.appendChild(this._navigationBar.element);
+
+ replayManager = WebInspector.replayManager;
+
+ this._captureButtonItem = new WebInspector.ActivateButtonNavigationItem("replay-dashboard-capture", WebInspector.UIString("Start Recording"), WebInspector.UIString("Stop Recording"), "Images/ReplayRecordingButton.svg", 16, 16);
+ this._captureButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._captureButtonItemClicked, this);
+ this._captureButtonItem.hidden = true;
+ this._navigationBar.addNavigationItem(this._captureButtonItem);
+
+ this._replayButtonItem = new WebInspector.ToggleButtonNavigationItem("replay-dashboard-replay", WebInspector.UIString("Start Playback"), WebInspector.UIString("Pause Playback"), "Images/ReplayPlayButton.svg", "Images/ReplayPauseButton.svg", 16, 16);
+ this._replayButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._replayButtonItemClicked, this);
+ this._replayButtonItem.hidden = true;
+ this._navigationBar.addNavigationItem(this._replayButtonItem);
+
+ // Add events required to track capture and replay state.
+ WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStarted, this._captureStarted, this);
+ WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.CaptureStopped, this._captureStopped, this);
+ WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackStarted, this._playbackStarted, this);
+ WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackPaused, this._playbackPaused, this);
+ WebInspector.replayManager.addEventListener(WebInspector.ReplayManager.Event.PlaybackFinished, this._playbackFinished, this);
+
+ // Manually initialize style classes by querying current replay state.
+ if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Capturing)
+ this._captureStarted();
+ else if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
+ this._captureStopped();
+ // ReplayManager.sessionState must be Replaying.
+ else if (WebInspector.replayManager.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching)
+ this._playbackStarted();
+ // ReplayManager.sessionState must be Unloaded or Loaded, so execution is paused.
+ else
+ this._playbackPaused();
+};
+
+// Class names for top-level flex items within the replay dashboard.
+WebInspector.ReplayDashboardView.RecordingContainerStyleClassName = "recording-container";
+
+// Class names for single buttons.
+WebInspector.ReplayDashboardView.RecordButtonStyleClassName = "record-button";
+WebInspector.ReplayDashboardView.ReplayButtonStyleClassName = "replay-button";
+
+WebInspector.ReplayDashboardView.prototype = {
+ constructor: WebInspector.ReplayDashboardView,
+ __proto__: WebInspector.DashboardView.prototype,
+
+ // Private
+
+ _captureButtonItemClicked: function()
+ {
+ if (WebInspector.replayManager.sessionState !== WebInspector.ReplayManager.SessionState.Capturing)
+ WebInspector.replayManager.startCapturing();
+ else
+ WebInspector.replayManager.stopCapturing();
+ },
+
+ _replayButtonItemClicked: function(event)
+ {
+ console.assert(WebInspector.replayManager.sessionState !== WebInspector.ReplayManager.SessionState.Capturing, "Tried to start replaying while SessionState is Capturing!");
+
+ if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Inactive)
+ WebInspector.replayManager.replayToCompletion();
+ else if (WebInspector.replayManager.segmentState === WebInspector.ReplayManager.SegmentState.Dispatching)
+ WebInspector.replayManager.pausePlayback();
+ else
+ WebInspector.replayManager.replayToCompletion();
+ },
+
+ _captureStarted: function()
+ {
+ this._captureButtonItem.hidden = false;
+ this._captureButtonItem.activated = true;
+ this._replayButtonItem.hidden = true;
+ },
+
+ _captureStopped: function()
+ {
+ this._captureButtonItem.activated = false;
+ this._captureButtonItem.hidden = true;
+ this._replayButtonItem.hidden = false;
+ },
+
+ _playbackStarted: function()
+ {
+ this._replayButtonItem.toggled = true;
+ },
+
+ _playbackPaused: function()
+ {
+ this._replayButtonItem.toggled = false;
+ },
+
+ _playbackFinished: function()
+ {
+ this._replayButtonItem.toggled = false;
+ }
+};