Title: [191639] trunk/Source/WebInspectorUI
Revision
191639
Author
commit-qu...@webkit.org
Date
2015-10-27 14:38:46 -0700 (Tue, 27 Oct 2015)

Log Message

Web Inspector: Timeline current time marker does not start moving when starting recording after just opening inspector
https://bugs.webkit.org/show_bug.cgi?id=150178

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-10-27
Reviewed by Brian Burg.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype.capturingStarted):
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording.prototype.initializeTimeBoundsIfNecessary):
For a recording to start updating current time the recording itself
must have a start time. Provide a setter so that the start time can
be set without waiting for a timeline record. For example the
timestamp that the frontend receives when it starts a recording.

* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
When we have a startTime number (new backends) always use it as the current time.
Previously we were only doing this if current time was NaN, which would be when
re-starting a recording after it had stopped, but not for the initial recording
after opening the inspector.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.updateLayout):
Even if we do not need to create new time dividers we may need to perform
other updates like update the current time marker. So do work before bailing.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (191638 => 191639)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-10-27 21:36:12 UTC (rev 191638)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-10-27 21:38:46 UTC (rev 191639)
@@ -1,3 +1,31 @@
+2015-10-27  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Timeline current time marker does not start moving when starting recording after just opening inspector
+        https://bugs.webkit.org/show_bug.cgi?id=150178
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype.capturingStarted):
+        * UserInterface/Models/TimelineRecording.js:
+        (WebInspector.TimelineRecording.prototype.initializeTimeBoundsIfNecessary):
+        For a recording to start updating current time the recording itself
+        must have a start time. Provide a setter so that the start time can
+        be set without waiting for a timeline record. For example the
+        timestamp that the frontend receives when it starts a recording.
+
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype._startUpdatingCurrentTime):
+        When we have a startTime number (new backends) always use it as the current time.
+        Previously we were only doing this if current time was NaN, which would be when
+        re-starting a recording after it had stopped, but not for the initial recording
+        after opening the inspector.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler.prototype.updateLayout):
+        Even if we do not need to create new time dividers we may need to perform
+        other updates like update the current time marker. So do work before bailing.
+
 2015-10-26  Matt Baker  <mattba...@apple.com>
 
         Web Inspector: WebInspector.Object can dispatch constructor-level events multiple times

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (191638 => 191639)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-10-27 21:36:12 UTC (rev 191638)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2015-10-27 21:38:46 UTC (rev 191639)
@@ -153,6 +153,9 @@
 
         this._isCapturing = true;
 
+        if (startTime)
+            this.activeRecording.initializeTimeBoundsIfNecessary(startTime);
+
         this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted, {startTime});
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js (191638 => 191639)


--- trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js	2015-10-27 21:36:12 UTC (rev 191638)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js	2015-10-27 21:38:46 UTC (rev 191639)
@@ -228,6 +228,18 @@
         this._legacyFirstRecordedTimestamp = timestamp;
     }
 
+    initializeTimeBoundsIfNecessary(timestamp)
+    {
+        if (isNaN(this._startTime)) {
+            console.assert(isNaN(this._endTime));
+
+            this._startTime = timestamp;
+            this._endTime = timestamp;
+
+            this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);
+        }
+    }
+
     // Private
 
     _keyForRecord(record)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js (191638 => 191639)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-10-27 21:36:12 UTC (rev 191638)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js	2015-10-27 21:38:46 UTC (rev 191639)
@@ -460,18 +460,16 @@
         if (this._updating)
             return;
 
-        if (!isNaN(this._currentTime)) {
+        if (typeof startTime === "number")
+            this._currentTime = startTime;
+        else if (!isNaN(this._currentTime)) {
             // This happens when you stop and later restart recording.
-            if (typeof startTime === "number")
-                this._currentTime = startTime;
-            else {
-                // COMPATIBILITY (iOS 9): Timeline.recordingStarted events did not include a timestamp.
-                // We likely need to jump into the future to a better current time which we can
-                // ascertained from a new incoming timeline record, so we wait for a Timeline to update.
-                console.assert(!this._waitingToResetCurrentTime);
-                this._waitingToResetCurrentTime = true;
-                this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
-            }
+            // COMPATIBILITY (iOS 9): Timeline.recordingStarted events did not include a timestamp.
+            // We likely need to jump into the future to a better current time which we can
+            // ascertained from a new incoming timeline record, so we wait for a Timeline to update.
+            console.assert(!this._waitingToResetCurrentTime);
+            this._waitingToResetCurrentTime = true;
+            this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated, this._recordingTimesUpdated, this);
         }
 
         this._updating = true;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (191638 => 191639)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-10-27 21:36:12 UTC (rev 191638)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-10-27 21:38:46 UTC (rev 191639)
@@ -371,8 +371,12 @@
             lastTime: lastDividerTime,
         };
 
-        if (Object.shallowEqual(dividerData, this._currentDividers))
+        if (Object.shallowEqual(dividerData, this._currentDividers)) {
+            this._updateMarkers(visibleWidth, duration);
+            this._updateSelection(visibleWidth, duration);
             return;
+        }
+
         this._currentDividers = dividerData;
 
         var markerDividers = this._markersElement.querySelectorAll("." + WebInspector.TimelineRuler.DividerElementStyleClassName);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to