Title: [179701] trunk/Source/WebInspectorUI
Revision
179701
Author
[email protected]
Date
2015-02-05 12:12:38 -0800 (Thu, 05 Feb 2015)

Log Message

Web Inspector: eliminate some unnecessary layout/painting in timeline overview and ruler
https://bugs.webkit.org/show_bug.cgi?id=141293

Reviewed by Timothy Hatcher.

The timeline overview's ruler was forcing repaints of divider labels even if the labels
had not changed since the last requestAnimationFrame. Bail out early if nothing changed.

The timeline overview and its graphs were updating layout using requestAnimationFrame
even when the TimelineContentView is not visible. Fix this by propagating visibility
changes to subviews, and not updating layout when hidden.

The above change also fixes an assertion sometimes encountered when the timeline view
tries to cache an element's offset width, but cannot because it isn't visible.

* UserInterface/Views/TimelineContentView.js:
(WebInspector.TimelineContentView.prototype.shown):
(WebInspector.TimelineContentView.prototype.hidden):
* UserInterface/Views/TimelineOverview.js:
(WebInspector.TimelineOverview.prototype.get visible):
(WebInspector.TimelineOverview.prototype.shown):
(WebInspector.TimelineOverview.prototype.hidden):
(WebInspector.TimelineOverview.prototype._needsLayout):
* UserInterface/Views/TimelineOverviewGraph.js:
(WebInspector.TimelineOverviewGraph.prototype.get visible):
(WebInspector.TimelineOverviewGraph.prototype.shown):
(WebInspector.TimelineOverviewGraph.prototype.hidden):
(WebInspector.TimelineOverviewGraph.prototype.needsLayout):
* UserInterface/Views/TimelineRuler.js:
(WebInspector.TimelineRuler.prototype.updateLayout):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (179700 => 179701)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-02-05 19:49:37 UTC (rev 179700)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-02-05 20:12:38 UTC (rev 179701)
@@ -1,3 +1,36 @@
+2015-02-05  Brian J. Burg  <[email protected]>
+
+        Web Inspector: eliminate some unnecessary layout/painting in timeline overview and ruler
+        https://bugs.webkit.org/show_bug.cgi?id=141293
+
+        Reviewed by Timothy Hatcher.
+
+        The timeline overview's ruler was forcing repaints of divider labels even if the labels
+        had not changed since the last requestAnimationFrame. Bail out early if nothing changed.
+
+        The timeline overview and its graphs were updating layout using requestAnimationFrame
+        even when the TimelineContentView is not visible. Fix this by propagating visibility
+        changes to subviews, and not updating layout when hidden.
+
+        The above change also fixes an assertion sometimes encountered when the timeline view
+        tries to cache an element's offset width, but cannot because it isn't visible.
+
+        * UserInterface/Views/TimelineContentView.js:
+        (WebInspector.TimelineContentView.prototype.shown):
+        (WebInspector.TimelineContentView.prototype.hidden):
+        * UserInterface/Views/TimelineOverview.js:
+        (WebInspector.TimelineOverview.prototype.get visible):
+        (WebInspector.TimelineOverview.prototype.shown):
+        (WebInspector.TimelineOverview.prototype.hidden):
+        (WebInspector.TimelineOverview.prototype._needsLayout):
+        * UserInterface/Views/TimelineOverviewGraph.js:
+        (WebInspector.TimelineOverviewGraph.prototype.get visible):
+        (WebInspector.TimelineOverviewGraph.prototype.shown):
+        (WebInspector.TimelineOverviewGraph.prototype.hidden):
+        (WebInspector.TimelineOverviewGraph.prototype.needsLayout):
+        * UserInterface/Views/TimelineRuler.js:
+        (WebInspector.TimelineRuler.prototype.updateLayout):
+
 2015-02-04  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: ES6: Improved Console Support for Symbol Objects

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js (179700 => 179701)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2015-02-05 19:49:37 UTC (rev 179700)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2015-02-05 20:12:38 UTC (rev 179701)
@@ -167,8 +167,12 @@
         if (!this._currentTimelineView)
             return;
 
+        this._timelineOverview.shown();
         this._currentTimelineView.shown();
         this._clearTimelineNavigationItem.enabled = this._recording.isWritable();
+
+        if (!this._updating && WebInspector.timelineManager.activeRecording === this._recording && WebInspector.timelineManager.isCapturing())
+            this._startUpdatingCurrentTime();
     },
 
     hidden: function()
@@ -176,7 +180,11 @@
         if (!this._currentTimelineView)
             return;
 
+        this._timelineOverview.hidden();
         this._currentTimelineView.hidden();
+
+        if (this._updating)
+            this._stopUpdatingCurrentTime();
     },
 
     filterDidChange: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js (179700 => 179701)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-02-05 19:49:37 UTC (rev 179700)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js	2015-02-05 20:12:38 UTC (rev 179701)
@@ -211,6 +211,29 @@
         this._timelineRuler.selectionEndTime = this._timelineRuler.selectionStartTime + x;
     },
 
+    get visible()
+    {
+        return this._visible;
+    },
+
+    shown: function()
+    {
+        this._visible = true;
+
+        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
+            timelineOverviewGraph.shown();
+
+        this.updateLayout();
+    },
+
+    hidden: function()
+    {
+        this._visible = false;
+
+        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
+            timelineOverviewGraph.hidden();
+    },
+
     addMarker: function(marker)
     {
         this._timelineRuler.addMarker(marker);
@@ -298,8 +321,12 @@
 
     _needsLayout: function()
     {
+        if (!this._visible)
+            return;
+
         if (this._scheduledLayoutUpdateIdentifier)
             return;
+
         this._scheduledLayoutUpdateIdentifier = requestAnimationFrame(this.updateLayout.bind(this));
     },
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js (179700 => 179701)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2015-02-05 19:49:37 UTC (rev 179700)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverviewGraph.js	2015-02-05 20:12:38 UTC (rev 179701)
@@ -139,6 +139,22 @@
         this._timelineOverview = x;
     },
 
+    get visible()
+    {
+        return this._visible;
+    },
+
+    shown: function()
+    {
+        this._visible = true;
+        this.updateLayout();
+    },
+
+    hidden: function()
+    {
+        this._visible = false;
+    },
+
     reset: function()
     {
         // Implemented by sub-classes if needed.
@@ -165,6 +181,9 @@
 
     needsLayout: function()
     {
+        if (!this._visible)
+            return;
+
         if (this._scheduledLayoutUpdateIdentifier)
             return;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (179700 => 179701)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-02-05 19:49:37 UTC (rev 179700)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js	2015-02-05 20:12:38 UTC (rev 179701)
@@ -348,6 +348,16 @@
         if (!this._endTimePinned)
             ++dividerCount;
 
+        var dividerData = {
+            count: dividerCount,
+            firstTime: firstDividerTime,
+            lastTime: lastDividerTime,
+        }
+
+        if (Object.shallowEqual(dividerData, this._currentDividers))
+            return;
+        this._currentDividers = dividerData;
+
         var markerDividers = this._markersElement.querySelectorAll("." + WebInspector.TimelineRuler.DividerElementStyleClassName);
 
         var dividerElement = this._headerElement.firstChild;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to