Bug 200564 - REGRESSION(r248391): Web Inspector: changing Layout Direction Debug setting no longer adds dir="ltr" to body element
Summary: REGRESSION(r248391): Web Inspector: changing Layout Direction Debug setting n...
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: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-08 22:53 PDT by Nikita Vasilyev
Modified: 2019-08-12 20:57 PDT (History)
5 users (show)

See Also:


Attachments
Patch (2.40 KB, patch)
2019-08-09 00:18 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 Nikita Vasilyev 2019-08-08 22:53:37 PDT
This has to be recent.
Comment 1 Nikita Vasilyev 2019-08-08 23:04:14 PDT
  WI.resolvedLayoutDirection = function()
  {
      let layoutDirection = WI.settings.debugLayoutDirection.value;
->    if (!WI.isDebugUIEnabled() || layoutDirection === WI.LayoutDirection.System)
          layoutDirection = InspectorFrontendHost.userInterfaceLayoutDirection();
      return layoutDirection;
  };


WI.isDebugUIEnabled returns undefined:

    WI.isDebugUIEnabled = function()
    {
        return WI.showDebugUISetting && WI.showDebugUISetting.value;
    };

WI.showDebugUISetting is undefined. This is where it's created:

    // This function is invoked after the inspector has loaded and has a backend target.
    WI.runBootstrapOperations = function() {
        WI.showDebugUISetting = new WI.Setting("show-debug-ui", false);
Comment 2 Nikita Vasilyev 2019-08-08 23:08:39 PDT
Broke in https://trac.webkit.org/changeset/248391/webkit#file1
Comment 3 Nikita Vasilyev 2019-08-08 23:15:06 PDT
This line broke it.

Main.js:
- 2707    if (layoutDirection === WI.LayoutDirection.System)
+ 2707    if (!WI.isDebugUIEnabled() || layoutDirection === WI.LayoutDirection.System)
Comment 4 Devin Rousso 2019-08-08 23:36:44 PDT
This is something we don't want to expose outside of Web Inspector's debug mode (⌥⇧⌘D).

Are you saying that the layout direction doesn't work when NOT in the debug mode (⌥⇧⌘D)?
Comment 5 Nikita Vasilyev 2019-08-09 00:01:23 PDT
(In reply to Devin Rousso from comment #4)
> This is something we don't want to expose outside of Web Inspector's debug
> mode (⌥⇧⌘D).
> 
> Are you saying that the layout direction doesn't work when NOT in the debug
> mode (⌥⇧⌘D)?

It doesn't work in Debug mode.
Comment 6 Devin Rousso 2019-08-09 00:18:15 PDT
Created attachment 375897 [details]
Patch
Comment 7 Nikita Vasilyev 2019-08-09 02:02:19 PDT
This indeed fixes the regression. I'd r+.

Nit: I noticed that several settings are instantiated in WI.loaded() while none in Bootstrap.js. Would it be better to add this one to WI.loaded() as well for consistency?
Comment 8 Devin Rousso 2019-08-09 09:32:39 PDT
(In reply to Nikita Vasilyev from comment #7)
> Nit: I noticed that several settings are instantiated in WI.loaded() while none in Bootstrap.js. Would it be better to add this one to WI.loaded() as well for consistency?
`WI.loaded` exists just as a way to say "run this stuff once all the scripts have loaded, but potentially before we're done creating the DOM".  We primarily use it now for initial state setup (both UI and protocol).  Frankly, we could probably just inline all of that code inside the last script in Main.html/Test.html (or distribute it, as the comment in AppControllerBase.js suggests).

In the case of `WI.showDebugUISetting`, most of our other global state `WI.Setting` are created in Setting.js itself (e.g. when the script is parsed/executed, not in some event), I think it's fine to do a similar thing in Bootstrap.js.  Putting it in `WI.loaded` would have the same effect, just delayed slightly more.
Comment 9 Joseph Pecoraro 2019-08-12 20:46:09 PDT
Comment on attachment 375897 [details]
Patch

rs=me
Comment 10 WebKit Commit Bot 2019-08-12 20:56:44 PDT
Comment on attachment 375897 [details]
Patch

Clearing flags on attachment: 375897

Committed r248590: <https://trac.webkit.org/changeset/248590>
Comment 11 WebKit Commit Bot 2019-08-12 20:56:45 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Radar WebKit Bug Importer 2019-08-12 20:57:20 PDT
<rdar://problem/54240508>