Changeset 195504 in webkit


Ignore:
Timestamp:
Jan 22, 2016 10:46:56 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Reduce unnecessary forced layouts in TimelineRuler
https://bugs.webkit.org/show_bug.cgi?id=153390
<rdar://problem/24312241>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-01-22
Reviewed by Timothy Hatcher.

TimelineRuler's width rarely changes. It should only need to calculate
its width when added to the DOM or if the content view containing it
has resized and the bounds of the ruler may have changed.

Switch everything in TimelineRuler to using a cached width, and add
an explicit method, resize, to update this width. This eliminated
frequent hangs I was seeing while recording timelines.

  • UserInterface/Views/OverviewTimelineView.js:

(WebInspector.OverviewTimelineView.prototype.shown):
(WebInspector.OverviewTimelineView.prototype.updateLayoutForResize):
Resize the ruler when the view is shown or resized.

  • UserInterface/Views/TimelineOverview.js:

(WebInspector.TimelineOverview.prototype.shown):
(WebInspector.TimelineOverview.prototype.updateLayoutForResize):
Resize the ruler when the view is shown or resized.

  • UserInterface/Views/TimelineRecordingContentView.js:

(WebInspector.TimelineRecordingContentView.prototype.layout):
Inform the current content view of a resize if possible.

  • UserInterface/Views/TimelineRuler.js:

(WebInspector.TimelineRuler.prototype.resize):
Update the width.

(WebInspector.TimelineRuler.prototype._recalculate):
(WebInspector.TimelineRuler.prototype._needsMarkerLayout):
(WebInspector.TimelineRuler.prototype._needsSelectionLayout):
(WebInspector.TimelineRuler.prototype._handleMouseMove):
(WebInspector.TimelineRuler.prototype._handleSelectionHandleMouseMove):
Use cached width.

  • UserInterface/Views/TimelineRecordBar.js:

(WebInspector.TimelineRecordBar.createCombinedBars): Deleted.
Remove some stale code.

Location:
trunk/Source/WebInspectorUI
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r195456 r195504  
     12016-01-22  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Reduce unnecessary forced layouts in TimelineRuler
     4        https://bugs.webkit.org/show_bug.cgi?id=153390
     5        <rdar://problem/24312241>
     6
     7        Reviewed by Timothy Hatcher.
     8
     9        TimelineRuler's width rarely changes. It should only need to calculate
     10        its width when added to the DOM or if the content view containing it
     11        has resized and the bounds of the ruler may have changed.
     12
     13        Switch everything in TimelineRuler to using a cached width, and add
     14        an explicit method, resize, to update this width. This eliminated
     15        frequent hangs I was seeing while recording timelines.
     16
     17        * UserInterface/Views/OverviewTimelineView.js:
     18        (WebInspector.OverviewTimelineView.prototype.shown):
     19        (WebInspector.OverviewTimelineView.prototype.updateLayoutForResize):
     20        Resize the ruler when the view is shown or resized.
     21
     22        * UserInterface/Views/TimelineOverview.js:
     23        (WebInspector.TimelineOverview.prototype.shown):
     24        (WebInspector.TimelineOverview.prototype.updateLayoutForResize):
     25        Resize the ruler when the view is shown or resized.
     26
     27        * UserInterface/Views/TimelineRecordingContentView.js:
     28        (WebInspector.TimelineRecordingContentView.prototype.layout):
     29        Inform the current content view of a resize if possible.
     30
     31        * UserInterface/Views/TimelineRuler.js:
     32        (WebInspector.TimelineRuler.prototype.resize):
     33        Update the width.
     34
     35        (WebInspector.TimelineRuler.prototype._recalculate):
     36        (WebInspector.TimelineRuler.prototype._needsMarkerLayout):
     37        (WebInspector.TimelineRuler.prototype._needsSelectionLayout):
     38        (WebInspector.TimelineRuler.prototype._handleMouseMove):
     39        (WebInspector.TimelineRuler.prototype._handleSelectionHandleMouseMove):
     40        Use cached width.
     41
     42        * UserInterface/Views/TimelineRecordBar.js:
     43        (WebInspector.TimelineRecordBar.createCombinedBars): Deleted.
     44        Remove some stale code.
     45
    1462016-01-22  Devin Rousso  <dcrousso+webkit@gmail.com>
    247
  • trunk/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js

    r192086 r195504  
    8282
    8383        this._treeOutlineDataGridSynchronizer.synchronize();
     84        this._timelineRuler.resize();
    8485    }
    8586
     
    158159
    159160        WebInspector.showOriginalOrFormattedSourceCodeLocation(treeElement.sourceCodeTimeline.sourceCodeLocation);
     161    }
     162
     163    updateLayoutForResize()
     164    {
     165        this._timelineRuler.resize();
    160166    }
    161167
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js

    r194029 r195504  
    258258        this._visible = true;
    259259
     260        this._timelineRuler.resize()
     261
    260262        for (var timelineOverviewGraph of this._timelineOverviewGraphsMap.values())
    261263            timelineOverviewGraph.shown();
     
    314316    {
    315317        this._cachedScrollContainerWidth = NaN;
     318        this._timelineRuler.resize()
    316319        this.updateLayout();
    317320    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.js

    r191159 r195504  
    126126        }
    127127
    128         lastRecordType = null;
    129 
    130128        var activeStartTime = NaN;
    131129        var activeEndTime = NaN;
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js

    r194932 r195504  
    325325    {
    326326        this._currentTimelineOverview.updateLayoutForResize();
     327
     328        let currentContentView = this._contentViewContainer.currentContentView;
     329        if (currentContentView && currentContentView.updateLayoutForResize)
     330            currentContentView.updateLayoutForResize();
    327331    }
    328332
  • trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js

    r194686 r195504  
    507507            this._scheduledMarkerLayoutUpdateIdentifier = undefined;
    508508
    509             let visibleWidth = this.element.clientWidth;
     509            let visibleWidth = this._cachedClientWidth;
    510510            if (visibleWidth <= 0)
    511511                return;
     
    530530            this._scheduledSelectionLayoutUpdateIdentifier = undefined;
    531531
    532             let visibleWidth = this.element.clientWidth;
     532            let visibleWidth = this._cachedClientWidth;
    533533            if (visibleWidth <= 0)
    534534                return;
     
    538538    }
    539539
     540    resize()
     541    {
     542        this._cachedClientWidth = this.element.clientWidth;
     543        this._recalculate();
     544    }
     545
    540546    _recalculate()
    541547    {
    542         let visibleWidth = this.element.clientWidth;
     548        let visibleWidth = this._cachedClientWidth;
    543549        if (visibleWidth <= 0)
    544550            return 0;
     
    733739        }
    734740
    735         this._updateSelection(this.element.clientWidth, this.duration);
     741        this._updateSelection(this._cachedClientWidth, this.duration);
    736742
    737743        event.preventDefault();
     
    827833        }
    828834
    829         this._updateSelection(this.element.clientWidth, this.duration);
     835        this._updateSelection(this._cachedClientWidth, this.duration);
    830836
    831837        event.preventDefault();
Note: See TracChangeset for help on using the changeset viewer.