Bug 127328 - Web Inspector: Move the Popover code out of the Breakpoint model object
Summary: Web Inspector: Move the Popover code out of the Breakpoint model object
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-01-20 18:42 PST by Timothy Hatcher
Modified: 2015-08-31 15:39 PDT (History)
5 users (show)

See Also:


Attachments
[Patch] Proposed Fix (39.83 KB, patch)
2015-08-30 22:45 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (41.02 KB, patch)
2015-08-31 14:27 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Patch] Proposed Fix (41.02 KB, patch)
2015-08-31 15:15 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Hatcher 2014-01-20 18:42:56 PST
The popover and DOM code in Breakpoint.js should move out and into a new class. This is a layering violation. Maybe BreakpointEditingController?
Comment 1 Radar WebKit Bug Importer 2014-02-14 09:52:53 PST
<rdar://problem/16070891>
Comment 2 Timothy Hatcher 2015-08-28 10:51:15 PDT
The context menu code should move too.
Comment 3 Matt Baker 2015-08-30 22:45:06 PDT
Created attachment 260275 [details]
[Patch] Proposed Fix
Comment 4 Timothy Hatcher 2015-08-31 11:13:51 PDT
Comment on attachment 260275 [details]
[Patch] Proposed Fix

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

Better, but I think this needs to be a controller that owns the Popover.

> Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverView.js:117
> +            let popover = new WebInspector.Popover();
> +            let popoverView = new WebInspector.BreakpointPopoverView(breakpoint, popover);
> +            popover.delegate = popoverView;
> +            popover.content = popoverView.element;

It is a bit odd that BreakpointPopoverView takes the popover and then popover.content and popover.delegate end up pointing to popoverView.

That makes BreakpointPopoverView more of a controller. That would likely let you internalize this.

> Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverView.js:297
> +WebInspector.BreakpointPopoverView.PopoverClassName = "edit-breakpoint-popover-content";

Any single use class names we have just been inlining them as strings.
Comment 5 Matt Baker 2015-08-31 11:50:08 PDT
(In reply to comment #4)
> Comment on attachment 260275 [details]
> [Patch] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=260275&action=review
> 
> Better, but I think this needs to be a controller that owns the Popover.
> 
> > Source/WebInspectorUI/UserInterface/Views/BreakpointPopoverView.js:117
> > +            let popover = new WebInspector.Popover();
> > +            let popoverView = new WebInspector.BreakpointPopoverView(breakpoint, popover);
> > +            popover.delegate = popoverView;
> > +            popover.content = popoverView.element;
> 
> It is a bit odd that BreakpointPopoverView takes the popover and then
> popover.content and popover.delegate end up pointing to popoverView.
> 
> That makes BreakpointPopoverView more of a controller. That would likely let
> you internalize this.

Yeah this is pretty awkward. A controller class is better suited to this.
Comment 6 Matt Baker 2015-08-31 14:27:06 PDT
Created attachment 260317 [details]
[Patch] Proposed Fix
Comment 7 Timothy Hatcher 2015-08-31 14:41:17 PDT
Comment on attachment 260317 [details]
[Patch] Proposed Fix

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

Nice!

> Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js:50
> +        this._breakpointPopoverController = new WebInspector.BreakpointPopoverController();

Drop the ().
Comment 8 Matt Baker 2015-08-31 15:15:04 PDT
Created attachment 260322 [details]
[Patch] Proposed Fix
Comment 9 WebKit Commit Bot 2015-08-31 15:39:52 PDT
Comment on attachment 260322 [details]
[Patch] Proposed Fix

Clearing flags on attachment: 260322

Committed r189189: <http://trac.webkit.org/changeset/189189>
Comment 10 WebKit Commit Bot 2015-08-31 15:39:56 PDT
All reviewed patches have been landed.  Closing bug.