Web Inspector: Timeline Detail Views do not reset properly when new time range select...
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:24:16 +0000 (21:24 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2019 21:24:16 +0000 (21:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=194115
<rdar://problem/47716693>

Rubber-stamped by Devin Rousso.

* UserInterface/Views/CPUTimelineView.js:
(WI.CPUTimelineView.prototype.reset):
(WI.CPUTimelineView.prototype.clear):
(WI.CPUTimelineView.prototype.layout):
* UserInterface/Views/MemoryTimelineView.js:
(WI.MemoryTimelineView.prototype.reset):
(WI.MemoryTimelineView.prototype.clear):
(WI.MemoryTimelineView.prototype.layout):
When there are no visible records in the selected range clear our UI.
Introduce a `clear` method that clears the UI but keeps
non-range-specific values (e.g. maximums).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/CPUTimelineView.js
Source/WebInspectorUI/UserInterface/Views/MemoryTimelineView.js

index 8bb265c..532f6b5 100644 (file)
@@ -1,5 +1,25 @@
 2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
 
+        Web Inspector: Timeline Detail Views do not reset properly when new time range selection contains nothing
+        https://bugs.webkit.org/show_bug.cgi?id=194115
+        <rdar://problem/47716693>
+
+        Rubber-stamped by Devin Rousso.
+
+        * UserInterface/Views/CPUTimelineView.js:
+        (WI.CPUTimelineView.prototype.reset):
+        (WI.CPUTimelineView.prototype.clear):
+        (WI.CPUTimelineView.prototype.layout):
+        * UserInterface/Views/MemoryTimelineView.js:
+        (WI.MemoryTimelineView.prototype.reset):
+        (WI.MemoryTimelineView.prototype.clear):
+        (WI.MemoryTimelineView.prototype.layout):
+        When there are no visible records in the selected range clear our UI.
+        Introduce a `clear` method that clears the UI but keeps
+        non-range-specific values (e.g. maximums).
+
+2019-02-01  Joseph Pecoraro  <pecoraro@apple.com>
+
         Web Inspector: Timeline graphs have drawing issues with multiple discontinuities
         https://bugs.webkit.org/show_bug.cgi?id=194110
         <rdar://problem/47714356>
index 48fe36b..b34413d 100644 (file)
@@ -80,6 +80,11 @@ WI.CPUTimelineView = class CPUTimelineView extends WI.TimelineView
 
         this._maxUsage = -Infinity;
 
+        this.clear();
+    }
+
+    clear()
+    {
         this._cpuUsageView.clear();
     }
 
@@ -114,8 +119,10 @@ WI.CPUTimelineView = class CPUTimelineView extends WI.TimelineView
         // Don't include the record before the graph start if the graph start is within a gap.
         let includeRecordBeforeStart = !discontinuities.length || discontinuities[0].startTime > graphStartTime;
         let visibleRecords = this.representedObject.recordsInTimeRange(graphStartTime, visibleEndTime, includeRecordBeforeStart);
-        if (!visibleRecords.length)
+        if (!visibleRecords.length || (visibleRecords.length === 1 && visibleRecords[0].endTime < graphStartTime)) {
+            this.clear();
             return;
+        }
 
         // Update total usage chart with the last record's data.
         let lastRecord = visibleRecords.lastValue;
index 227b7b0..a361710 100644 (file)
@@ -131,6 +131,11 @@ WI.MemoryTimelineView = class MemoryTimelineView extends WI.TimelineView
 
         this._maxSize = 0;
 
+        this.clear();
+    }
+
+    clear()
+    {
         this._cachedLegendRecord = null;
         this._cachedLegendMaxSize = undefined;
         this._cachedLegendCurrentSize = undefined;
@@ -183,8 +188,10 @@ WI.MemoryTimelineView = class MemoryTimelineView extends WI.TimelineView
 
         // FIXME: <https://webkit.org/b/153759> Web Inspector: Memory Timelines should better extend to future data
         let visibleRecords = this.representedObject.recordsInTimeRange(graphStartTime, visibleEndTime, includeRecordBeforeStart);
-        if (!visibleRecords.length)
+        if (!visibleRecords.length || (visibleRecords.length === 1 && visibleRecords[0].endTime < graphStartTime)) {
+            this.clear();
             return;
+        }
 
         // Update total usage chart with the last record's data.
         let lastRecord = visibleRecords.lastValue;