Bug 148005 - Web Inspector: Long delay when row selection changes in timeline data grids
Summary: Web Inspector: Long delay when row selection changes in timeline data grids
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-08-13 17:49 PDT by Matt Baker
Modified: 2015-08-14 15:16 PDT (History)
8 users (show)

See Also:


Attachments
[Patch] Proposed Fix (2.97 KB, patch)
2015-08-13 17:57 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (3.12 KB, patch)
2015-08-13 18:31 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (3.07 KB, patch)
2015-08-14 13:54 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (3.07 KB, patch)
2015-08-14 14:29 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2015-08-13 17:49:15 PDT
* SUMMARY
Long delay when row selection changes in timeline data grids. The delay is noticeable in all timeline data grids, and is especially slow in the Rendering Frames view.

* STEPS TO REPRODUCE
1. Open Timeilnes -> Rendering Frames
2. Record a long timeline (> 100 frames)
3. Select a row
4. Click another row, or use keyboard up/down and attempt to quickly cycle through rows
  => 0.5 s - 1 s delay while row selection changes

* NOTES
Inspector^2 shows that tree element mouse down is taking 400-800 ms on average, of which most of the time is spent in NavigationBar.updateLayout, which calls realOffsetWidth for the bar element and for each navigation item element (each time forcing a page reflow). In the Timelines grid, NavigationBar.updateLayout is called 6 times when the row selection changes. In the Rendering Frames grid it's called 18 times!
Comment 1 Radar WebKit Bug Importer 2015-08-13 17:49:37 PDT
<rdar://problem/22280383>
Comment 2 Matt Baker 2015-08-13 17:57:05 PDT
Created attachment 258962 [details]
[Patch] Proposed Fix
Comment 3 Timothy Hatcher 2015-08-13 18:03:58 PDT
Comment on attachment 258962 [details]
[Patch] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js:466
> +        this._navigationBar.updateLayoutSoon();

I worry this will cause a disconnect between the DOM and what the layout becomes later. So you might see a flash of content then the layout happens later to adjust. A two step update instead of one. If updateLayoutSoon is using requestAnimationFrame, we should be fine.

> Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js:35
> +        this.navigationSidebarTreeOutline.allowsRepeatSelection = false;

We can do this for any sidebar that does not cause a view change. So all Timeline sidebar outlines now.
Comment 4 Matt Baker 2015-08-13 18:15:48 PDT
(In reply to comment #3)
> Comment on attachment 258962 [details]
> [Patch] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=258962&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js:466
> > +        this._navigationBar.updateLayoutSoon();
> 
> I worry this will cause a disconnect between the DOM and what the layout
> becomes later. So you might see a flash of content then the layout happens
> later to adjust. A two step update instead of one. If updateLayoutSoon is
> using requestAnimationFrame, we should be fine.
> 
> > Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js:35
> > +        this.navigationSidebarTreeOutline.allowsRepeatSelection = false;
> 
> We can do this for any sidebar that does not cause a view change. So all
> Timeline sidebar outlines now.

Except for the Debugger sidebar, which highlights breakpoint lines in the content view when the breakpoint's tree element is clicked.
Comment 5 Matt Baker 2015-08-13 18:16:14 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > Comment on attachment 258962 [details]
> > [Patch] Proposed Fix
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=258962&action=review
> > 
> > > Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js:466
> > > +        this._navigationBar.updateLayoutSoon();
> > 
> > I worry this will cause a disconnect between the DOM and what the layout
> > becomes later. So you might see a flash of content then the layout happens
> > later to adjust. A two step update instead of one. If updateLayoutSoon is
> > using requestAnimationFrame, we should be fine.
> > 
> > > Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js:35
> > > +        this.navigationSidebarTreeOutline.allowsRepeatSelection = false;
> > 
> > We can do this for any sidebar that does not cause a view change. So all
> > Timeline sidebar outlines now.
> 
> Except for the Debugger sidebar, which highlights breakpoint lines in the
> content view when the breakpoint's tree element is clicked.

All *timeline* sidebars. Right. :)
Comment 6 Timothy Hatcher 2015-08-13 18:25:57 PDT
We should flip the default for that property. Make it true explicitly for the debugger sidebar.
Comment 7 Matt Baker 2015-08-13 18:31:17 PDT
Created attachment 258968 [details]
[Patch] Proposed Fix
Comment 8 Matt Baker 2015-08-13 18:37:32 PDT
(In reply to comment #3)
> Comment on attachment 258962 [details]
> [Patch] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=258962&action=review
> 
> > Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js:466
> > +        this._navigationBar.updateLayoutSoon();
> 
> I worry this will cause a disconnect between the DOM and what the layout
> becomes later. So you might see a flash of content then the layout happens
> later to adjust. A two step update instead of one. If updateLayoutSoon is
> using requestAnimationFrame, we should be fine.

Filed a follow up: https://bugs.webkit.org/show_bug.cgi?id=148010

> > Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js:35
> > +        this.navigationSidebarTreeOutline.allowsRepeatSelection = false;
> 
> We can do this for any sidebar that does not cause a view change. So all
> Timeline sidebar outlines now.

Updated to set allowsRepeatSelection = false for all TimelineSidebarPanel tree outlines.
Comment 9 Timothy Hatcher 2015-08-13 18:43:16 PDT
Comment on attachment 258968 [details]
[Patch] Proposed Fix

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

> Source/WebInspectorUI/UserInterface/Views/TimelineSidebarPanel.js:232
> +        treeOutline.allowsRepeatSelection = false;

Actually this will break the sidebar when a non-timeline content view is showing, since we still jump to locations on select in that case. Was there any other reason to change this?
Comment 10 Matt Baker 2015-08-14 13:54:14 PDT
Created attachment 259037 [details]
[Patch] Proposed Fix
Comment 11 BJ Burg 2015-08-14 14:07:30 PDT
Comment on attachment 259037 [details]
[Patch] Proposed Fix

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

> Source/WebInspectorUI/ChangeLog:14
> +        Call updateLayoutSoon instead of updateLayout to compress layout requests.

'coalesce'
Comment 12 BJ Burg 2015-08-14 14:15:33 PDT
Comment on attachment 259037 [details]
[Patch] Proposed Fix

r=me
Comment 13 Matt Baker 2015-08-14 14:29:24 PDT
Created attachment 259041 [details]
[Patch] Proposed Fix
Comment 14 WebKit Commit Bot 2015-08-14 15:15:57 PDT
Comment on attachment 259041 [details]
[Patch] Proposed Fix

Clearing flags on attachment: 259041

Committed r188494: <http://trac.webkit.org/changeset/188494>
Comment 15 WebKit Commit Bot 2015-08-14 15:16:02 PDT
All reviewed patches have been landed.  Closing bug.