Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / devtools / front_end / TimelineOverviewPane.js
index 44b11e2..9c69c1d 100644 (file)
@@ -74,11 +74,18 @@ WebInspector.TimelineOverviewPane.prototype = {
     {
         if (this._overviewControl === overviewControl)
             return;
-        if (this._overviewControl)
+
+        var windowTimes = null;
+
+        if (this._overviewControl) {
+            windowTimes = this._overviewControl.windowTimes(this._overviewGrid.windowLeft(), this._overviewGrid.windowRight());
             this._overviewControl.detach();
+        }
         this._overviewControl = overviewControl;
         this._overviewControl.show(this._overviewGrid.element);
         this._update();
+        if (windowTimes)
+            this.setWindowTimes(windowTimes.startTime, windowTimes.endTime);
     },
 
     _update: function()
@@ -87,7 +94,7 @@ WebInspector.TimelineOverviewPane.prototype = {
 
         this._overviewCalculator.setWindow(this._model.minimumRecordTime(), this._model.maximumRecordTime());
         this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWidth());
-
+        this._updateWindow();
         if (this._overviewControl)
             this._overviewControl.update();
         this._overviewGrid.updateDividers(this._overviewCalculator);
@@ -138,36 +145,34 @@ WebInspector.TimelineOverviewPane.prototype = {
     },
 
     /**
-     * @return {number}
+     * @param {!WebInspector.Event} event
      */
-    windowLeft: function()
+    _onWindowChanged: function(event)
     {
-        return this._overviewGrid.windowLeft();
+        if (this._ignoreWindowChangedEvent)
+            return;
+        var windowTimes = this._overviewControl.windowTimes(this._overviewGrid.windowLeft(), this._overviewGrid.windowRight());
+        this._windowStartTime = windowTimes.startTime;
+        this._windowEndTime = windowTimes.endTime;
+        this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.WindowChanged, windowTimes);
     },
 
     /**
-     * @return {number}
+     * @param {number} startTime
+     * @param {number} endTime
      */
-    windowRight: function()
+    setWindowTimes: function(startTime, endTime)
     {
-        return this._overviewGrid.windowRight();
+        this._windowStartTime = startTime;
+        this._windowEndTime = endTime;
+        this._updateWindow();
     },
 
-    _onWindowChanged: function()
-    {
-        if (this._ignoreWindowChangedEvent)
-            return;
-        this.dispatchEventToListeners(WebInspector.TimelineOverviewPane.Events.WindowChanged);
-    },
-
-    /**
-     * @param {number} left
-     * @param {number} right
-     */
-    setWindow: function(left, right)
+    _updateWindow: function()
     {
+        var windowBoundaries = this._overviewControl.windowBoundaries(this._windowStartTime, this._windowEndTime);
         this._ignoreWindowChangedEvent = true;
-        this._overviewGrid.setWindow(left, right);
+        this._overviewGrid.setWindow(windowBoundaries.left, windowBoundaries.right);
         this._overviewGrid.setResizeEnabled(this._model.records.length);
         this._ignoreWindowChangedEvent = false;
     },