Summary: | [GTK] Use a single signal for script dialogs in WebKit2 GTK+ API | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Carlos Garcia Campos <cgarcia> | ||||
Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | gustavo, pnormand, webkit.review.bot | ||||
Priority: | P2 | Keywords: | Gtk | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Attachments: |
|
Description
Carlos Garcia Campos
2012-03-05 05:37:19 PST
Created attachment 130102 [details]
Patch
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API Comment on attachment 130102 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=130102&action=review Great patch! The large change I would make would be to give WebKitScriptDialog its own file to align with the unwritten rule of WebKit style of "one class per file." Do you mind doing that before landing? > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:149 > + return new WebKitScriptDialog(dialog); > +} > + > +static void webkitScriptDialogFree(WebKitScriptDialog* dialog) > +{ > + delete dialog; Perhaps it makes sense to use the slab allocator and placement new syntax here? > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:195 > + scriptDialog->confirmed = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK; You might have to use webkit_script_dialog_confirm_set_confirmed now. > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:205 > + scriptDialog->text = gtk_entry_get_text(GTK_ENTRY(entry)); Same sort of change probably needed here. > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:1554 > + * signal sets %TRUE when OK button is clicked and %FALSE otherwise. Nit: the Ok button (In reply to comment #3) > (From update of attachment 130102 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=130102&action=review > > Great patch! The large change I would make would be to give WebKitScriptDialog its own file to align with the unwritten rule of WebKit style of "one class per file." Do you mind doing that before landing? Sure, no problem, even though WebKitScriptDialog is not a class, but a struct. > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:149 > > + return new WebKitScriptDialog(dialog); > > +} > > + > > +static void webkitScriptDialogFree(WebKitScriptDialog* dialog) > > +{ > > + delete dialog; > > Perhaps it makes sense to use the slab allocator and placement new syntax here? It doesn't really matter, this will never be used, but we need to give a copy and free func for boxed types. The struct is stack allocated before emitting the signal and the signal parameter is G_SIGNAL_TYPE_STATIC_SCOPE. > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:195 > > + scriptDialog->confirmed = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK; > > You might have to use webkit_script_dialog_confirm_set_confirmed now. Right, if we move the struct to its own file. > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:205 > > + scriptDialog->text = gtk_entry_get_text(GTK_ENTRY(entry)); > > Same sort of change probably needed here. Yes. > > Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:1554 > > + * signal sets %TRUE when OK button is clicked and %FALSE otherwise. > > Nit: the Ok button Ok. Comment on attachment 130102 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=130102&action=review >>> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:149 >>> + delete dialog; >> >> Perhaps it makes sense to use the slab allocator and placement new syntax here? > > It doesn't really matter, this will never be used, but we need to give a copy and free func for boxed types. The struct is stack allocated before emitting the signal and the signal parameter is G_SIGNAL_TYPE_STATIC_SCOPE. Perhaps it would make sense to use ASSERT_NOT_REACHED here then? >>> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:1554 >>> + * signal sets %TRUE when OK button is clicked and %FALSE otherwise. >> >> Nit: the Ok button > > Ok. Sorry, I meant "the OK button" here. (In reply to comment #5) > (From update of attachment 130102 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=130102&action=review > > >>> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:149 > >>> + delete dialog; > >> > >> Perhaps it makes sense to use the slab allocator and placement new syntax here? > > > > It doesn't really matter, this will never be used, but we need to give a copy and free func for boxed types. The struct is stack allocated before emitting the signal and the signal parameter is G_SIGNAL_TYPE_STATIC_SCOPE. > > Perhaps it would make sense to use ASSERT_NOT_REACHED here then? in this case I prefer to do the right thing in case we reach here for whatever reason. I'll change to use slab allocator before landing. > >>> Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp:1554 > >>> + * signal sets %TRUE when OK button is clicked and %FALSE otherwise. > >> > >> Nit: the Ok button > > > > Ok. > > Sorry, I meant "the OK button" here. OK :-) Committed r109880: <http://trac.webkit.org/changeset/109880> |