Title: [109114] trunk/Source/WebCore
Revision
109114
Author
pfeld...@chromium.org
Date
2012-02-28 09:05:28 -0800 (Tue, 28 Feb 2012)

Log Message

Web Inspector: remove window aspects from the timeline presentation model.
https://bugs.webkit.org/show_bug.cgi?id=79803

Reviewed by Yury Semikhatsky.

* inspector/front-end/TimelineOverviewPane.js:
(WebInspector.TimelineOverviewPane):
(WebInspector.TimelineOverviewPane.prototype.accept):
(WebInspector.TimelineOverviewPane.prototype._setWindowIndices):
(WebInspector.TimelineOverviewPane.prototype.windowLeft):
(WebInspector.TimelineOverviewPane.prototype.windowRight):
(WebInspector.TimelineOverviewPane.prototype._fireWindowChanged):
(WebInspector.TimelineOverviewWindow.prototype._dragWindow):
(WebInspector.TimelineOverviewPane.WindowSelector):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel):
(WebInspector.TimelinePanel.prototype._onCategoryCheckboxClicked):
(WebInspector.TimelinePanel.prototype._updateBoundaries):
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.prototype.reset):
(WebInspector.TimelineCategory):
(WebInspector.TimelineCategory.prototype.get hidden):
(WebInspector.TimelineCategory.prototype.set hidden):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109113 => 109114)


--- trunk/Source/WebCore/ChangeLog	2012-02-28 17:03:23 UTC (rev 109113)
+++ trunk/Source/WebCore/ChangeLog	2012-02-28 17:05:28 UTC (rev 109114)
@@ -1,3 +1,29 @@
+2012-02-28  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: remove window aspects from the timeline presentation model.
+        https://bugs.webkit.org/show_bug.cgi?id=79803
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/TimelineOverviewPane.js:
+        (WebInspector.TimelineOverviewPane):
+        (WebInspector.TimelineOverviewPane.prototype.accept):
+        (WebInspector.TimelineOverviewPane.prototype._setWindowIndices):
+        (WebInspector.TimelineOverviewPane.prototype.windowLeft):
+        (WebInspector.TimelineOverviewPane.prototype.windowRight):
+        (WebInspector.TimelineOverviewPane.prototype._fireWindowChanged):
+        (WebInspector.TimelineOverviewWindow.prototype._dragWindow):
+        (WebInspector.TimelineOverviewPane.WindowSelector):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel):
+        (WebInspector.TimelinePanel.prototype._onCategoryCheckboxClicked):
+        (WebInspector.TimelinePanel.prototype._updateBoundaries):
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel.prototype.reset):
+        (WebInspector.TimelineCategory):
+        (WebInspector.TimelineCategory.prototype.get hidden):
+        (WebInspector.TimelineCategory.prototype.set hidden):
+
 2012-02-28  Kenneth Rohde Christiansen  <kenn...@webkit.org>
 
         Improve the visual of the tiling

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


--- trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-28 17:03:23 UTC (rev 109113)
+++ trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js	2012-02-28 17:05:28 UTC (rev 109114)
@@ -75,7 +75,7 @@
     this._overviewGrid.element.insertBefore(this._heapGraph.element, this._overviewGrid.itemsGraphsElement);
 
     this._overviewWindow = new WebInspector.TimelineOverviewWindow(this._overviewGrid.element);
-    this._overviewWindow.addEventListener(WebInspector.TimelineOverviewWindow.Events.WindowChanged, this._onWindowChanged, this);
+    this._overviewWindow.addEventListener(WebInspector.TimelineOverviewWindow.Events.WindowChanged, this._fireWindowChanged, this);
 
     this.element.appendChild(this._overviewGrid.element);
 
@@ -90,8 +90,8 @@
         var categoryGraph = new WebInspector.TimelineCategoryGraph(categories[category], i++ % 2);
         this._categoryGraphs[category] = categoryGraph;
         this._overviewGrid.itemsGraphsElement.appendChild(categoryGraph.graphElement);
+        categories[category].addEventListener(WebInspector.TimelineCategory.Events.VisibilityChanged, this._onCategoryVisibilityChanged, this);
     }
-    this._presentationModel.addEventListener(WebInspector.TimelinePresentationModel.Events.CategoryVisibilityChanged, this._onCategoryVisibilityChanged, this);
 
     this._overviewGrid.setScrollAndDividerTop(0, 0);
 
@@ -110,7 +110,8 @@
 };
 
 WebInspector.TimelineOverviewPane.Events = {
-    ModeChanged: "ModeChanged"
+    ModeChanged: "ModeChanged",
+    WindowChanged: "WindowChanged"
 };
 
 WebInspector.TimelineOverviewPane.prototype = {
@@ -154,11 +155,6 @@
         }
     },
 
-    _onWindowChanged: function()
-    {
-        this._presentationModel.setWindowPosition(this._overviewWindow.windowLeft, this._overviewWindow.windowRight);
-    },
-
     _onCategoryVisibilityChanged: function(event)
     {
         var category = event.data;
@@ -281,8 +277,8 @@
         } else {
             var absoluteMin = this._presentationModel.minimumRecordTime();
             var absoluteMax = this._presentationModel.maximumRecordTime();
-            var windowLeft = absoluteMin + (absoluteMax - absoluteMin) * this._overviewWindow.windowLeft;
-            var windowRight = absoluteMin + (absoluteMax - absoluteMin) * this._overviewWindow.windowRight;
+            var windowLeft = absoluteMin + (absoluteMax - absoluteMin) * this.windowLeft();
+            var windowRight = absoluteMin + (absoluteMax - absoluteMin) * this.windowRight();
             return record.endTime >= windowLeft && record.startTime <= windowRight;
         }
     },
@@ -291,7 +287,22 @@
     {
         this._windowIndexLeft = indexLeft;
         this._windowIndexRight = indexRight;
-        this._presentationModel.fireWindowChanged();
+        this._fireWindowChanged();
+    },
+
+    windowLeft: function()
+    {
+        return this._overviewWindow.windowLeft;
+    },
+
+    windowRight: function()
+    {
+        return this._overviewWindow.windowRight;
+    },
+
+    _fireWindowChanged: function()
+    {
+        this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.WindowChanged);
     }
 }
 
@@ -378,7 +389,7 @@
                 break;
             } else if (node === this._parentElement) {
                 var position = event.pageX - this._parentElement.offsetLeft;
-                this._overviewWindowSelector = new WebInspector.TimelinePanel.WindowSelector(this._parentElement, position);
+                this._overviewWindowSelector = new WebInspector.TimelineOverviewPane.WindowSelector(this._parentElement, position);
                 WebInspector.elementDragStart(null, this._windowSelectorDragging.bind(this), this._endWindowSelectorDragging.bind(this), event, "ew-resize");
                 break;
             } else if (node === this._leftResizeElement || node === this._rightResizeElement) {
@@ -585,7 +596,7 @@
 /**
  * @constructor
  */
-WebInspector.TimelinePanel.WindowSelector = function(parent, position)
+WebInspector.TimelineOverviewPane.WindowSelector = function(parent, position)
 {
     this._startPosition = position;
     this._width = parent.offsetWidth;
@@ -596,7 +607,7 @@
     parent.appendChild(this._windowSelector);
 }
 
-WebInspector.TimelinePanel.WindowSelector.prototype = {
+WebInspector.TimelineOverviewPane.WindowSelector.prototype = {
     _createSelectorElement: function(parent, left, width, height)
     {
         var selectorElement = document.createElement("div");

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


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-02-28 17:03:23 UTC (rev 109113)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-02-28 17:05:28 UTC (rev 109114)
@@ -38,10 +38,9 @@
     this.registerRequiredCSS("timelinePanel.css");
 
     this._presentationModel = new WebInspector.TimelinePresentationModel();
-    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._overviewPane = new WebInspector.TimelineOverviewPane(this._presentationModel);
+    this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events.WindowChanged, this._scheduleRefresh.bind(this, false));
 
     this.element.appendChild(this._overviewPane.element);
     this.element.addEventListener("contextmenu", this._contextMenu.bind(this), true);
@@ -264,7 +263,8 @@
 
     _onCategoryCheckboxClicked: function(category, event)
     {
-        this._presentationModel.setCategoryVisibility(category, event.target.checked);
+        category.hidden = !event.target.checked;
+        this._scheduleRefresh(true);
     },
 
     _registerShortcuts: function()
@@ -579,8 +579,8 @@
     _updateBoundaries: function()
     {
         this._calculator.reset();
-        this._calculator.windowLeft = this._presentationModel.windowLeft;
-        this._calculator.windowRight = this._presentationModel.windowRight;
+        this._calculator.windowLeft = this._overviewPane.windowLeft();
+        this._calculator.windowRight = this._overviewPane.windowRight();
 
         for (var i = 0; i < this._rootRecord().children.length; ++i)
             this._calculator.updateBoundaries(this._rootRecord().children[i]);
@@ -761,16 +761,6 @@
 /**
  * @constructor
  */
-WebInspector.TimelineCategory = function(name, title, color)
-{
-    this.name = name;
-    this.title = title;
-    this.color = color;
-}
-
-/**
- * @constructor
- */
 WebInspector.TimelineCalculator = function()
 {
     this.reset();

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (109113 => 109114)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-02-28 17:03:23 UTC (rev 109113)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-02-28 17:05:28 UTC (rev 109114)
@@ -44,11 +44,6 @@
     this.reset();
 }
 
-WebInspector.TimelinePresentationModel.Events = {
-    WindowChanged: "WindowChanged",
-    CategoryVisibilityChanged: "CategoryVisibilityChanged"
-}
-
 WebInspector.TimelinePresentationModel.shortRecordThreshold = 0.015;
 
 WebInspector.TimelinePresentationModel.prototype = {
@@ -75,7 +70,6 @@
         this._requestAnimationFrameRecords = {};
         this._minimumRecordTime = -1;
         this._maximumRecordTime = -1;
-        this._resetWindow();
     },
 
     minimumRecordTime: function()
@@ -181,14 +175,6 @@
         return parentRecord;
     },
 
-    _resetWindow: function()
-    {
-        this.windowLeft = 0.0;
-        this.windowRight = 1.0;
-        this.windowIndexLeft = 0;
-        this.windowIndexRight = null;
-    },
-
     setGlueRecords: function(glue)
     {
         this._glueRecords = glue;
@@ -207,32 +193,6 @@
         this._categories[category.name] = category;
     },
 
-    /**
-     * @param {number} left
-     * @param {number} right
-     */
-    setWindowPosition: function(left, right)
-    {
-        this.windowLeft = left;
-        this.windowRight = right;
-        this.dispatchEventToListeners(WebInspector.TimelinePresentationModel.Events.WindowChanged);
-    },
-
-    fireWindowChanged: function()
-    {
-        this.dispatchEventToListeners(WebInspector.TimelinePresentationModel.Events.WindowChanged);
-    },
-
-    /**
-     * @param {WebInspector.TimelineCategory} category
-     * @param {boolean} visible
-     */
-    setCategoryVisibility: function(category, visible)
-    {
-        category.hidden = !visible;
-        this.dispatchEventToListeners(WebInspector.TimelinePresentationModel.Events.CategoryVisibilityChanged, category);
-    },
-
     get _recordStyles()
     {
         if (!this._recordStylesArray) {
@@ -730,3 +690,37 @@
      */
     accept: function(record) { return false; }
 }
+
+/**
+ * @constructor
+ * @extends {WebInspector.Object}
+ */
+WebInspector.TimelineCategory = function(name, title, color)
+{
+    this.name = name;
+    this.title = title;
+    this.color = color;
+    this.hidden = false;
+}
+
+WebInspector.TimelineCategory.Events = {
+    VisibilityChanged: "VisibilityChanged"
+};
+
+WebInspector.TimelineCategory.prototype = {
+    /**
+     * @type {boolean}
+     */
+    get hidden()
+    {
+        return this._hidden;
+    },
+
+    set hidden(hidden)
+    {
+        this._hidden = hidden;
+        this.dispatchEventToListeners(WebInspector.TimelineCategory.Events.VisibilityChanged, this);
+    }
+}
+
+WebInspector.TimelineCategory.prototype.__proto__ = WebInspector.Object.prototype;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to