Title: [171786] trunk/Source/WebInspectorUI
Revision
171786
Author
commit-qu...@webkit.org
Date
2014-07-29 21:00:39 -0700 (Tue, 29 Jul 2014)

Log Message

Web Inspector: Reduce forced layouts in TimelineOverview
https://bugs.webkit.org/show_bug.cgi?id=135405

Patch by Joseph Pecoraro <pecor...@apple.com> on 2014-07-29
Reviewed by Timothy Hatcher.

Remove another forced layout. The scroll container won't
change size unless the ContentView itself resized. Make the
distinction between a layout update due to a resize and
normal events (scale changes, etc) and only calculate
element sizes then.

* UserInterface/Views/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype.updateLayout):
* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview):
(WebInspector.TimelineOverview.prototype.get visibleDuration):
(WebInspector.TimelineOverview.prototype.updateLayoutForResize):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (171785 => 171786)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-07-30 03:51:31 UTC (rev 171785)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-07-30 04:00:39 UTC (rev 171786)
@@ -1,3 +1,23 @@
+2014-07-29  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Reduce forced layouts in TimelineOverview
+        https://bugs.webkit.org/show_bug.cgi?id=135405
+
+        Reviewed by Timothy Hatcher.
+
+        Remove another forced layout. The scroll container won't
+        change size unless the ContentView itself resized. Make the
+        distinction between a layout update due to a resize and
+        normal events (scale changes, etc) and only calculate
+        element sizes then.
+
+        * UserInterface/Views/TimelineContentView.js:
+        (WebInspector.TimelineContentView.prototype.updateLayout):
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview):
+        (WebInspector.TimelineOverview.prototype.get visibleDuration):
+        (WebInspector.TimelineOverview.prototype.updateLayoutForResize):
+
 2014-07-29  Brian J. Burg  <b...@cs.washington.edu>
 
         Web Inspector: breakpoints are always speculatively resolved when restored from local storage

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js (171785 => 171786)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2014-07-30 03:51:31 UTC (rev 171785)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2014-07-30 04:00:39 UTC (rev 171786)
@@ -156,7 +156,7 @@
 
     updateLayout: function()
     {
-        this._timelineOverview.updateLayout();
+        this._timelineOverview.updateLayoutForResize();
 
         if (!this._currentTimelineView)
             return;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (171785 => 171786)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2014-07-30 03:51:31 UTC (rev 171785)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2014-07-30 04:00:39 UTC (rev 171786)
@@ -69,6 +69,7 @@
     this._endTime = 0;
     this._secondsPerPixel = this._secondsPerPixelSetting.value;
     this._scrollStartTime = 0;
+    this._cachedScrollContainerWidth = NaN;
 
     this.selectionStartTime = this._selectionStartTimeSetting.value;
     this.selectionDuration = this._selectionDurationSetting.value;
@@ -177,7 +178,12 @@
 
     get visibleDuration()
     {
-        return this._scrollContainer.offsetWidth * this._secondsPerPixel;
+        if (isNaN(this._cachedScrollContainerWidth)) {
+            this._cachedScrollContainerWidth = this._scrollContainer.offsetWidth;
+            console.assert(this._cachedScrollContainerWidth > 0);
+        }
+
+        return this._cachedScrollContainerWidth * this._secondsPerPixel;
     },
 
     get selectionStartTime()
@@ -215,6 +221,12 @@
         this.scrollStartTime = marker.time - (this.visibleDuration / 2);
     },
 
+    updateLayoutForResize: function()
+    {
+        this._cachedScrollContainerWidth = NaN;
+        this.updateLayout();
+    },
+
     updateLayout: function()
     {
         if (this._scheduledLayoutUpdateIdentifier) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to