Title: [107920] trunk/Source/WebCore
Revision
107920
Author
[email protected]
Date
2012-02-16 04:11:33 -0800 (Thu, 16 Feb 2012)

Log Message

Web Inspector: [refactoring] move timeline overview sidebar creation to TimelineOverviewPane
https://bugs.webkit.org/show_bug.cgi?id=78782

Reviewed by Vsevolod Vlasov.

* inspector/front-end/TimelineOverviewPane.js:
(WebInspector.TimelineOverviewPane):
(WebInspector.TimelineOverviewPane.prototype.showTimelines):
(WebInspector.TimelineOverviewPane.prototype.showMemoryGraph):
(WebInspector.TimelineOverviewPane.prototype.sidebarResized):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel):
(WebInspector.TimelinePanel.prototype.sidebarResized):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107919 => 107920)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 11:05:24 UTC (rev 107919)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 12:11:33 UTC (rev 107920)
@@ -1,3 +1,19 @@
+2012-02-16  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: [refactoring] move timeline overview sidebar creation to TimelineOverviewPane
+        https://bugs.webkit.org/show_bug.cgi?id=78782
+
+        Reviewed by Vsevolod Vlasov.
+
+        * inspector/front-end/TimelineOverviewPane.js:
+        (WebInspector.TimelineOverviewPane):
+        (WebInspector.TimelineOverviewPane.prototype.showTimelines):
+        (WebInspector.TimelineOverviewPane.prototype.showMemoryGraph):
+        (WebInspector.TimelineOverviewPane.prototype.sidebarResized):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel):
+        (WebInspector.TimelinePanel.prototype.sidebarResized):
+
 2012-02-15  Andreas Kling  <[email protected]>
 
         Share font-family CSS values through CSSValuePool.

Modified: trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js (107919 => 107920)


--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-16 11:05:24 UTC (rev 107919)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-16 12:11:33 UTC (rev 107920)
@@ -35,6 +35,27 @@
 {
     this._presentationModel = presentationModel;
 
+    this.element = document.createElement("div");
+    this.element.id = "timeline-overview-panel";
+
+    this._topPaneSidebarElement = document.createElement("div");
+    this._topPaneSidebarElement.id = "timeline-overview-sidebar";
+
+    var overviewTreeElement = document.createElement("ol");
+    overviewTreeElement.className = "sidebar-tree";
+    this._topPaneSidebarElement.appendChild(overviewTreeElement);
+    this.element.appendChild(this._topPaneSidebarElement);
+
+    var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
+    var timelinesOverviewItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Timelines"));
+    topPaneSidebarTree.appendChild(timelinesOverviewItem);
+    timelinesOverviewItem.revealAndSelect(false);
+    timelinesOverviewItem._onselect_ = this.showTimelines.bind(this);
+
+    var memoryOverviewItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Memory"));
+    topPaneSidebarTree.appendChild(memoryOverviewItem);
+    memoryOverviewItem._onselect_ = this.showMemoryGraph.bind(this);
+
     this._overviewGrid = new WebInspector.TimelineGrid();
     this._overviewGrid.element.id = "timeline-overview-grid";
     this._overviewGrid.itemsGraphsElement.id = "timeline-overview-timelines";
@@ -43,8 +64,14 @@
     this._heapGraph.element.id = "timeline-overview-memory";
     this._overviewGrid.element.insertBefore(this._heapGraph.element, this._overviewGrid.itemsGraphsElement);
 
-    this.element = this._overviewGrid.element;
+    this._overviewWindow = new WebInspector.TimelineOverviewWindow(this._overviewGrid.element, presentationModel);
 
+    this.element.appendChild(this._overviewGrid.element);
+
+    var separatorElement = document.createElement("div");
+    separatorElement.id = "timeline-overview-separator";
+    this.element.appendChild(separatorElement);
+ 
     this._categoryGraphs = {};
     var i = 0;
     var categories = this._presentationModel.categories;
@@ -57,7 +84,6 @@
 
     this._overviewGrid.setScrollAndDividerTop(0, 0);
 
-    this._overviewWindow = new WebInspector.TimelineOverviewWindow(this._overviewGrid.element, presentationModel);
     this._overviewCalculator = new WebInspector.TimelineOverviewCalculator();
 }
 
@@ -68,14 +94,14 @@
 WebInspector.TimelineOverviewPane.ResizerOffset = 3.5; // half pixel because offset values are not rounded but ceiled
 
 WebInspector.TimelineOverviewPane.prototype = {
-    showTimelines: function(event) {
+    showTimelines: function() {
         this._heapGraph.hide();
         this._overviewGrid.itemsGraphsElement.removeStyleClass("hidden");
     },
 
-    showMemoryGraph: function(records) {
+    showMemoryGraph: function() {
         this._heapGraph.show();
-        this._heapGraph.update(records);
+        this._heapGraph.update(this._records);
         this._overviewGrid.itemsGraphsElement.addStyleClass("hidden");
     },
 
@@ -97,6 +123,7 @@
 
     update: function(records, showShortEvents)
     {
+        this._records = records;
         this._showShortEvents = showShortEvents;
         // Clear summary bars.
         var timelines = {};
@@ -171,6 +198,7 @@
     sidebarResized: function(width)
     {
         this._overviewGrid.element.style.left = width + "px";
+        this._topPaneSidebarElement.style.width = width + "px";
     },
 
     reset: function()

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (107919 => 107920)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-02-16 11:05:24 UTC (rev 107919)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-02-16 12:11:33 UTC (rev 107920)
@@ -44,7 +44,9 @@
     this._presentationModel.addEventListener(WebInspector.TimelinePresentationModel.Events.WindowChanged, this._scheduleRefresh.bind(this, false));
     this._presentationModel.addEventListener(WebInspector.TimelinePresentationModel.Events.CategoryVisibilityChanged, this._scheduleRefresh.bind(this, true));
 
-    this.element.appendChild(this._createTopPane());
+    this._overviewPane = new WebInspector.TimelineOverviewPane(this._presentationModel);
+
+    this.element.appendChild(this._overviewPane.element);
     this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
     this.element.tabIndex = 0;
 
@@ -188,37 +190,6 @@
         return this._linkifyLocation(callFrame.url, callFrame.lineNumber, callFrame.columnNumber);
     },
 
-    _createTopPane: function() {
-        var topPaneElement = document.createElement("div");
-        topPaneElement.id = "timeline-overview-panel";
-
-        this._topPaneSidebarElement = document.createElement("div");
-        this._topPaneSidebarElement.id = "timeline-overview-sidebar";
-
-        var overviewTreeElement = document.createElement("ol");
-        overviewTreeElement.className = "sidebar-tree";
-        this._topPaneSidebarElement.appendChild(overviewTreeElement);
-        topPaneElement.appendChild(this._topPaneSidebarElement);
-
-        var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
-        var timelinesOverviewItem = new WebInspector.SidebarTreeElement("resources-time-graph-sidebar-item", WebInspector.UIString("Timelines"));
-        topPaneSidebarTree.appendChild(timelinesOverviewItem);
-        timelinesOverviewItem.revealAndSelect(false);
-        timelinesOverviewItem._onselect_ = this._timelinesOverviewItemSelected.bind(this);
-
-        var memoryOverviewItem = new WebInspector.SidebarTreeElement("resources-size-graph-sidebar-item", WebInspector.UIString("Memory"));
-        topPaneSidebarTree.appendChild(memoryOverviewItem);
-        memoryOverviewItem._onselect_ = this._memoryOverviewItemSelected.bind(this);
-
-        this._overviewPane = new WebInspector.TimelineOverviewPane(this._presentationModel);
-        topPaneElement.appendChild(this._overviewPane.element);
-
-        var separatorElement = document.createElement("div");
-        separatorElement.id = "timeline-overview-separator";
-        topPaneElement.appendChild(separatorElement);
-        return topPaneElement;
-    },
-
     get calculator()
     {
         return this._calculator;
@@ -441,16 +412,6 @@
         return eventDividerPadding;
     },
 
-    _timelinesOverviewItemSelected: function(event)
-    {
-        this._overviewPane.showTimelines();
-    },
-
-    _memoryOverviewItemSelected: function(event)
-    {
-        this._overviewPane.showMemoryGraph(this._rootRecord.children);
-    },
-
     _toggleTimelineButtonClicked: function()
     {
         if (this.toggleTimelineButton.toggled)
@@ -585,10 +546,10 @@
                     parent._aggregatedStats[category] += formattedRecord._aggregatedStats[category];
                 record = parent;
             } while (record.parent);
-        } else
+        } else {
             if (parentRecord !== this._rootRecord)
                 parentRecord._selfTime -= formattedRecord.endTime - formattedRecord.startTime;
-
+        }
         // Keep bar entry for mark timeline since nesting might be interesting to the user.
         if (record.type === recordTypes.TimeStamp)
             this._timeStampRecords.push(formattedRecord);
@@ -598,7 +559,6 @@
     {
         var width = event.data;
         this._sidebarBackgroundElement.style.width = width + "px";
-        this._topPaneSidebarElement.style.width = width + "px";
         this._scheduleRefresh(false);
         this._overviewPane.sidebarResized(width);
         // Min width = <number of buttons on the left> * 31
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to