RESOLVED FIXED 58416
[GTK] Implement UI client in minibrowser
https://bugs.webkit.org/show_bug.cgi?id=58416
Summary [GTK] Implement UI client in minibrowser
Carlos Garcia Campos
Reported 2011-04-13 01:05:02 PDT
An initial implementaion would allow to open links in a new browser window from the context menu, see bug #54827.
Attachments
Patch (7.28 KB, patch)
2011-04-13 01:09 PDT, Carlos Garcia Campos
no flags
Updated patch acording to review (7.41 KB, patch)
2011-04-15 02:50 PDT, Carlos Garcia Campos
mrobinson: review+
Carlos Garcia Campos
Comment 1 2011-04-13 01:09:44 PDT
Created attachment 89348 [details] Patch It also allows to open more than one window from the command line. It depends on bug #58024
Martin Robinson
Comment 2 2011-04-13 08:10:32 PDT
Comment on attachment 89348 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=89348&action=review > Tools/MiniBrowser/gtk/BrowserWindow.c:52 > +static void browserWindowUiClientInit(BrowserWindow*); Should be browserWindowUIClientInit > Tools/MiniBrowser/gtk/BrowserWindow.c:390 > +{ > + WKViewRef webView = WKViewCreate(WKPageGetContext(page), 0); > + BrowserWindow* window = BROWSER_WINDOW(browserWindowNew(webView)); > + return WKViewGetPage(window->webView); > +} Maybe browser_window_new should take in the features dictionary to set the size, etc. > Tools/MiniBrowser/gtk/BrowserWindow.c:426 > + WKPageUIClient uiClient = { > + 0, /* version */ > + window, /* clientInfo */ > + createNewPage, > + showPage, > + closePage, > + runJavaScriptAlert, > + 0, /* runJavaScriptConfirm */ > + 0, /* runJavaScriptPrompt */ > + 0, /* setStatusText */ > + 0, /* mouseDidMoveOverElement */ > + 0, /* missingPluginButtonClicked */ > + 0, /* didNotHandleKeyEvent */ > + 0, /* toolbarsAreVisible */ > + 0, /* setToolbarsAreVisible */ > + 0, /* menuBarIsVisible */ > + 0, /* setMenuBarIsVisible */ Please line up the comments on these lines. :) > Tools/MiniBrowser/gtk/main.c:43 > +static void loadUri(const gchar *uri) Should be loadURI. > Tools/MiniBrowser/gtk/main.c:57 > + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URLâ¦]" }, Are there some extra characters at the end of "[URLâ¦]"
Carlos Garcia Campos
Comment 3 2011-04-14 01:57:41 PDT
(In reply to comment #2) > (From update of attachment 89348 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=89348&action=review > > > Tools/MiniBrowser/gtk/BrowserWindow.c:52 > > +static void browserWindowUiClientInit(BrowserWindow*); > > Should be browserWindowUIClientInit Ok. > > Tools/MiniBrowser/gtk/BrowserWindow.c:390 > > +{ > > + WKViewRef webView = WKViewCreate(WKPageGetContext(page), 0); > > + BrowserWindow* window = BROWSER_WINDOW(browserWindowNew(webView)); > > + return WKViewGetPage(window->webView); > > +} > > Maybe browser_window_new should take in the features dictionary to set the size, etc. We could use the features to set up the window before showing it, but I'm not sure the window should take the features. We can leave this for future patches, other ports ignore this for now too. > > Tools/MiniBrowser/gtk/BrowserWindow.c:426 > > + WKPageUIClient uiClient = { > > + 0, /* version */ > > + window, /* clientInfo */ > > + createNewPage, > > + showPage, > > + closePage, > > + runJavaScriptAlert, > > + 0, /* runJavaScriptConfirm */ > > + 0, /* runJavaScriptPrompt */ > > + 0, /* setStatusText */ > > + 0, /* mouseDidMoveOverElement */ > > + 0, /* missingPluginButtonClicked */ > > + 0, /* didNotHandleKeyEvent */ > > + 0, /* toolbarsAreVisible */ > > + 0, /* setToolbarsAreVisible */ > > + 0, /* menuBarIsVisible */ > > + 0, /* setMenuBarIsVisible */ > > Please line up the comments on these lines. :) Sure. > > Tools/MiniBrowser/gtk/main.c:43 > > +static void loadUri(const gchar *uri) > > Should be loadURI. Ok. > > Tools/MiniBrowser/gtk/main.c:57 > > + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URLâ¦]" }, > > Are there some extra characters at the end of "[URLâ¦]" Looks like a bug in review tool, it's utf-8 text, try opening the attachment.
Carlos Garcia Campos
Comment 4 2011-04-15 02:50:00 PDT
Created attachment 89760 [details] Updated patch acording to review Patch updated to current git master, fixing the issues pointed out by martin and fixing a crash while opening a link in a new window from the context menu.
Martin Robinson
Comment 5 2011-04-26 16:19:42 PDT
Comment on attachment 89760 [details] Updated patch acording to review View in context: https://bugs.webkit.org/attachment.cgi?id=89760&action=review Looks good, but please fix the style errors before landing. > Tools/MiniBrowser/gtk/BrowserWindow.c:406 > +static void browserWindowUIClientInit(BrowserWindow* window) Please shift the asterisk over. > Tools/MiniBrowser/gtk/main.c:32 > +static const gchar** uriArguments = NULL; The asterisks should be on uriArguments. > Tools/MiniBrowser/gtk/main.c:48 > + GtkWidget* mainWindow = browser_window_new(webView); > + gchar* url = argumentToURL(uri); > + WKPageLoadURL(WKViewGetPage(webView), WKURLCreateWithUTF8CString(url)); Ditto > Tools/MiniBrowser/gtk/main.c:66 > + GOptionContext* context = g_option_context_new(NULL); Ditto > Tools/MiniBrowser/gtk/main.c:70 > + GError* error = NULL; Ditto. Please use 0 here instead of NULL. > Tools/MiniBrowser/gtk/main.c:81 > + gint i; Please just use int here.
Carlos Garcia Campos
Comment 6 2011-04-27 05:47:08 PDT
(In reply to comment #5) > (From update of attachment 89760 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=89760&action=review > > Looks good, but please fix the style errors before landing. > > > Tools/MiniBrowser/gtk/BrowserWindow.c:406 > > +static void browserWindowUIClientInit(BrowserWindow* window) > > Please shift the asterisk over. Ok, I thought the style was the same for non-C++ files, sorry. > > Tools/MiniBrowser/gtk/main.c:32 > > +static const gchar** uriArguments = NULL; > > The asterisks should be on uriArguments. > > > Tools/MiniBrowser/gtk/main.c:48 > > + GtkWidget* mainWindow = browser_window_new(webView); > > + gchar* url = argumentToURL(uri); > > + WKPageLoadURL(WKViewGetPage(webView), WKURLCreateWithUTF8CString(url)); > > Ditto > > > Tools/MiniBrowser/gtk/main.c:66 > > + GOptionContext* context = g_option_context_new(NULL); > > Ditto > > > Tools/MiniBrowser/gtk/main.c:70 > > + GError* error = NULL; > > Ditto. Please use 0 here instead of NULL. > > > Tools/MiniBrowser/gtk/main.c:81 > > + gint i; > > Please just use int here. Ok, Thanks. Note that this depends on uncommitted not yet approved patches, so I'll push it as soon as other patches are committed.
Carlos Garcia Campos
Comment 7 2011-04-29 02:56:12 PDT
Note You need to log in before you can comment on or make changes to this bug.