[webkit-help] What's the WebCore entry point to display a page?

Ryan Leavengood leavengood at gmail.com
Sat Aug 15 04:40:29 PDT 2009


On Sat, Aug 15, 2009 at 6:31 AM, Eagle Offshore<eagleoffshore at mac.com> wrote:
>
> Anybody got a snippet of code that shows how to take a URL string and get it
> loaded/parsed/and painted?  I'm going round and round trying to figure out
> what class is the entry point to kick off the entire load/display cycle.

Each port does it differently, but it generally will start with some
sort of binding in the actual "WebKit" part of the code. In fact each
port has a simple *Launcher application which should have the code you
are interested in. As an example, here is the main method of
GtkLauncher (WebKitTools/GtkLauncher/main.c):

int
main (int argc, char* argv[])
{
    gtk_init (&argc, &argv);
    if (!g_thread_supported ())
        g_thread_init (NULL);

    GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), create_browser (), TRUE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (vbox), create_statusbar (), FALSE, FALSE, 0);

    main_window = create_window ();
    gtk_container_add (GTK_CONTAINER (main_window), vbox);

    gchar* uri = (gchar*) (argc > 1 ? argv[1] : "http://www.google.com/");
    webkit_web_view_load_uri (web_view, uri);

    gtk_widget_grab_focus (GTK_WIDGET (web_view));
    gtk_widget_show_all (main_window);
    gtk_main ();

    return 0;
}

The above makes use of the GTK port WebKit bindings (specifically it
uses webkit_web_view_load_uri) which are at WebKit/gtk/webkit. Other
ports are similar.

-- 
Regards,
Ryan


More information about the webkit-help mailing list