Bug 142779

Summary: Web Inspector: Debugger sidebar should have a filter button for breakpoints
Product: WebKit Reporter: Jonathan Wells <jonowells>
Component: Web InspectorAssignee: Jonathan Wells <jonowells>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Added filter button.
none
[SCREENSHOT] Filter is off.
none
[SCREENSHOT] Filter is on.
none
[SCREENSHOT] Button and text filter applied.
none
[PATCH] with JoePeck feedback
none
[PATCH] Corrected patch based on feedback. timothy: review+

Description Jonathan Wells 2015-03-17 02:43:20 PDT
Currently the debugger sidebar always shows any and all debuggable resources. This should be optional and set by a button on the filter bar similar to the Xcode style.

<rdar://problem/19524415>
Comment 1 Jonathan Wells 2015-03-17 03:06:46 PDT
Created attachment 248836 [details]
[PATCH] Added filter button.
Comment 2 Jonathan Wells 2015-03-17 03:09:12 PDT
Created attachment 248837 [details]
[SCREENSHOT] Filter is off.
Comment 3 Jonathan Wells 2015-03-17 03:10:00 PDT
Created attachment 248838 [details]
[SCREENSHOT] Filter is on.
Comment 4 Jonathan Wells 2015-03-17 03:10:39 PDT
Created attachment 248839 [details]
[SCREENSHOT] Button and text filter applied.
Comment 5 Jonathan Wells 2015-03-17 03:11:56 PDT
Look at the screenshots. We probably want another icon for the button.
Comment 6 Joseph Pecoraro 2015-03-17 12:19:31 PDT
Comment on attachment 248836 [details]
[PATCH] Added filter button.

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

> Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:57
>      var breakpointsImage, pauseImage, resumeImage, stepOverImage, stepIntoImage, stepOutImage;

Style: You can now move these var's inline (60-65).

> Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:108
> +        return treeElement instanceof WebInspector.ResourceTreeElement && !treeElement.hasChildren;

This condition seems the opposite of what I would want it to be.

I'd want the filter to be a predicate that says "true = show, false = hide". Because it is much easier to say "this is what I want to show" then "this is everything that should be hidden".

However, when reading the condition, "ResourceTreeElement && !children" = true => show, is not the case.

> Source/WebInspectorUI/UserInterface/Views/FilterBarButton.js:2
> + * Copyright (C) 2013 Apple Inc. All rights reserved.

2015.

> Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js:320
> +            // If the filter function returns true for a treeElement, that element should be hidden.
> +            if (filterFunction(treeElement))
> +                return false;

This is what I think should be flipped.
Comment 7 Jonathan Wells 2015-03-17 15:51:50 PDT
Comment on attachment 248836 [details]
[PATCH] Added filter button.

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

>> Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:108
>> +        return treeElement instanceof WebInspector.ResourceTreeElement && !treeElement.hasChildren;
> 
> This condition seems the opposite of what I would want it to be.
> 
> I'd want the filter to be a predicate that says "true = show, false = hide". Because it is much easier to say "this is what I want to show" then "this is everything that should be hidden".
> 
> However, when reading the condition, "ResourceTreeElement && !children" = true => show, is not the case.

Yeah I struggled with this too. I'll change it.

>> Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js:320
>> +                return false;
> 
> This is what I think should be flipped.

Right, that works as long as the filters functions return true of things you want to keep, as you suggested. Will change.
Comment 8 Jonathan Wells 2015-03-18 16:51:03 PDT
Created attachment 248988 [details]
[PATCH] with JoePeck feedback
Comment 9 Jonathan Wells 2015-03-18 21:13:10 PDT
Created attachment 249014 [details]
[PATCH] Corrected patch based on feedback.
Comment 10 Timothy Hatcher 2015-03-23 13:49:39 PDT
Comment on attachment 249014 [details]
[PATCH] Corrected patch based on feedback.

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

> Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:119
> +    };
> +    this.filterBar.addFilterBarButton("debugger-show-resources-with-children-only", showResourcesWithBreakpointsOnlyFilterFunction, false, WebInspector.UIString("Show only resources with breakpoints."), WebInspector.UIString("Show resources with and without breakpoints."), platformImagePath("Breakpoints.svg"), 15, 15);

Newline between these lines? Pass true to enable this by default.
Comment 11 Jonathan Wells 2015-03-23 15:01:03 PDT
Committed r181872: <http://trac.webkit.org/changeset/181872>