Commit 67df93b3 authored by aandrey@chromium.org's avatar aandrey@chromium.org

Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames

https://bugs.webkit.org/show_bug.cgi?id=107688

Reviewed by Pavel Feldman.

Allow capturing several canvas frames in a row.

* English.lproj/localizedStrings.js:
* inspector/InjectedScriptCanvasModule.cpp:
(WebCore::InjectedScriptCanvasModule::traceLog):
* inspector/InjectedScriptCanvasModule.h:
(InjectedScriptCanvasModule):
* inspector/InjectedScriptCanvasModuleSource.js:
(.):
* inspector/Inspector.json:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::getTraceLog):
* inspector/InspectorCanvasAgent.h:
(InspectorCanvasAgent):
* inspector/front-end/CanvasProfileView.js:
(WebInspector.CanvasProfileView):
(WebInspector.CanvasProfileView.prototype._didReceiveTraceLog):
(WebInspector.CanvasProfileView.prototype._requestTraceLog):
(WebInspector.CanvasProfileType):
(WebInspector.CanvasProfileType.prototype.get statusBarItems):
(WebInspector.CanvasProfileType.prototype.get buttonTooltip):
(WebInspector.CanvasProfileType.prototype.buttonClicked):
(WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing):
(WebInspector.CanvasProfileType.prototype._startFrameCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing.didStopCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing):
(WebInspector.CanvasProfileType.prototype._didStartCapturingFrame):
(WebInspector.CanvasProfileType.prototype.setRecordingProfile):
(WebInspector.CanvasProfileType.prototype._isSingleFrameMode):
(WebInspector.CanvasProfileHeader):
(WebInspector.CanvasProfileHeader.prototype._updateCapturingStatus):
(WebInspector.CanvasProfileHeader.prototype._requestCapturingStatus):
* inspector/front-end/ProfileLauncherView.js:
(WebInspector.ProfileLauncherView):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileType.prototype.get statusBarItems):
(WebInspector.ProfilesPanel):
(WebInspector.ProfilesPanel.prototype.get statusBarItems):
(WebInspector.ProfilesPanel.prototype._onProfileTypeSelected):
(WebInspector.ProfilesPanel.prototype._reset):
(WebInspector.ProfilesPanel.prototype._showLauncherView):
(WebInspector.ProfilesPanel.prototype.showProfile):
(WebInspector.ProfilesPanel.prototype._updateInterface):
(WebInspector.ProfilesPanel.prototype._resize):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140678 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b3b891b1
2013-01-23 Andrey Adaikin <aandrey@chromium.org>
Web Inspector: [Canvas] UI: add a selector to capture a single canvas frame vs consecutive frames
https://bugs.webkit.org/show_bug.cgi?id=107688
Reviewed by Pavel Feldman.
Allow capturing several canvas frames in a row.
* English.lproj/localizedStrings.js:
* inspector/InjectedScriptCanvasModule.cpp:
(WebCore::InjectedScriptCanvasModule::traceLog):
* inspector/InjectedScriptCanvasModule.h:
(InjectedScriptCanvasModule):
* inspector/InjectedScriptCanvasModuleSource.js:
(.):
* inspector/Inspector.json:
* inspector/InspectorCanvasAgent.cpp:
(WebCore::InspectorCanvasAgent::getTraceLog):
* inspector/InspectorCanvasAgent.h:
(InspectorCanvasAgent):
* inspector/front-end/CanvasProfileView.js:
(WebInspector.CanvasProfileView):
(WebInspector.CanvasProfileView.prototype._didReceiveTraceLog):
(WebInspector.CanvasProfileView.prototype._requestTraceLog):
(WebInspector.CanvasProfileType):
(WebInspector.CanvasProfileType.prototype.get statusBarItems):
(WebInspector.CanvasProfileType.prototype.get buttonTooltip):
(WebInspector.CanvasProfileType.prototype.buttonClicked):
(WebInspector.CanvasProfileType.prototype._runSingleFrameCapturing):
(WebInspector.CanvasProfileType.prototype._startFrameCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing.didStopCapturing):
(WebInspector.CanvasProfileType.prototype._stopFrameCapturing):
(WebInspector.CanvasProfileType.prototype._didStartCapturingFrame):
(WebInspector.CanvasProfileType.prototype.setRecordingProfile):
(WebInspector.CanvasProfileType.prototype._isSingleFrameMode):
(WebInspector.CanvasProfileHeader):
(WebInspector.CanvasProfileHeader.prototype._updateCapturingStatus):
(WebInspector.CanvasProfileHeader.prototype._requestCapturingStatus):
* inspector/front-end/ProfileLauncherView.js:
(WebInspector.ProfileLauncherView):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileType.prototype.get statusBarItems):
(WebInspector.ProfilesPanel):
(WebInspector.ProfilesPanel.prototype.get statusBarItems):
(WebInspector.ProfilesPanel.prototype._onProfileTypeSelected):
(WebInspector.ProfilesPanel.prototype._reset):
(WebInspector.ProfilesPanel.prototype._showLauncherView):
(WebInspector.ProfilesPanel.prototype.showProfile):
(WebInspector.ProfilesPanel.prototype._updateInterface):
(WebInspector.ProfilesPanel.prototype._resize):
2013-01-24 Andreas Kling <akling@apple.com>
Add CSSSelectorList::isValid().
......@@ -774,11 +774,15 @@ localizedStrings["\u03B1:"] = "\u03B1:";
localizedStrings["Drag"] = "Drag";
localizedStrings["Toggle breakpoint"] = "Toggle breakpoint";
localizedStrings["Capture Canvas Frame"] = "Capture Canvas Frame";
localizedStrings["Capture Canvas Frame."] = "Capture Canvas Frame.";
localizedStrings["Capture next canvas frame."] = "Capture next canvas frame.";
localizedStrings["Stop capturing canvas frames."] = "Stop capturing canvas frames.";
localizedStrings["Start capturing canvas frames."] = "Start capturing canvas frames.";
localizedStrings["Trace Log %d"] = "Trace Log %d";
localizedStrings["CANVAS PROFILE"] = "CANVAS PROFILE";
localizedStrings["Canvas calls instrumentation"] = "Canvas calls instrumentation";
localizedStrings["Capturing\u2026"] = "Capturing\u2026";
localizedStrings["Capturing\u2026 %d calls"] = "Capturing\u2026 %d calls";
localizedStrings["Captured %d calls"] = "Captured %d calls";
localizedStrings["There is an uninstrumented canvas on the page. Reload the page to instrument it."] = "There is an uninstrumented canvas on the page. Reload the page to instrument it.";
localizedStrings["First call."] = "First call.";
localizedStrings["Previous call."] = "Previous call.";
......
......@@ -124,12 +124,14 @@ void InjectedScriptCanvasModule::callVoidFunctionWithTraceLogIdArgument(const St
*errorString = "Internal error: " + functionName;
}
void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
void InjectedScriptCanvasModule::traceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>* traceLog)
{
ScriptFunctionCall function(injectedScriptObject(), "traceLog");
function.appendArgument(traceLogId);
if (startOffset)
function.appendArgument(*startOffset);
if (maxLength)
function.appendArgument(*maxLength);
RefPtr<InspectorValue> resultValue;
makeCall(function, &resultValue);
if (!resultValue || resultValue->type() != InspectorValue::TypeObject) {
......
......@@ -59,7 +59,7 @@ public:
void startCapturing(ErrorString*, String*);
void stopCapturing(ErrorString*, const String&);
void dropTraceLog(ErrorString*, const String&);
void traceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
void traceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>*);
void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>*);
void resourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>*);
void resourceState(ErrorString*, const String&, const String&, RefPtr<TypeBuilder::Canvas::ResourceState>*);
......
......@@ -3053,25 +3053,35 @@ InjectedCanvasModule.prototype = {
/**
* @param {CanvasAgent.TraceLogId} id
* @param {number=} startOffset
* @param {number=} maxLength
* @return {!CanvasAgent.TraceLog|string}
*/
traceLog: function(id, startOffset)
traceLog: function(id, startOffset, maxLength)
{
var traceLog = this._traceLogs[id];
if (!traceLog)
return "Error: Trace log with the given ID not found.";
startOffset = Math.max(0, startOffset || 0);
var replayableCalls = traceLog.replayableCalls();
if (typeof startOffset !== "number")
startOffset = 0;
if (typeof maxLength !== "number")
maxLength = replayableCalls.length;
var fromIndex = Math.max(0, startOffset);
var toIndex = Math.min(replayableCalls.length - 1, fromIndex + maxLength - 1);
var alive = this._manager.capturing() && this._manager.lastTraceLog() === traceLog;
var result = {
id: id,
/** @type {Array.<CanvasAgent.Call>} */
calls: [],
alive: alive,
startOffset: startOffset
startOffset: fromIndex,
totalAvailableCalls: replayableCalls.length
};
var calls = traceLog.replayableCalls();
for (var i = startOffset, n = calls.length; i < n; ++i) {
var call = calls[i];
for (var i = fromIndex; i <= toIndex; ++i) {
var call = replayableCalls[i];
var contextResource = call.replayableResource().replayableContextResource();
var stackTrace = call.stackTrace();
var callFrame = stackTrace ? stackTrace.callFrame(0) || {} : {};
......
......@@ -3282,8 +3282,9 @@
"properties": [
{ "name": "id", "$ref": "TraceLogId" },
{ "name": "calls", "type": "array", "items": { "$ref": "Call" } },
{ "name": "startOffset", "type": "integer", "optional": true },
{ "name": "alive", "type": "boolean", "optional": true }
{ "name": "startOffset", "type": "integer" },
{ "name": "alive", "type": "boolean" },
{ "name": "totalAvailableCalls", "type": "number" }
]
}
],
......@@ -3331,7 +3332,8 @@
"name": "getTraceLog",
"parameters": [
{ "name": "traceLogId", "$ref": "TraceLogId" },
{ "name": "startOffset", "type": "integer", "optional": true }
{ "name": "startOffset", "type": "integer", "optional": true },
{ "name": "maxLength", "type": "integer", "optional": true }
],
"returns": [
{ "name": "traceLog", "$ref": "TraceLog" }
......
......@@ -155,13 +155,13 @@ void InspectorCanvasAgent::stopCapturing(ErrorString* errorString, const String&
module.stopCapturing(errorString, traceLogId);
}
void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
void InspectorCanvasAgent::getTraceLog(ErrorString* errorString, const String& traceLogId, const int* startOffset, const int* maxLength, RefPtr<TypeBuilder::Canvas::TraceLog>& traceLog)
{
if (!checkIsEnabled(errorString))
return;
InjectedScriptCanvasModule module = injectedScriptCanvasModuleForTraceLogId(errorString, traceLogId);
if (!module.hasNoValue())
module.traceLog(errorString, traceLogId, startOffset, &traceLog);
module.traceLog(errorString, traceLogId, startOffset, maxLength, &traceLog);
}
void InspectorCanvasAgent::replayTraceLog(ErrorString* errorString, const String& traceLogId, int stepNo, RefPtr<TypeBuilder::Canvas::ResourceState>& result)
......
......@@ -83,7 +83,7 @@ public:
virtual void captureFrame(ErrorString*, String*);
virtual void startCapturing(ErrorString*, String*);
virtual void stopCapturing(ErrorString*, const String&);
virtual void getTraceLog(ErrorString*, const String&, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
virtual void getTraceLog(ErrorString*, const String&, const int*, const int*, RefPtr<TypeBuilder::Canvas::TraceLog>&);
virtual void replayTraceLog(ErrorString*, const String&, int, RefPtr<TypeBuilder::Canvas::ResourceState>&);
virtual void getResourceInfo(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::ResourceInfo>&);
virtual void getResourceState(ErrorString*, const String&, const String&, RefPtr<TypeBuilder::Canvas::ResourceState>&);
......
......@@ -31,6 +31,7 @@
/**
* @constructor
* @extends {WebInspector.View}
* @param {!WebInspector.CanvasProfileHeader} profile
*/
WebInspector.CanvasProfileView = function(profile)
{
......@@ -88,11 +89,15 @@ WebInspector.CanvasProfileView = function(profile)
this._logGridNodes = [];
this._splitView.show(this.element);
this._enableWaitIcon(true);
CanvasAgent.getTraceLog(this._traceLogId, 0, this._didReceiveTraceLog.bind(this));
this._requestTraceLog();
}
/**
* @const
* @type {number}
*/
WebInspector.CanvasProfileView.TraceLogPollingInterval = 500;
WebInspector.CanvasProfileView.prototype = {
dispose: function()
{
......@@ -283,12 +288,22 @@ WebInspector.CanvasProfileView.prototype = {
for (var i = 0, n = calls.length; i < n; ++i) {
var call = calls[i];
this._requestReplayContextInfo(call.contextId);
var gridNode = this._createCallNode(i, call);
var index = traceLog.startOffset + i;
var gridNode = this._createCallNode(index, call);
this._logGrid.rootNode().appendChild(gridNode);
lastNode = gridNode;
}
if (lastNode)
lastNode.revealAndSelect();
if (traceLog.alive)
setTimeout(this._requestTraceLog.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
this._profile._updateCapturingStatus(traceLog);
},
_requestTraceLog: function()
{
this._enableWaitIcon(true);
CanvasAgent.getTraceLog(this._traceLogId, this._logGridNodes.length, undefined, this._didReceiveTraceLog.bind(this));
},
/**
......@@ -362,6 +377,13 @@ WebInspector.CanvasProfileType = function()
{
WebInspector.ProfileType.call(this, WebInspector.CanvasProfileType.TypeId, WebInspector.UIString("Capture Canvas Frame"));
this._nextProfileUid = 1;
this._recording = false;
this._lastProfileHeader = null;
this._capturingModeSelector = new WebInspector.StatusBarComboBox(null);
this._capturingModeSelector.element.title = WebInspector.UIString("Canvas capture mode.");
this._capturingModeSelector.createOption(WebInspector.UIString("Single Frame"), WebInspector.UIString("Capture a single canvas frame."), "");
this._capturingModeSelector.createOption(WebInspector.UIString("Consecutive Frames"), WebInspector.UIString("Capture consecutive canvas frames."), "1");
this._decorationElement = document.createElement("div");
this._decorationElement.addStyleClass("profile-canvas-decoration");
......@@ -380,9 +402,17 @@ WebInspector.CanvasProfileType = function()
WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE";
WebInspector.CanvasProfileType.prototype = {
get statusBarItems()
{
return [this._capturingModeSelector.element];
},
get buttonTooltip()
{
return WebInspector.UIString("Capture Canvas Frame.");
if (this._isSingleFrameMode())
return WebInspector.UIString("Capture next canvas frame.");
else
return this._recording ? WebInspector.UIString("Stop capturing canvas frames.") : WebInspector.UIString("Start capturing canvas frames.");
},
/**
......@@ -392,17 +422,64 @@ WebInspector.CanvasProfileType.prototype = {
*/
buttonClicked: function(profilesPanel)
{
var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid);
++this._nextProfileUid;
profileHeader.isTemporary = true;
profilesPanel.addProfileHeader(profileHeader);
function didStartCapturingFrame(error, traceLogId)
if (this._recording) {
this._recording = false;
this._stopFrameCapturing();
} else if (this._isSingleFrameMode()) {
this._recording = false;
this._runSingleFrameCapturing(profilesPanel);
} else {
this._recording = true;
this._startFrameCapturing(profilesPanel);
}
profilesPanel.setRecordingProfile(WebInspector.CanvasProfileType.TypeId, this._recording);
return this._recording;
},
/**
* @param {WebInspector.ProfilesPanel} profilesPanel
*/
_runSingleFrameCapturing: function(profilesPanel)
{
CanvasAgent.captureFrame(this._didStartCapturingFrame.bind(this, profilesPanel));
},
/**
* @param {WebInspector.ProfilesPanel} profilesPanel
*/
_startFrameCapturing: function(profilesPanel)
{
CanvasAgent.startCapturing(this._didStartCapturingFrame.bind(this, profilesPanel));
},
_stopFrameCapturing: function()
{
if (!this._lastProfileHeader)
return;
var profileHeader = this._lastProfileHeader;
var traceLogId = profileHeader.traceLogId();
this._lastProfileHeader = null;
function didStopCapturing()
{
profileHeader._traceLogId = traceLogId;
profileHeader.isTemporary = false;
profileHeader._updateCapturingStatus();
}
CanvasAgent.captureFrame(didStartCapturingFrame.bind(this));
return false;
CanvasAgent.stopCapturing(traceLogId, didStopCapturing.bind(this));
},
/**
* @param {WebInspector.ProfilesPanel} profilesPanel
* @param {?Protocol.Error} error
* @param {CanvasAgent.TraceLogId} traceLogId
*/
_didStartCapturingFrame: function(profilesPanel, error, traceLogId)
{
if (error || this._lastProfileHeader && this._lastProfileHeader.traceLogId() === traceLogId)
return;
var profileHeader = new WebInspector.CanvasProfileHeader(this, WebInspector.UIString("Trace Log %d", this._nextProfileUid), this._nextProfileUid, traceLogId);
++this._nextProfileUid;
this._lastProfileHeader = profileHeader;
profilesPanel.addProfileHeader(profileHeader);
profileHeader._updateCapturingStatus();
},
get treeItemTitle()
......@@ -432,6 +509,11 @@ WebInspector.CanvasProfileType.prototype = {
this._nextProfileUid = 1;
},
setRecordingProfile: function(isProfiling)
{
this._recording = isProfiling;
},
/**
* @override
* @param {string=} title
......@@ -455,6 +537,10 @@ WebInspector.CanvasProfileType.prototype = {
_updateDecorationElement: function()
{
/**
* @param {?Protocol.Error} error
* @param {boolean} result
*/
function callback(error, result)
{
var hideWarning = (error || !result);
......@@ -471,6 +557,14 @@ WebInspector.CanvasProfileType.prototype = {
PageAgent.reload(event.shiftKey);
},
/**
* @return {boolean}
*/
_isSingleFrameMode: function()
{
return !this._capturingModeSelector.selectedOption().value;
},
__proto__: WebInspector.ProfileType.prototype
}
......@@ -480,20 +574,20 @@ WebInspector.CanvasProfileType.prototype = {
* @param {!WebInspector.CanvasProfileType} type
* @param {string} title
* @param {number=} uid
* @param {CanvasAgent.TraceLogId=} traceLogId
*/
WebInspector.CanvasProfileHeader = function(type, title, uid)
WebInspector.CanvasProfileHeader = function(type, title, uid, traceLogId)
{
WebInspector.ProfileHeader.call(this, type, title, uid);
/**
* @type {string?}
*/
this._traceLogId = null;
/** @type {CanvasAgent.TraceLogId} */
this._traceLogId = traceLogId || "";
this._alive = true;
this._traceLogSize = 0;
}
WebInspector.CanvasProfileHeader.prototype = {
/**
* @return {string?}
* @return {CanvasAgent.TraceLogId}
*/
traceLogId: function()
{
......@@ -517,5 +611,44 @@ WebInspector.CanvasProfileHeader.prototype = {
return new WebInspector.CanvasProfileView(this);
},
/**
* @param {CanvasAgent.TraceLog=} traceLog
*/
_updateCapturingStatus: function(traceLog)
{
if (!this.sidebarElement || !this._traceLogId)
return;
if (traceLog) {
this._alive = traceLog.alive;
this._traceLogSize = traceLog.totalAvailableCalls;
}
this.sidebarElement.subtitle = this._alive ? WebInspector.UIString("Capturing\u2026 %d calls", this._traceLogSize) : WebInspector.UIString("Captured %d calls", this._traceLogSize);
this.sidebarElement.wait = this._alive;
if (this._alive) {
clearTimeout(this._requestStatusTimer);
this._requestStatusTimer = setTimeout(this._requestCapturingStatus.bind(this), WebInspector.CanvasProfileView.TraceLogPollingInterval);
}
},
_requestCapturingStatus: function()
{
/**
* @param {?Protocol.Error} error
* @param {CanvasAgent.TraceLog} traceLog
*/
function didReceiveTraceLog(error, traceLog)
{
if (error)
return;
this._alive = traceLog.alive;
this._traceLogSize = traceLog.totalAvailableCalls;
this._updateCapturingStatus();
}
CanvasAgent.getTraceLog(this._traceLogId, 0, 0, didReceiveTraceLog.bind(this));
},
__proto__: WebInspector.ProfileHeader.prototype
}
......@@ -42,9 +42,7 @@ WebInspector.ProfileLauncherView = function(profilesPanel)
this.element.addStyleClass("profile-launcher-view");
this.element.addStyleClass("panel-enabler-view");
this._contentElement = document.createElement("div");
this._contentElement.className = "profile-launcher-view-content";
this.element.appendChild(this._contentElement);
this._contentElement = this.element.createChild("div", "profile-launcher-view-content");
var header = this._contentElement.createChild("h1");
header.textContent = WebInspector.UIString("Select profiling type");
......@@ -52,8 +50,7 @@ WebInspector.ProfileLauncherView = function(profilesPanel)
this._profileTypeSelectorForm = this._contentElement.createChild("form");
if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
this._nativeMemoryElement = document.createElement("div");
this._contentElement.appendChild(this._nativeMemoryElement);
this._nativeMemoryElement = this._contentElement.createChild("div");
this._nativeMemoryLiveChart = new WebInspector.NativeMemoryBarChart();
this._nativeMemoryLiveChart.show(this._nativeMemoryElement);
}
......
......@@ -41,6 +41,11 @@ WebInspector.ProfileType = function(id, name)
}
WebInspector.ProfileType.prototype = {
get statusBarItems()
{
return [];
},
get buttonTooltip()
{
return "";
......@@ -246,8 +251,11 @@ WebInspector.ProfilesPanel = function()
this._statusBarButtons.push(this.garbageCollectButton);
}
this.profileViewStatusBarItemsContainer = document.createElement("div");
this.profileViewStatusBarItemsContainer.className = "status-bar-items";
this._profileTypeStatusBarItemsContainer = document.createElement("div");
this._profileTypeStatusBarItemsContainer.className = "status-bar-items";
this._profileViewStatusBarItemsContainer = document.createElement("div");
this._profileViewStatusBarItemsContainer.className = "status-bar-items";
this._profiles = [];
this._profilerEnabled = !Capabilities.profilerCausesRecompilation;
......@@ -311,7 +319,7 @@ WebInspector.ProfilesPanel.prototype = {
get statusBarItems()
{
return this._statusBarButtons.select("element").concat([this.profileViewStatusBarItemsContainer]);
return this._statusBarButtons.select("element").concat(this._profileTypeStatusBarItemsContainer, this._profileViewStatusBarItemsContainer);
},
toggleRecordButton: function()
......@@ -359,6 +367,14 @@ WebInspector.ProfilesPanel.prototype = {
{
this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data);
this.recordButton.title = this._selectedProfileType.buttonTooltip;
this._profileTypeStatusBarItemsContainer.removeChildren();
var statusBarItems = this._selectedProfileType.statusBarItems;
if (statusBarItems) {
for (var i = 0; i < statusBarItems.length; ++i)
this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]);
}
this._resize(this.splitView.sidebarWidth());
},
_reset: function()
......@@ -399,7 +415,7 @@ WebInspector.ProfilesPanel.prototype = {
this.sidebarTreeElement.removeStyleClass("some-expandable");
this.profileViews.removeChildren();
this.profileViewStatusBarItemsContainer.removeChildren();
this._profileViewStatusBarItemsContainer.removeChildren();
this.removeAllListeners();
......@@ -411,7 +427,7 @@ WebInspector.ProfilesPanel.prototype = {
_showLauncherView: function()
{
this.closeVisibleView();
this.profileViewStatusBarItemsContainer.removeChildren();
this._profileViewStatusBarItemsContainer.removeChildren();
this._launcherView.show(this.splitView.mainElement);
this.visibleView = this._launcherView;
},
......@@ -606,12 +622,12 @@ WebInspector.ProfilesPanel.prototype = {
this.visibleView = view;
this.profileViewStatusBarItemsContainer.removeChildren();
this._profileViewStatusBarItemsContainer.removeChildren();
var statusBarItems = view.statusBarItems;
if (statusBarItems)
for (var i = 0; i < statusBarItems.length; ++i)
this.profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]);
},
/**
......@@ -975,14 +991,14 @@ WebInspector.ProfilesPanel.prototype = {
this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
this.enableToggleButton.toggled = true;
this.recordButton.visible = true;
this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
this._profileViewStatusBarItemsContainer.removeStyleClass("hidden");
this.clearResultsButton.element.removeStyleClass("hidden");
this.panelEnablerView.detach();
} else {
this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
this.enableToggleButton.toggled = false;
this.recordButton.visible = false;
this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
this._profileViewStatusBarItemsContainer.addStyleClass("hidden");
this.clearResultsButton.element.addStyleClass("hidden");
this.panelEnablerView.show(this.element);
}
......@@ -1074,8 +1090,10 @@ WebInspector.ProfilesPanel.prototype = {
_resize: function(sidebarWidth)
{
var lastItemElement = this._statusBarButtons[this._statusBarButtons.length - 1].element;
var minFloatingStatusBarItemsOffset = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
this.profileViewStatusBarItemsContainer.style.left = Math.max(minFloatingStatusBarItemsOffset, sidebarWidth) + "px";
var left = lastItemElement.totalOffsetLeft() + lastItemElement.offsetWidth;
this._profileTypeStatusBarItemsContainer.style.left = left + "px";
left += this._profileTypeStatusBarItemsContainer.offsetWidth - 1;
this._profileViewStatusBarItemsContainer.style.left = Math.max(left, sidebarWidth) + "px";
},
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment