Bug 172304 - Web Inspector: Use initialLayout for Settings tab
Summary: Web Inspector: Use initialLayout for Settings tab
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: Devin Rousso
URL:
Keywords:
Depends on:
Blocks: 172303
  Show dependency treegraph
 
Reported: 2017-05-18 12:47 PDT by Devin Rousso
Modified: 2017-05-19 11:02 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.24 KB, patch)
2017-05-18 12:52 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] Timeline Before (474.70 KB, image/png)
2017-05-18 12:52 PDT, Devin Rousso
no flags Details
[Image] Timeline After (498.11 KB, image/png)
2017-05-18 12:52 PDT, Devin Rousso
no flags Details
Patch (4.69 KB, patch)
2017-05-18 14:49 PDT, Devin Rousso
mattbaker: review+
Details | Formatted Diff | Diff
Patch (4.48 KB, patch)
2017-05-19 09:55 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2017-05-18 12:47:36 PDT
The creation of the SettingView objects does not need to happen when the Settings tab is created.
Comment 1 Devin Rousso 2017-05-18 12:52:05 PDT
Created attachment 310537 [details]
Patch
Comment 2 Devin Rousso 2017-05-18 12:52:32 PDT
Created attachment 310538 [details]
[Image] Timeline Before
Comment 3 Devin Rousso 2017-05-18 12:52:43 PDT
Created attachment 310539 [details]
[Image] Timeline After
Comment 4 Matt Baker 2017-05-18 13:57:59 PDT
Nice work!

Eventually we should audit our view classes for more opportunities to use initialLayout (as we discussed IRL the other day).

In the past this has only been problematic when a view does background work before being shown, and assumes the existence of it's DOM. Ideally, hidden views would never modify their DOM, but our ad-hoc visibility model makes consistency difficult here.
Comment 5 Joseph Pecoraro 2017-05-18 14:02:26 PDT
Comment on attachment 310537 [details]
Patch

Lets do more then one of these in a single patch. You can probably find 5-10 cases of this instead of just doing SettingsTab, and hopefully from there we will see a meaningful total impact.
Comment 6 Joseph Pecoraro 2017-05-18 14:03:42 PDT
(In reply to Joseph Pecoraro from comment #5)
> Lets do more then one of these in a single patch. You can probably find 5-10
> cases of this instead of just doing SettingsTab, and hopefully from there we
> will see a meaningful total impact.

You should also verify that initialLayout doesn't happen until you open the Settings tab. If it is still happening at some point in the loading process then all we've done would be moving the time somewhere else but still doing it at startup.

I trust you've done that but just making certain.
Comment 7 Matt Baker 2017-05-18 14:12:38 PDT
Comment on attachment 310537 [details]
Patch

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

r=me. Please add at least a short summary to the change log mentioning the motivation for the change.

> Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js:171
> +        WebInspector.settings.zoomFactor.addEventListener(WebInspector.Setting.Event.Changed, boundNeedsLayout);

I realize this was just moved from the constructor, but it seems like a layering violation having the tab know about specific settings. It should be up to GeneralSettingsView to update itself. A general solution would be even better, where SettingEditor updates itself whenever the value of its backing setting changes.
Comment 8 Matt Baker 2017-05-18 14:13:35 PDT
Comment on attachment 310537 [details]
Patch

Clearing r+ in light of Joe's comments.
Comment 9 Devin Rousso 2017-05-18 14:49:42 PDT
Created attachment 310554 [details]
Patch
Comment 10 Matt Baker 2017-05-18 16:21:42 PDT
Comment on attachment 310554 [details]
Patch

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

r=me, with a comment

> Source/WebInspectorUI/ChangeLog:16
> +        Move the code for doing this to initialLayout ensures it to happens once, but only after the

Awkward wording, maybe: "Use initialLayout to ensure UI gets created exactly once, after the tab is selected."

> Source/WebInspectorUI/UserInterface/Views/GeneralSettingsView.js:84
> +        WebInspector.settings.zoomFactor.addEventListener(WebInspector.Setting.Event.Changed, () => { zoomEditor.value = WebInspector.getZoomFactor().maxDecimals(2); });

Nice, it looks like the control wasn't updating at all before:

1. Open Settings (pre-patch)
2. Scroll / resize so Zoom level is visible
3. Hit Cmd-+/-
  => Still says 100%
Comment 11 Devin Rousso 2017-05-19 09:55:44 PDT
Created attachment 310666 [details]
Patch
Comment 12 WebKit Commit Bot 2017-05-19 11:02:36 PDT
Comment on attachment 310666 [details]
Patch

Clearing flags on attachment: 310666

Committed r217132: <http://trac.webkit.org/changeset/217132>
Comment 13 WebKit Commit Bot 2017-05-19 11:02:37 PDT
All reviewed patches have been landed.  Closing bug.