RESOLVED FIXED 153731
Web Inspector: add a LayoutReason enum to the View base class
https://bugs.webkit.org/show_bug.cgi?id=153731
Summary Web Inspector: add a LayoutReason enum to the View base class
Matt Baker
Reported 2016-01-31 16:41:36 PST
* SUMMARY Add an updateLayoutForResize method to the View base class. A handful of classes cache the size/position of DOM elements to avoid unnecessary reflows during layout. It would be useful to have a generic way to inform a view that it's size has changed, and to propagate this to the view's children.
Attachments
[Patch] Proposed Fix (9.40 KB, patch)
2016-01-31 17:15 PST, Matt Baker
no flags
[Patch] Proposed Fix (12.75 KB, patch)
2016-02-01 16:06 PST, Matt Baker
no flags
[Patch] Proposed Fix (12.78 KB, patch)
2016-02-01 16:10 PST, Matt Baker
no flags
[Patch] Proposed Fix (12.77 KB, patch)
2016-02-01 16:37 PST, Matt Baker
no flags
Radar WebKit Bug Importer
Comment 1 2016-01-31 16:42:11 PST
Matt Baker
Comment 2 2016-01-31 17:15:22 PST
Created attachment 270355 [details] [Patch] Proposed Fix
Blaze Burg
Comment 3 2016-02-01 06:00:57 PST
Comment on attachment 270355 [details] [Patch] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=270355&action=review > Source/WebInspectorUI/ChangeLog:42 > + Overridden by views that need to perform resize logic, such as If this is always going to happen in the same event loop as the actual layout, what's the benefit of splitting this from updateLayoutForResize implementations?
Blaze Burg
Comment 4 2016-02-01 09:40:18 PST
(In reply to comment #3) > Comment on attachment 270355 [details] > [Patch] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=270355&action=review > > > Source/WebInspectorUI/ChangeLog:42 > > + Overridden by views that need to perform resize logic, such as > > If this is always going to happen in the same event loop as the actual > layout, what's the benefit of splitting this from updateLayoutForResize > implementations? Another way of thinking about this might be: can we pass a LayoutUpdateReason enum {Resize, Dirty} as an argument to updateLayout(), and would this be clearer than two separate methods with an implicit contract about the calling order? My hunch is yes, but maybe I'm missing something.
Matt Baker
Comment 5 2016-02-01 14:45:15 PST
(In reply to comment #4) > (In reply to comment #3) > > Comment on attachment 270355 [details] > > [Patch] Proposed Fix > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=270355&action=review > > > > > Source/WebInspectorUI/ChangeLog:42 > > > + Overridden by views that need to perform resize logic, such as > > > > If this is always going to happen in the same event loop as the actual > > layout, what's the benefit of splitting this from updateLayoutForResize > > implementations? > > Another way of thinking about this might be: can we pass a > LayoutUpdateReason enum {Resize, Dirty} as an argument to updateLayout(), > and would this be clearer than two separate methods with an implicit > contract about the calling order? My hunch is yes, but maybe I'm missing > something. I like this suggestion. The optional argument can be passed to needsLayout as well as updateLayout, making it more flexible than this approach. There used to exist an updateLayoutForResize method prior to all the View refactoring, which is what I initially based this on.
Matt Baker
Comment 6 2016-02-01 16:06:15 PST
Created attachment 270444 [details] [Patch] Proposed Fix
Matt Baker
Comment 7 2016-02-01 16:10:32 PST
Created attachment 270446 [details] [Patch] Proposed Fix
Blaze Burg
Comment 8 2016-02-01 16:32:37 PST
Comment on attachment 270446 [details] [Patch] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=270446&action=review r=me, but please check that TimelineRuler has not turned into a performance problem. > Source/WebInspectorUI/ChangeLog:41 > + update cached client width if resized. Nit: 'Update' > Source/WebInspectorUI/UserInterface/Views/View.js:304 > + Dirty: Symbol("layout-layoutReason-dirty"), Nit: view-layout-reason-dirty
Matt Baker
Comment 9 2016-02-01 16:33:43 PST
(In reply to comment #8) > Comment on attachment 270446 [details] > [Patch] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=270446&action=review > > r=me, but please check that TimelineRuler has not turned into a performance > problem. Did ad hoc testing, looks okay! > > > Source/WebInspectorUI/ChangeLog:41 > > + update cached client width if resized. > > Nit: 'Update' > > > Source/WebInspectorUI/UserInterface/Views/View.js:304 > > + Dirty: Symbol("layout-layoutReason-dirty"), > > Nit: view-layout-reason-dirty Find-replace error. Ugh.
Matt Baker
Comment 10 2016-02-01 16:37:45 PST
Created attachment 270451 [details] [Patch] Proposed Fix
WebKit Commit Bot
Comment 11 2016-02-01 17:27:30 PST
Comment on attachment 270451 [details] [Patch] Proposed Fix Clearing flags on attachment: 270451 Committed r195995: <http://trac.webkit.org/changeset/195995>
WebKit Commit Bot
Comment 12 2016-02-01 17:27:34 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.