Bug 195522 - Web Inspector: DOM Debugger: remove left padding when the last DOM breakpoint is removed
Summary: Web Inspector: DOM Debugger: remove left padding when the last DOM breakpoint...
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-03-09 11:36 PST by Devin Rousso
Modified: 2019-03-12 12:04 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.02 KB, patch)
2019-03-09 11:37 PST, 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 2019-03-09 11:36:58 PST
.
Comment 1 Devin Rousso 2019-03-09 11:37:41 PST
Created attachment 364136 [details]
Patch
Comment 2 Matt Baker 2019-03-12 11:50:25 PDT
Comment on attachment 364136 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:782
> +        this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);

Nice! I think keeping the early return makes it read better, and with your changes it's cleaner still:

if (!breakpoints.length) {
    treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.None;
    return;
}

if (breakpoints.some((item) => item.disabled))
    treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;
else
    treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.Breakpoint;

this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);
Comment 3 Matt Baker 2019-03-12 11:50:59 PDT
Comment on attachment 364136 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:782
>> +        this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);
> 
> Nice! I think keeping the early return makes it read better, and with your changes it's cleaner still:
> 
> if (!breakpoints.length) {
>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.None;
>     return;
> }
> 
> if (breakpoints.some((item) => item.disabled))
>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;
> else
>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.Breakpoint;
> 
> this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);

Oh right, the early return. ;)
Comment 4 Matt Baker 2019-03-12 11:52:33 PDT
Comment on attachment 364136 [details]
Patch

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

>>> Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:782
>>> +        this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);
>> 
>> Nice! I think keeping the early return makes it read better, and with your changes it's cleaner still:
>> 
>> if (!breakpoints.length) {
>>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.None;
>>     return;
>> }
>> 
>> if (breakpoints.some((item) => item.disabled))
>>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;
>> else
>>     treeElement.breakpointStatus = WI.DOMTreeElement.BreakpointStatus.Breakpoint;
>> 
>> this.breakpointGutterEnabled = this._domTreeOutline.children.some((child) => child.hasBreakpoint);
> 
> Oh right, the early return. ;)

I guess `this.breakpointGutterEnabled = ...` could be moved above an early return, and it would still work, but I think it's fine as is.
Comment 5 WebKit Commit Bot 2019-03-12 12:03:07 PDT
Comment on attachment 364136 [details]
Patch

Clearing flags on attachment: 364136

Committed r242811: <https://trac.webkit.org/changeset/242811>
Comment 6 WebKit Commit Bot 2019-03-12 12:03:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Radar WebKit Bug Importer 2019-03-12 12:04:22 PDT
<rdar://problem/48817670>