Modified: trunk/Source/WebCore/inspector/front-end/OverviewGrid.js (147430 => 147431)
--- trunk/Source/WebCore/inspector/front-end/OverviewGrid.js 2013-04-02 14:41:25 UTC (rev 147430)
+++ trunk/Source/WebCore/inspector/front-end/OverviewGrid.js 2013-04-02 14:44:30 UTC (rev 147431)
@@ -40,7 +40,6 @@
this._grid = new WebInspector.TimelineGrid();
this._grid.element.id = prefix + "-overview-grid";
- this._grid.itemsGraphsElement.id = prefix + "-overview-timelines";
this._grid.setScrollAndDividerTop(0, 0);
this.element.appendChild(this._grid.element);
@@ -49,16 +48,6 @@
}
WebInspector.OverviewGrid.prototype = {
- gridElement: function()
- {
- return this._grid.element;
- },
-
- itemsGraphsElement: function()
- {
- return this._grid.itemsGraphsElement;
- },
-
/**
* @return {number}
*/
@@ -67,16 +56,6 @@
return this.element.clientWidth;
},
- showItemsGraphsElement: function()
- {
- this._grid.itemsGraphsElement.removeStyleClass("hidden");
- },
-
- hideItemsGraphsElement: function()
- {
- this._grid.itemsGraphsElement.addStyleClass("hidden");
- },
-
/**
* @param {!WebInspector.TimelineGrid.Calculator} calculator
*/
Modified: trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js (147430 => 147431)
--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js 2013-04-02 14:41:25 UTC (rev 147430)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js 2013-04-02 14:44:30 UTC (rev 147431)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -54,8 +54,6 @@
var topPaneSidebarTree = new TreeOutline(overviewTreeElement);
- this._currentMode = WebInspector.TimelineOverviewPane.Mode.Events;
-
this._overviewItems = {};
this._overviewItems[WebInspector.TimelineOverviewPane.Mode.Events] = new WebInspector.SidebarTreeElement("timeline-overview-sidebar-events",
WebInspector.UIString("Events"));
@@ -72,20 +70,15 @@
topPaneSidebarTree.appendChild(item);
}
- this._overviewItems[this._currentMode].revealAndSelect(false);
-
this._overviewGrid = new WebInspector.OverviewGrid("timeline");
this.element.appendChild(this._overviewGrid.element);
- this._memoryOverview = new WebInspector.TimelineMemoryOverview(this._model);
-
var separatorElement = document.createElement("div");
separatorElement.id = "timeline-overview-separator";
this.element.appendChild(separatorElement);
- this._eventOverview = new WebInspector.TimelineEventOverview(this._model);
- this._eventOverview.show(this._overviewGrid.itemsGraphsElement());
-
+ this._innerSetMode(WebInspector.TimelineOverviewPane.Mode.Events);
+
var categories = WebInspector.TimelinePresentationModel.categories();
for (var category in categories)
categories[category].addEventListener(WebInspector.TimelineCategory.Events.VisibilityChanged, this._onCategoryVisibilityChanged, this);
@@ -123,43 +116,41 @@
{
if (this._currentMode === newMode)
return;
+ this._innerSetMode(newMode);
+ this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.ModeChanged, this._currentMode);
+ this._update();
+ },
+ _innerSetMode: function(newMode)
+ {
+ if (this._overviewControl)
+ this._overviewControl.detach();
+
this._currentMode = newMode;
- this._setFrameMode(this._currentMode === WebInspector.TimelineOverviewPane.Mode.Frames);
- switch (this._currentMode) {
- case WebInspector.TimelineOverviewPane.Mode.Events:
- case WebInspector.TimelineOverviewPane.Mode.Frames:
- this._memoryOverview.detach();
- this._overviewGrid.showItemsGraphsElement();
- break;
- case WebInspector.TimelineOverviewPane.Mode.Memory:
- this._overviewGrid.hideItemsGraphsElement();
- this._memoryOverview.show(this._overviewGrid.gridElement(), this._overviewGrid.itemsGraphsElement());
- }
+ this._overviewControl = this._createOverviewControl();
+ this._overviewControl.show(this._overviewGrid.element);
this._overviewItems[this._currentMode].revealAndSelect(false);
- this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.ModeChanged, this._currentMode);
- this._update();
},
- _setFrameMode: function(enabled)
+ /**
+ * @return {WebInspector.TimelineOverviewBase|null}
+ */
+ _createOverviewControl: function()
{
- if (!enabled === !this._frameOverview)
- return;
- if (enabled) {
- this._frameOverview = new WebInspector.TimelineFrameOverview(this._model);
- this._frameOverview.show(this._overviewGrid.element);
- } else {
- this._frameOverview.detach();
- this._frameOverview = null;
- this._overviewGrid.showItemsGraphsElement();
- this._eventOverview.update();
+ switch (this._currentMode) {
+ case WebInspector.TimelineOverviewPane.Mode.Events:
+ return new WebInspector.TimelineEventOverview(this._model);
+ case WebInspector.TimelineOverviewPane.Mode.Frames:
+ return new WebInspector.TimelineFrameOverview(this._model);
+ case WebInspector.TimelineOverviewPane.Mode.Memory:
+ return new WebInspector.TimelineMemoryOverview(this._model);
}
+ throw new Error("Invalid overview mode: " + this._currentMode);
},
_onCategoryVisibilityChanged: function(event)
{
- if (this._currentMode === WebInspector.TimelineOverviewPane.Mode.Events)
- this._eventOverview.update();
+ this._overviewControl.categoryVisibilityChanged();
},
_update: function()
@@ -170,13 +161,7 @@
this._overviewCalculator.setWindow(this._model.minimumRecordTime(), this._model.maximumRecordTime());
this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWidth());
- if (this._memoryOverview.isShowing())
- this._memoryOverview.update();
- else if (this._frameOverview)
- this._frameOverview.update();
- else
- this._eventOverview.update();
-
+ this._overviewControl.update();
this._overviewGrid.updateDividers(this._overviewCalculator);
this._updateEventDividers();
},
@@ -214,7 +199,7 @@
*/
addFrame: function(frame)
{
- this._frameOverview.addFrame(frame);
+ this._overviewControl.addFrame(frame);
this._scheduleRefresh();
},
@@ -223,7 +208,8 @@
*/
zoomToFrame: function(frame)
{
- var window = this._frameOverview.framePosition(frame);
+ var frameOverview = /** @type WebInspector.TimelineFrameOverview */ (this._overviewControl);
+ var window = frameOverview.framePosition(frame);
if (!window)
return;
@@ -251,8 +237,7 @@
this._overviewGrid.reset();
this._eventDividers = [];
this._overviewGrid.updateDividers(this._overviewCalculator);
- if (this._frameOverview)
- this._frameOverview.reset();
+ this._overviewControl.reset();
this._update();
},
@@ -280,16 +265,9 @@
{
if (this._ignoreWindowChangedEvent)
return;
- if (this._frameOverview) {
- var times = this._frameOverview.getWindowTimes(this.windowLeft(), this.windowRight());
- this._windowStartTime = times.startTime;
- this._windowEndTime = times.endTime;
- } else {
- var absoluteMin = this._model.minimumRecordTime();
- var absoluteMax = this._model.maximumRecordTime();
- this._windowStartTime = absoluteMin + (absoluteMax - absoluteMin) * this.windowLeft();
- this._windowEndTime = absoluteMin + (absoluteMax - absoluteMin) * this.windowRight();
- }
+ var times = this._overviewControl.windowTimes(this.windowLeft(), this.windowRight());
+ this._windowStartTime = times.startTime;
+ this._windowEndTime = times.endTime;
this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.WindowChanged);
},
@@ -415,8 +393,30 @@
}
WebInspector.TimelineOverviewBase.prototype = {
- update: function() {},
+ update: function() { },
+ reset: function() { },
+ categoryVisibilityChanged: function() { },
+
+ /**
+ * @param {WebInspector.TimelineFrame} frame
+ */
+ addFrame: function(frame) { },
+
+ /**
+ * @param {number} windowLeft
+ * @param {number} windowRight
+ */
+ windowTimes: function(windowLeft, windowRight)
+ {
+ var absoluteMin = this._model.minimumRecordTime();
+ var absoluteMax = this._model.maximumRecordTime();
+ return {
+ startTime: absoluteMin + (absoluteMax - absoluteMin) * windowLeft,
+ endTime: absoluteMin + (absoluteMax - absoluteMin) * windowRight
+ };
+ },
+
__proto__: WebInspector.View.prototype
}
@@ -526,6 +526,7 @@
{
WebInspector.TimelineOverviewBase.call(this, model);
+ this.element.id = "timeline-overview-events";
this._context = this._canvas.getContext("2d");
this._fillStyles = {};
@@ -595,6 +596,11 @@
}
},
+ categoryVisibilityChanged: function()
+ {
+ this.update();
+ },
+
_renderBar: function(begin, end, category)
{
var x = begin + 0.5;
@@ -627,7 +633,7 @@
this._outerPadding = 4;
this._maxInnerBarWidth = 10;
- // The below two are really computed by update() -- but let's have something so that getWindowTimes() is happy.
+ // The below two are really computed by update() -- but let's have something so that windowTimes() is happy.
this._actualPadding = 5;
this._actualOuterBarWidth = this._maxInnerBarWidth + this._actualPadding;
@@ -838,7 +844,7 @@
this._context.stroke();
},
- getWindowTimes: function(windowLeft, windowRight)
+ windowTimes: function(windowLeft, windowRight)
{
var windowSpan = this.element.clientWidth;
var leftOffset = windowLeft * windowSpan - this._outerPadding + this._actualPadding;
Modified: trunk/Source/WebCore/inspector/front-end/timelinePanel.css (147430 => 147431)
--- trunk/Source/WebCore/inspector/front-end/timelinePanel.css 2013-04-02 14:41:25 UTC (rev 147430)
+++ trunk/Source/WebCore/inspector/front-end/timelinePanel.css 2013-04-02 14:44:30 UTC (rev 147431)
@@ -249,7 +249,7 @@
color: rgba(0, 0, 0, 0.7);
}
-#timeline-overview-timelines,
+#timeline-overview-events,
#timeline-overview-memory {
position: absolute;
left: 0;