| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 replayImageParent.createChild("span"); // Helps to align the image verticall
y. | 60 replayImageParent.createChild("span"); // Helps to align the image verticall
y. |
| 61 this._replayImageElement = replayImageParent.createChild("img"); | 61 this._replayImageElement = replayImageParent.createChild("img"); |
| 62 this._debugInfoElement = replayImageContainer.createChild("div", "canvas-deb
ug-info hidden"); | 62 this._debugInfoElement = replayImageContainer.createChild("div", "canvas-deb
ug-info hidden"); |
| 63 this._spinnerIcon = replayImageContainer.createChild("div", "spinner-icon sm
all hidden"); | 63 this._spinnerIcon = replayImageContainer.createChild("div", "spinner-icon sm
all hidden"); |
| 64 | 64 |
| 65 var replayLogContainerView = new WebInspector.VBox(); | 65 var replayLogContainerView = new WebInspector.VBox(); |
| 66 replayLogContainerView.setMinimumSize(22, 22); | 66 replayLogContainerView.setMinimumSize(22, 22); |
| 67 replayLogContainerView.show(this._imageSplitView.sidebarElement()); | 67 replayLogContainerView.show(this._imageSplitView.sidebarElement()); |
| 68 | 68 |
| 69 var replayLogContainer = replayLogContainerView.element; | 69 var replayLogContainer = replayLogContainerView.element; |
| 70 var controlsContainer = replayLogContainer.createChild("div", "status-bar"); | 70 var controlsToolbar = new WebInspector.StatusBar(replayLogContainer); |
| 71 var logGridContainer = replayLogContainer.createChild("div", "canvas-replay-
log"); | 71 var logGridContainer = replayLogContainer.createChild("div", "canvas-replay-
log"); |
| 72 | 72 |
| 73 this._createControlButton(controlsContainer, "canvas-replay-first-step", Web
Inspector.UIString("First call."), this._onReplayFirstStepClick.bind(this)); | 73 this._createControlButton(controlsToolbar, "canvas-replay-first-step", WebIn
spector.UIString("First call."), this._onReplayFirstStepClick.bind(this)); |
| 74 this._createControlButton(controlsContainer, "canvas-replay-prev-step", WebI
nspector.UIString("Previous call."), this._onReplayStepClick.bind(this, false)); | 74 this._createControlButton(controlsToolbar, "canvas-replay-prev-step", WebIns
pector.UIString("Previous call."), this._onReplayStepClick.bind(this, false)); |
| 75 this._createControlButton(controlsContainer, "canvas-replay-next-step", WebI
nspector.UIString("Next call."), this._onReplayStepClick.bind(this, true)); | 75 this._createControlButton(controlsToolbar, "canvas-replay-next-step", WebIns
pector.UIString("Next call."), this._onReplayStepClick.bind(this, true)); |
| 76 this._createControlButton(controlsContainer, "canvas-replay-prev-draw", WebI
nspector.UIString("Previous drawing call."), this._onReplayDrawingCallClick.bind
(this, false)); | 76 this._createControlButton(controlsToolbar, "canvas-replay-prev-draw", WebIns
pector.UIString("Previous drawing call."), this._onReplayDrawingCallClick.bind(t
his, false)); |
| 77 this._createControlButton(controlsContainer, "canvas-replay-next-draw", WebI
nspector.UIString("Next drawing call."), this._onReplayDrawingCallClick.bind(thi
s, true)); | 77 this._createControlButton(controlsToolbar, "canvas-replay-next-draw", WebIns
pector.UIString("Next drawing call."), this._onReplayDrawingCallClick.bind(this,
true)); |
| 78 this._createControlButton(controlsContainer, "canvas-replay-last-step", WebI
nspector.UIString("Last call."), this._onReplayLastStepClick.bind(this)); | 78 this._createControlButton(controlsToolbar, "canvas-replay-last-step", WebIns
pector.UIString("Last call."), this._onReplayLastStepClick.bind(this)); |
| 79 | 79 |
| 80 this._replayContextSelector = new WebInspector.StatusBarComboBox(this._onRep
layContextChanged.bind(this)); | 80 this._replayContextSelector = new WebInspector.StatusBarComboBox(this._onRep
layContextChanged.bind(this)); |
| 81 this._replayContextSelector.createOption(WebInspector.UIString("<screenshot
auto>"), WebInspector.UIString("Show screenshot of the last replayed resource.")
, ""); | 81 this._replayContextSelector.createOption(WebInspector.UIString("<screenshot
auto>"), WebInspector.UIString("Show screenshot of the last replayed resource.")
, ""); |
| 82 controlsContainer.appendChild(this._replayContextSelector.element); | 82 controlsToolbar.appendStatusBarItem(this._replayContextSelector); |
| 83 | 83 |
| 84 this._installReplayInfoSidebarWidgets(controlsContainer); | 84 this._installReplayInfoSidebarWidgets(controlsToolbar); |
| 85 | 85 |
| 86 this._replayStateView = new WebInspector.CanvasReplayStateView(this._traceLo
gPlayer); | 86 this._replayStateView = new WebInspector.CanvasReplayStateView(this._traceLo
gPlayer); |
| 87 this._replayStateView.show(this._replayInfoSplitView.sidebarElement()); | 87 this._replayStateView.show(this._replayInfoSplitView.sidebarElement()); |
| 88 | 88 |
| 89 /** @type {!Object.<string, boolean>} */ | 89 /** @type {!Object.<string, boolean>} */ |
| 90 this._replayContexts = {}; | 90 this._replayContexts = {}; |
| 91 | 91 |
| 92 var columns = [ | 92 var columns = [ |
| 93 {title: "#", sortable: false, width: "5%"}, | 93 {title: "#", sortable: false, width: "5%"}, |
| 94 {title: WebInspector.UIString("Call"), sortable: false, width: "75%", di
sclosure: true}, | 94 {title: WebInspector.UIString("Call"), sortable: false, width: "75%", di
sclosure: true}, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 113 * @type {number} | 113 * @type {number} |
| 114 */ | 114 */ |
| 115 WebInspector.CanvasProfileView.TraceLogPollingInterval = 500; | 115 WebInspector.CanvasProfileView.TraceLogPollingInterval = 500; |
| 116 | 116 |
| 117 WebInspector.CanvasProfileView.prototype = { | 117 WebInspector.CanvasProfileView.prototype = { |
| 118 dispose: function() | 118 dispose: function() |
| 119 { | 119 { |
| 120 this._linkifier.reset(); | 120 this._linkifier.reset(); |
| 121 }, | 121 }, |
| 122 | 122 |
| 123 get statusBarItems() | 123 /** |
| 124 * @return {!Array.<!WebInspector.StatusBarItem>} |
| 125 */ |
| 126 statusBarItems: function() |
| 124 { | 127 { |
| 125 return []; | 128 return []; |
| 126 }, | 129 }, |
| 127 | 130 |
| 128 get profile() | 131 get profile() |
| 129 { | 132 { |
| 130 return this._profile; | 133 return this._profile; |
| 131 }, | 134 }, |
| 132 | 135 |
| 133 _onReplayImageResize: function() | 136 _onReplayImageResize: function() |
| 134 { | 137 { |
| 135 var parent = this._replayImageElement.parentElement; | 138 var parent = this._replayImageElement.parentElement; |
| 136 this._replayImageElement.style.maxWidth = parent.clientWidth + "px"; | 139 this._replayImageElement.style.maxWidth = parent.clientWidth + "px"; |
| 137 this._replayImageElement.style.maxHeight = parent.clientHeight + "px"; | 140 this._replayImageElement.style.maxHeight = parent.clientHeight + "px"; |
| 138 }, | 141 }, |
| 139 | 142 |
| 140 /** | 143 /** |
| 141 * @override | 144 * @override |
| 142 * @return {!Array.<!Element>} | 145 * @return {!Array.<!Element>} |
| 143 */ | 146 */ |
| 144 elementsToRestoreScrollPositionsFor: function() | 147 elementsToRestoreScrollPositionsFor: function() |
| 145 { | 148 { |
| 146 return [this._logGrid.scrollContainer]; | 149 return [this._logGrid.scrollContainer]; |
| 147 }, | 150 }, |
| 148 | 151 |
| 149 /** | 152 /** |
| 150 * @param {!Element} controlsContainer | 153 * @param {!WebInspector.StatusBar} controlsToolbar |
| 151 */ | 154 */ |
| 152 _installReplayInfoSidebarWidgets: function(controlsContainer) | 155 _installReplayInfoSidebarWidgets: function(controlsToolbar) |
| 153 { | 156 { |
| 154 this._replayInfoResizeWidgetElement = controlsContainer.createChild("div
", "resizer-widget"); | 157 this._replayInfoResizeWidgetElement = controlsToolbar.element.createChil
d("div", "resizer-widget"); |
| 155 this._replayInfoSplitView.addEventListener(WebInspector.SplitView.Events
.ShowModeChanged, this._updateReplayInfoResizeWidget, this); | 158 this._replayInfoSplitView.addEventListener(WebInspector.SplitView.Events
.ShowModeChanged, this._updateReplayInfoResizeWidget, this); |
| 156 this._updateReplayInfoResizeWidget(); | 159 this._updateReplayInfoResizeWidget(); |
| 157 this._replayInfoSplitView.installResizer(this._replayInfoResizeWidgetEle
ment); | 160 this._replayInfoSplitView.installResizer(this._replayInfoResizeWidgetEle
ment); |
| 158 | 161 |
| 159 this._toggleReplayStateSidebarButton = this._replayInfoSplitView.createS
howHideSidebarButton("sidebar", "canvas-sidebar-show-hide-button"); | 162 this._toggleReplayStateSidebarButton = this._replayInfoSplitView.createS
howHideSidebarButton("sidebar", "canvas-sidebar-show-hide-button"); |
| 160 | 163 |
| 161 controlsContainer.appendChild(this._toggleReplayStateSidebarButton.eleme
nt); | 164 controlsToolbar.element.appendChild(this._toggleReplayStateSidebarButton
.element); |
| 162 this._replayInfoSplitView.hideSidebar(); | 165 this._replayInfoSplitView.hideSidebar(); |
| 163 }, | 166 }, |
| 164 | 167 |
| 165 _updateReplayInfoResizeWidget: function() | 168 _updateReplayInfoResizeWidget: function() |
| 166 { | 169 { |
| 167 this._replayInfoResizeWidgetElement.classList.toggle("hidden", this._rep
layInfoSplitView.showMode() !== WebInspector.SplitView.ShowMode.Both); | 170 this._replayInfoResizeWidgetElement.classList.toggle("hidden", this._rep
layInfoSplitView.showMode() !== WebInspector.SplitView.ShowMode.Both); |
| 168 }, | 171 }, |
| 169 | 172 |
| 170 /** | 173 /** |
| 171 * @param {!Event} event | 174 * @param {!Event} event |
| 172 */ | 175 */ |
| 173 _onMouseClick: function(event) | 176 _onMouseClick: function(event) |
| 174 { | 177 { |
| 175 var resourceLinkElement = event.target.enclosingNodeOrSelfWithClass("can
vas-formatted-resource"); | 178 var resourceLinkElement = event.target.enclosingNodeOrSelfWithClass("can
vas-formatted-resource"); |
| 176 if (resourceLinkElement) { | 179 if (resourceLinkElement) { |
| 177 this._replayInfoSplitView.showBoth(); | 180 this._replayInfoSplitView.showBoth(); |
| 178 this._replayStateView.selectResource(resourceLinkElement.__resourceI
d); | 181 this._replayStateView.selectResource(resourceLinkElement.__resourceI
d); |
| 179 event.consume(true); | 182 event.consume(true); |
| 180 return; | 183 return; |
| 181 } | 184 } |
| 182 if (event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link
")) | 185 if (event.target.enclosingNodeOrSelfWithClass("webkit-html-resource-link
")) |
| 183 event.consume(false); | 186 event.consume(false); |
| 184 }, | 187 }, |
| 185 | 188 |
| 186 /** | 189 /** |
| 187 * @param {!Element} parent | 190 * @param {!WebInspector.StatusBar} toolbar |
| 188 * @param {string} className | 191 * @param {string} className |
| 189 * @param {string} title | 192 * @param {string} title |
| 190 * @param {function(this:WebInspector.CanvasProfileView)} clickCallback | 193 * @param {function(this:WebInspector.CanvasProfileView)} clickCallback |
| 191 */ | 194 */ |
| 192 _createControlButton: function(parent, className, title, clickCallback) | 195 _createControlButton: function(toolbar, className, title, clickCallback) |
| 193 { | 196 { |
| 194 var button = new WebInspector.StatusBarButton(title, className + " canva
s-replay-button"); | 197 var button = new WebInspector.StatusBarButton(title, className + " canva
s-replay-button"); |
| 195 parent.appendChild(button.element); | 198 toolbar.appendStatusBarItem(button); |
| 196 | 199 |
| 197 button.makeLongClickEnabled(); | 200 button.makeLongClickEnabled(); |
| 198 button.addEventListener("click", clickCallback, this); | 201 button.addEventListener("click", clickCallback, this); |
| 199 button.addEventListener("longClickDown", clickCallback, this); | 202 button.addEventListener("longClickDown", clickCallback, this); |
| 200 button.addEventListener("longClickPress", clickCallback, this); | 203 button.addEventListener("longClickPress", clickCallback, this); |
| 201 }, | 204 }, |
| 202 | 205 |
| 203 _onReplayContextChanged: function() | 206 _onReplayContextChanged: function() |
| 204 { | 207 { |
| 205 var selectedContextId = this._replayContextSelector.selectedOption().val
ue; | 208 var selectedContextId = this._replayContextSelector.selectedOption().val
ue; |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 */ | 685 */ |
| 683 targetRemoved: function(target) | 686 targetRemoved: function(target) |
| 684 { | 687 { |
| 685 if (this._target !== target) | 688 if (this._target !== target) |
| 686 return; | 689 return; |
| 687 this._target = null; | 690 this._target = null; |
| 688 this._target.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.FrameAdded, this._frameAdded, this); | 691 this._target.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.FrameAdded, this._frameAdded, this); |
| 689 this._target.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.FrameDetached, this._frameRemoved, this); | 692 this._target.resourceTreeModel.removeEventListener(WebInspector.Resource
TreeModel.EventTypes.FrameDetached, this._frameRemoved, this); |
| 690 }, | 693 }, |
| 691 | 694 |
| 692 get statusBarItems() | 695 /** |
| 696 * @return {!Array.<!WebInspector.StatusBarItem>} |
| 697 */ |
| 698 statusBarItems: function() |
| 693 { | 699 { |
| 694 return [this._capturingModeSelector.element, this._frameSelector.element
]; | 700 return [this._capturingModeSelector, this._frameSelector]; |
| 695 }, | 701 }, |
| 696 | 702 |
| 697 get buttonTooltip() | 703 get buttonTooltip() |
| 698 { | 704 { |
| 699 if (this._isSingleFrameMode()) | 705 if (this._isSingleFrameMode()) |
| 700 return WebInspector.UIString("Capture next canvas frame."); | 706 return WebInspector.UIString("Capture next canvas frame."); |
| 701 else | 707 else |
| 702 return this._recording ? WebInspector.UIString("Stop capturing canva
s frames.") : WebInspector.UIString("Start capturing canvas frames."); | 708 return this._recording ? WebInspector.UIString("Stop capturing canva
s frames.") : WebInspector.UIString("Start capturing canvas frames."); |
| 703 }, | 709 }, |
| 704 | 710 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 }, | 1316 }, |
| 1311 | 1317 |
| 1312 clearResourceStates: function() | 1318 clearResourceStates: function() |
| 1313 { | 1319 { |
| 1314 this._currentResourceStates = {}; | 1320 this._currentResourceStates = {}; |
| 1315 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve
nts.CanvasReplayStateChanged); | 1321 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve
nts.CanvasReplayStateChanged); |
| 1316 }, | 1322 }, |
| 1317 | 1323 |
| 1318 __proto__: WebInspector.Object.prototype | 1324 __proto__: WebInspector.Object.prototype |
| 1319 } | 1325 } |
| OLD | NEW |