Title: [210046] trunk/Source/WebInspectorUI
Revision
210046
Author
[email protected]
Date
2016-12-20 16:15:53 -0800 (Tue, 20 Dec 2016)

Log Message

Web Inspector: Window resize causes TimelineOverview graph elements to be repositioned
https://bugs.webkit.org/show_bug.cgi?id=160207
<rdar://problem/27553228>

Reviewed by Brian Burg.

TimelineRuler does not always update its divider positions when the start
time changes while the end time remains the same. The check that determines
whether the first or last divider positions have changed before doing a
layout uses the ruler end time instead of calculating the last divider's
position, and would falsely determine no change was needed.

* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.set startTime):
(WebInspector.TimelineRuler.prototype.set secondsPerPixel):
Clear cached divider data on zoom or scroll, forcing dividers to be recalculated.
(WebInspector.TimelineRuler.prototype.layout):
Calculate accurate divider count and last divider time.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (210045 => 210046)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-12-20 23:53:48 UTC (rev 210045)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-12-21 00:15:53 UTC (rev 210046)
@@ -1,3 +1,24 @@
+2016-12-20  Matt Baker  <[email protected]>
+
+        Web Inspector: Window resize causes TimelineOverview graph elements to be repositioned
+        https://bugs.webkit.org/show_bug.cgi?id=160207
+        <rdar://problem/27553228>
+
+        Reviewed by Brian Burg.
+
+        TimelineRuler does not always update its divider positions when the start
+        time changes while the end time remains the same. The check that determines
+        whether the first or last divider positions have changed before doing a
+        layout uses the ruler end time instead of calculating the last divider's
+        position, and would falsely determine no change was needed.
+
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler.prototype.set startTime):
+        (WebInspector.TimelineRuler.prototype.set secondsPerPixel):
+        Clear cached divider data on zoom or scroll, forcing dividers to be recalculated.
+        (WebInspector.TimelineRuler.prototype.layout):
+        Calculate accurate divider count and last divider time.
+
 2016-12-20  Wenson Hsieh  <[email protected]>
 
         Update keyword completions in the inspector for the new scroll snapping CSS properties

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (210045 => 210046)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2016-12-20 23:53:48 UTC (rev 210045)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2016-12-21 00:15:53 UTC (rev 210046)
@@ -218,6 +218,8 @@
         if (!isNaN(this._duration))
             this._endTime = this._startTime + this._duration;
 
+        this._currentDividers = null;
+
         this.needsLayout();
     }
 
@@ -264,6 +266,7 @@
 
         this._secondsPerPixel = x;
         this._endTimePinned = false;
+        this._currentDividers = null;
         this._currentSliceTime = 0;
 
         this.needsLayout();
@@ -444,12 +447,12 @@
             sliceTime = this._currentSliceTime;
         }
 
+        // Calculate the divider count now based on the final slice time.
+        dividerCount = Math.floor(visibleWidth * this.secondsPerPixel / sliceTime);
+
         let firstDividerTime = (Math.ceil((this._startTime - this._zeroTime) / sliceTime) * sliceTime) + this._zeroTime;
-        let lastDividerTime = this._endTime;
+        let lastDividerTime = firstDividerTime + sliceTime * dividerCount;
 
-        // Calculate the divider count now based on the final slice time.
-        dividerCount = Math.ceil((lastDividerTime - firstDividerTime) / sliceTime);
-
         // Make an extra divider in case the last one is partially visible.
         if (!this._endTimePinned)
             ++dividerCount;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to