Bug 153392 - Web Inspector: Reduce unnecessary forced layouts in TimelineOverview
Summary: Web Inspector: Reduce unnecessary forced layouts in TimelineOverview
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-01-22 21:42 PST by Joseph Pecoraro
Modified: 2016-01-25 11:49 PST (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (1.82 KB, patch)
2016-01-22 21:44 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-01-22 21:42:32 PST
* SUMMARY
Reduce unnecessary forced layouts in TimelineOverview.

It looks like autoscroll when not autoscrolling would set the scrollContainerElement.scrollLeft to 0 (which it already was) and force a synchronous layout. Seems we can just skip this work if the calculated scrollLeft value would have been 0. This eliminated the forced layouts I saw triggered by TimelineOverview recording reloads of numerous pages.
Comment 1 Radar WebKit Bug Importer 2016-01-22 21:42:49 PST
<rdar://problem/24312344>
Comment 2 Joseph Pecoraro 2016-01-22 21:44:00 PST
Created attachment 269646 [details]
[PATCH] Proposed Fix
Comment 3 Timothy Hatcher 2016-01-22 22:00:41 PST
Comment on attachment 269646 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=269646&action=review

> Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js:390
> +            if (scrollLeft)

Does this need to be: scrollLeft || this._scrollContainerElement.scrollLeft

That way if it is no zero already it will set it still. Or scrollLeft !== this._scrollContainerElement.scrollLeft
Comment 4 Joseph Pecoraro 2016-01-25 11:01:01 PST
(In reply to comment #3)
> Comment on attachment 269646 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=269646&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/TimelineOverview.js:390
> > +            if (scrollLeft)
> 
> Does this need to be: scrollLeft || this._scrollContainerElement.scrollLeft
> 
> That way if it is no zero already it will set it still. Or scrollLeft !==
> this._scrollContainerElement.scrollLeft

This was intentional.

I do not want to actually call `element.scrollLeft` since that could force a layout. I don't think autoscroll will every intentionally scroll you to zero. Starting a new recording automatically resets the scroll position anyways. So this was a cheap hack, if the scrollLeft we calculate is zero, do no work. I didn't find any cases where this was a problem, and I saw fewer (zero) forced layouts caused by TimelineOverview in reload recordings that didn't cause the overview to auto-scroll.
Comment 5 WebKit Commit Bot 2016-01-25 11:48:55 PST
Comment on attachment 269646 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 269646

Committed r195544: <http://trac.webkit.org/changeset/195544>
Comment 6 WebKit Commit Bot 2016-01-25 11:49:00 PST
All reviewed patches have been landed.  Closing bug.