Bug 69341 - Web Inspector: Fix GoToLineDialog and extract common dialog functionality.
Summary: Web Inspector: Fix GoToLineDialog and extract common dialog functionality.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Vsevolod Vlasov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 08:44 PDT by Vsevolod Vlasov
Modified: 2012-01-16 02:53 PST (History)
13 users (show)

See Also:


Attachments
Patch (28.17 KB, patch)
2011-10-04 10:13 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (28.15 KB, patch)
2011-10-04 12:29 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (comments addressed) (30.41 KB, patch)
2011-10-05 12:16 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (30.23 KB, patch)
2011-10-06 02:45 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (20.66 KB, patch)
2011-10-11 09:59 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff
Patch (20.66 KB, patch)
2011-10-11 10:13 PDT, Vsevolod Vlasov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vsevolod Vlasov 2011-10-04 08:44:18 PDT
Fix GoToLineDialog and extract common dialog functionality.

- In current implementation dialog never hides if you press mouse button on Go button and releae it somewhere else.
- Same dialog functionality will be used for search.
Comment 1 Vsevolod Vlasov 2011-10-04 10:13:01 PDT
Created attachment 109637 [details]
Patch
Comment 2 Vsevolod Vlasov 2011-10-04 12:29:09 PDT
Created attachment 109666 [details]
Patch
Comment 3 Pavel Feldman 2011-10-05 00:02:11 PDT
Comment on attachment 109666 [details]
Patch

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

> Source/WebCore/inspector/front-end/GoToLineDialogView.js:31
> +WebInspector.GoToLineDialogView = function(view)

@implements

> Source/WebCore/inspector/front-end/GoToLineDialogView.js:32
> +{

Please add new classes to the compilation.

> Source/WebCore/inspector/front-end/GoToLineDialogView.js:65
> +    WebInspector.PanelDialog.show(sourceView, new WebInspector.GoToLineDialogView(sourceView));

It is usually expressed as:

new WebInspector.Dialog(new WebInspector.GoToLineDialogDelegate()).show()

creating an instance is generally useful when you'd like to have a programmatic way of closing the dialog from within the content.

> Source/WebCore/inspector/front-end/PanelDialog.js:29
> +WebInspector.PanelDialog = function(parentView, dialogView)

What does "Panel" part of the name mean? It is not related to WebInspector.Panel, right?

> Source/WebCore/inspector/front-end/PanelDialog.js:46
> +    var focusableElements = dialogView.focusableElements;

This seems fragile. What if the delegate screws this? You don't really need the list of focusable elements to close dialog on lose focus. We typically use "glass pane" to solve this (see SoftContextMenu.js)

> Source/WebCore/inspector/front-end/PanelDialog.js:96
> +        setTimeout(onTimeout.bind(this), 0);

This is a hack, you should not need that.

> Source/WebCore/inspector/front-end/PanelDialog.js:135
> +WebInspector.PanelDialogView = function()

Please declare as @interface with members defined in one line each. (get mainInput() { })

Also, naming of this class is confusing. It should either inherit from View or be named differently. Should either be WebInspector.Dialog.Delegate or WebInspector.Dialog.Model.

> Source/WebCore/inspector/front-end/panelDialogs.css:1
> +.panel-dialog {

.panel is confusing here as well
Comment 4 Vsevolod Vlasov 2011-10-05 12:16:43 PDT
Created attachment 109835 [details]
Patch (comments addressed)
Comment 5 Vsevolod Vlasov 2011-10-05 15:07:36 PDT
(In reply to comment #3)
> (From update of attachment 109666 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=109666&action=review
> 
> > Source/WebCore/inspector/front-end/GoToLineDialogView.js:31
> > +WebInspector.GoToLineDialogView = function(view)
> 
> @implements
Done

> > Source/WebCore/inspector/front-end/GoToLineDialogView.js:32
> > +{
> 
> Please add new classes to the compilation.
Done

> > Source/WebCore/inspector/front-end/GoToLineDialogView.js:65
> > +    WebInspector.PanelDialog.show(sourceView, new WebInspector.GoToLineDialogView(sourceView));
> 
> It is usually expressed as:
> 
> new WebInspector.Dialog(new WebInspector.GoToLineDialogDelegate()).show()
> 
> creating an instance is generally useful when you'd like to have a programmatic way of closing the dialog from within the content.
As discussed offline this dialog is implemented as a singletone and the only instance is available inside Dialog.js as WeBInspector.Dialog._instance.

> > Source/WebCore/inspector/front-end/PanelDialog.js:29
> > +WebInspector.PanelDialog = function(parentView, dialogView)
> 
> What does "Panel" part of the name mean? It is not related to WebInspector.Panel, right?
Renamed to Dialog.
> 
> > Source/WebCore/inspector/front-end/PanelDialog.js:46
> > +    var focusableElements = dialogView.focusableElements;
> 
> This seems fragile. What if the delegate screws this? You don't really need the list of focusable elements to close dialog on lose focus. We typically use "glass pane" to solve this (see SoftContextMenu.js)
Implemented based on glass pane.

> > Source/WebCore/inspector/front-end/PanelDialog.js:135
> > +WebInspector.PanelDialogView = function()
> 
> Please declare as @interface with members defined in one line each. (get mainInput() { })
I forgot to do this in the patch, will address in the next version.

> Also, naming of this class is confusing. It should either inherit from View or be named differently. Should either be WebInspector.Dialog.Delegate or WebInspector.Dialog.Model.
Renamed to DialogDelegate.

> > Source/WebCore/inspector/front-end/panelDialogs.css:1
> > +.panel-dialog {
> 
> .panel is confusing here as well
Done
Comment 6 Vsevolod Vlasov 2011-10-06 02:45:16 PDT
Created attachment 109936 [details]
Patch
Comment 7 Pavel Feldman 2011-10-11 03:11:24 PDT
Comment on attachment 109936 [details]
Patch

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

> Source/WebCore/WebCore.gypi:6243
> +            'inspector/front-end/Dialog.js',

Dialog should go after DO*

> Source/WebCore/WebCore.gypi:6352
> +            'inspector/front-end/dialogs.css',

dialog.css

> Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:35
> +WebInspector.GoToLineDialogDelegate = function(view)

I'd leave the name of the class so that .install invocation looked logical.

> Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:69
> +    if (!sourceView || !sourceView.canHighlightLine())

Could we inline this method?

> Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:84
> +    get mainElement()

get contentElement ?

> Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:89
> +    get mainInput()

get defaultFocusedElement ?
Comment 8 Vsevolod Vlasov 2011-10-11 09:59:09 PDT
Created attachment 110528 [details]
Patch
Comment 9 Vsevolod Vlasov 2011-10-11 09:59:36 PDT
(In reply to comment #7)
> (From update of attachment 109936 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=109936&action=review
> 
> > Source/WebCore/WebCore.gypi:6243
> > +            'inspector/front-end/Dialog.js',
> 
> Dialog should go after DO*
Should it? Other files in this file are sorted ignoring case.

> > Source/WebCore/WebCore.gypi:6352
> > +            'inspector/front-end/dialogs.css',
> 
> dialog.css
Done.

> > Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:35
> > +WebInspector.GoToLineDialogDelegate = function(view)
> 
> I'd leave the name of the class so that .install invocation looked logical.
Done.

> > Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:69
> > +    if (!sourceView || !sourceView.canHighlightLine())
> 
> Could we inline this method?
Which one and why?

> > Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:84
> > +    get mainElement()
> 
> get contentElement ?
> > Source/WebCore/inspector/front-end/GoToLineDialogDelegate.js:89
> > +    get mainInput()
> 
> get defaultFocusedElement ?
renamed to defaultFocusedElement
Comment 10 WebKit Review Bot 2011-10-11 10:06:12 PDT
Comment on attachment 110528 [details]
Patch

Attachment 110528 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/10027564
Comment 11 Vsevolod Vlasov 2011-10-11 10:13:11 PDT
Created attachment 110531 [details]
Patch
Comment 12 Early Warning System Bot 2011-10-11 10:30:34 PDT
Comment on attachment 110531 [details]
Patch

Attachment 110531 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/10026617
Comment 13 Pavel Feldman 2011-10-16 10:33:12 PDT
Comment on attachment 110531 [details]
Patch

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

> Source/WebCore/inspector/front-end/Dialog.js:94
> +            if (typeof(this._dialogDelegate.defaultFocusedElement.select) === "function")

This check is hard to compile

> Source/WebCore/inspector/front-end/Dialog.js:148
> +    get okButton() { },

What if the dialog is YesNo ?
Comment 14 Vsevolod Vlasov 2012-01-16 01:57:04 PST
Committed r105043: <http://trac.webkit.org/changeset/105043>
Comment 15 Csaba Osztrogonác 2012-01-16 02:03:43 PST
(In reply to comment #14)
> Committed r105043: <http://trac.webkit.org/changeset/105043>

Reopen, becaue it broke the Qt build. Why did you commit the wrong patch when the Qt EWS said it will break the build? Could you fix it as soon as possible?
Comment 16 Csaba Osztrogonác 2012-01-16 02:53:21 PST
I fixed it myself, but reluctantly: http://trac.webkit.org/changeset/105045
You should have done it before landing ...