- Revision
- 125785
- Author
- [email protected]
- Date
- 2012-08-16 09:06:13 -0700 (Thu, 16 Aug 2012)
Log Message
Web Inspector: CPU profiler status bar is broken.
https://bugs.webkit.org/show_bug.cgi?id=94212
Reviewed by Pavel Feldman.
- properly compute floating status bar buttons offset for profile and timeline panels,
taking actual number of panel status bar buttons and panel sidebar offset into account;
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfilesPanel.prototype.get statusBarItems):
(WebInspector.ProfilesPanel.prototype.sidebarResized):
(WebInspector.ProfilesPanel.prototype.onResize):
* inspector/front-end/SplitView.js:
(WebInspector.SplitView.prototype.sidebarWidth):
* inspector/front-end/StatusBarButton.js:
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype.sidebarResized):
(WebInspector.TimelinePanel.prototype.onResize):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (125784 => 125785)
--- trunk/Source/WebCore/ChangeLog 2012-08-16 16:02:13 UTC (rev 125784)
+++ trunk/Source/WebCore/ChangeLog 2012-08-16 16:06:13 UTC (rev 125785)
@@ -1,3 +1,24 @@
+2012-08-16 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: CPU profiler status bar is broken.
+ https://bugs.webkit.org/show_bug.cgi?id=94212
+
+ Reviewed by Pavel Feldman.
+
+ - properly compute floating status bar buttons offset for profile and timeline panels,
+ taking actual number of panel status bar buttons and panel sidebar offset into account;
+
+ * inspector/front-end/ProfilesPanel.js:
+ (WebInspector.ProfilesPanel.prototype.get statusBarItems):
+ (WebInspector.ProfilesPanel.prototype.sidebarResized):
+ (WebInspector.ProfilesPanel.prototype.onResize):
+ * inspector/front-end/SplitView.js:
+ (WebInspector.SplitView.prototype.sidebarWidth):
+ * inspector/front-end/StatusBarButton.js:
+ * inspector/front-end/TimelinePanel.js:
+ (WebInspector.TimelinePanel.prototype.sidebarResized):
+ (WebInspector.TimelinePanel.prototype.onResize):
+
2012-08-16 Jocelyn Turcotte <[email protected]>
Fix the Mac build.
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (125784 => 125785)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-16 16:02:13 UTC (rev 125784)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2012-08-16 16:06:13 UTC (rev 125785)
@@ -214,20 +214,25 @@
this.profileViews.id = "profile-views";
this.splitView.mainElement.appendChild(this.profileViews);
+ this._statusBarButtons = [];
+
this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
- this.enableToggleButton.addEventListener("click", this._toggleProfiling, this);
- if (!Capabilities.profilerCausesRecompilation)
- this.enableToggleButton.element.addStyleClass("hidden");
-
+ if (Capabilities.profilerCausesRecompilation) {
+ this._statusBarButtons.push(this.enableToggleButton);
+ this.enableToggleButton.addEventListener("click", this._toggleProfiling, this);
+ }
this.recordButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item");
this.recordButton.addEventListener("click", this.toggleRecordButton, this);
+ this._statusBarButtons.push(this.recordButton);
this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."), "clear-status-bar-item");
this.clearResultsButton.addEventListener("click", this._clearProfiles, this);
+ this._statusBarButtons.push(this.clearResultsButton);
if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled()) {
this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"), "garbage-collect-status-bar-item");
this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked, this);
+ this._statusBarButtons.push(this.garbageCollectButton);
}
this.profileViewStatusBarItemsContainer = document.createElement("div");
@@ -296,10 +301,7 @@
get statusBarItems()
{
- var statusBarItems = [this.enableToggleButton.element, this.recordButton.element, this.clearResultsButton.element, this.profileViewStatusBarItemsContainer];
- if (WebInspector.experimentsSettings.liveNativeMemoryChart.isEnabled())
- statusBarItems.splice(3, 0, this.garbageCollectButton.element);
- return statusBarItems;
+ return this._statusBarButtons.select("element").concat([this.profileViewStatusBarItemsContainer]);
},
toggleRecordButton: function()
@@ -1023,11 +1025,15 @@
sidebarResized: function(event)
{
- var width = event.data;
- // Min width = <number of buttons on the left> * 31
- this.profileViewStatusBarItemsContainer.style.left = Math.max(5 * 31, width) + "px";
+ this.onResize();
},
+ onResize: function()
+ {
+ var minFloatingStatusBarItemsOffset = document.getElementById("panel-status-bar").totalOffsetLeft() + this._statusBarButtons.length * WebInspector.StatusBarButton.width;
+ this.profileViewStatusBarItemsContainer.style.left = Math.max(minFloatingStatusBarItemsOffset, this.splitView.sidebarWidth()) + "px";
+ },
+
/**
* @param {string} profileType
* @param {boolean} isProfiling
Modified: trunk/Source/WebCore/inspector/front-end/SplitView.js (125784 => 125785)
--- trunk/Source/WebCore/inspector/front-end/SplitView.js 2012-08-16 16:02:13 UTC (rev 125784)
+++ trunk/Source/WebCore/inspector/front-end/SplitView.js 2012-08-16 16:06:13 UTC (rev 125785)
@@ -223,6 +223,11 @@
this.saveSidebarWidth();
},
+ sidebarWidth: function()
+ {
+ return this._sidebarWidth;
+ },
+
/**
* @param {number} width
*/
Modified: trunk/Source/WebCore/inspector/front-end/StatusBarButton.js (125784 => 125785)
--- trunk/Source/WebCore/inspector/front-end/StatusBarButton.js 2012-08-16 16:02:13 UTC (rev 125784)
+++ trunk/Source/WebCore/inspector/front-end/StatusBarButton.js 2012-08-16 16:06:13 UTC (rev 125785)
@@ -61,6 +61,8 @@
this._visible = true;
}
+WebInspector.StatusBarButton.width = 31;
+
WebInspector.StatusBarButton.prototype = {
_clicked: function()
{
Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (125784 => 125785)
--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-08-16 16:02:13 UTC (rev 125784)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js 2012-08-16 16:06:13 UTC (rev 125785)
@@ -572,8 +572,6 @@
this._sidebarBackgroundElement.style.width = width + "px";
this.onResize();
this._overviewPane.sidebarResized(width);
- // Min width = <number of buttons on the left> * 31
- this._miscStatusBarItems.style.left = Math.max((this._statusBarButtons.length + 3) * 31, width) + "px";
this._memoryStatistics.setSidebarWidth(width);
this._timelineGrid.gridHeaderElement.style.left = width + "px";
},
@@ -585,6 +583,8 @@
this._graphRowsElementWidth = this._graphRowsElement.offsetWidth;
this._timelineGrid.gridHeaderElement.style.width = this._itemsGraphsElement.offsetWidth + "px";
this._containerElementHeight = this._containerElement.clientHeight;
+ var minFloatingStatusBarItemsOffset = document.getElementById("panel-status-bar").totalOffsetLeft() + this._statusBarButtons.length * WebInspector.StatusBarButton.width;
+ this._miscStatusBarItems.style.left = Math.max(minFloatingStatusBarItemsOffset, this.splitView.sidebarWidth()) + "px";
},
_clearPanel: function()