Commit 3db2d3ba authored by alp@webkit.org's avatar alp@webkit.org

2007-12-17 Luca Bruno <lethalman88@gmail.com>

        Reviewed by Alp Toker.

        http://bugs.webkit.org/show_bug.cgi?id=13542
        gdklauncher doesnt change URL in adress GTKEntry.

        Let DOMDocument observers do their work before emitting title-changed.
        The load-committed signal has been added for both the view and the frame.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@28817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d8f0e36c
2007-12-17 Luca Bruno <lethalman88@gmail.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=13542
gdklauncher doesnt change URL in adress GTKEntry.
Let DOMDocument observers do their work before emitting title-changed.
The load-committed signal has been added for both the view and the frame.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::dispatchDidReceiveTitle): emit title-changed
(WebKit::FrameLoaderClient::setTitle): set private title
(WebKit::FrameLoaderClient::dispatchDidCommitLoad): update the frame uri and emit load-committed
* WebView/webkit-marshal.list:
* WebView/webkitprivate.h:
(_WebKitWebFramePrivate): rename location to uri
* WebView/webkitwebframe.cpp:
(webkit_web_frame_get_location): renamed to *_get_uri
(webkit_web_frame_get_uri):
(webkit_web_frame_real_title_changed): removed (see FrameLoaderClient::setTitle)
(webkit_web_frame_class_init): pass the frame and the title in title-changed, not the uri
(webkit_web_frame_finalize):
* WebView/webkitwebframe.h:
(_WebKitWebFrameClass): removed title_changed
* WebView/webkitwebview.cpp:
(webkit_web_view_class_init): pass only the title in title-changed
2007-12-14 Alp Toker <alp@atoker.com>
Fix inconsistent indentation in the license header. Maciej was right!
......
......@@ -503,13 +503,27 @@ void FrameLoaderClient::dispatchDidStartProvisionalLoad()
void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)
{
notImplemented();
}
g_signal_emit_by_name(m_frame, "title-changed", title.utf8().data());
WebKitWebView* page = getViewFromFrame(m_frame);
if (m_frame == webkit_web_view_get_main_frame(page))
g_signal_emit_by_name(page, "title-changed", m_frame, title.utf8().data());
}
void FrameLoaderClient::dispatchDidCommitLoad()
{
notImplemented();
/* Update the URI once first data has been received.
* This means the URI is valid and successfully identify the page that's going to be loaded.
*/
WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(m_frame);
g_free(frameData->uri);
frameData->uri = g_strdup(core(m_frame)->loader()->url().prettyURL().utf8().data());
g_signal_emit_by_name(m_frame, "load-committed");
WebKitWebView* page = getViewFromFrame(m_frame);
if (m_frame == webkit_web_view_get_main_frame(page))
g_signal_emit_by_name(page, "load-committed", m_frame);
}
void FrameLoaderClient::dispatchDidFinishDocumentLoad()
......@@ -633,14 +647,9 @@ void FrameLoaderClient::prepareForDataSourceReplacement() { notImplemented(); }
void FrameLoaderClient::setTitle(const String& title, const KURL& url)
{
WebKitWebView* page = getViewFromFrame(m_frame);
CString titleString = title.utf8();
DeprecatedCString urlString = url.prettyURL().utf8();
g_signal_emit_by_name(m_frame, "title-changed", titleString.data(), urlString.data());
if (m_frame == webkit_web_view_get_main_frame(page))
g_signal_emit_by_name(page, "title-changed", titleString.data(), urlString.data());
WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(m_frame);
g_free(frameData->title);
frameData->title = g_strdup(title.utf8().data());
}
void FrameLoaderClient::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived)
......
VOID:OBJECT
VOID:STRING
VOID:STRING,STRING
VOID:OBJECT,BOOLEAN
VOID:OBJECT,STRING
VOID:OBJECT,OBJECT
VOID:OBJECT,POINTER,POINTER
BOOLEAN:STRING,INT,STRING
......
......@@ -73,7 +73,7 @@ extern "C" {
gchar* name;
gchar* title;
gchar* location;
gchar* uri;
};
#define WEBKIT_NETWORK_REQUEST_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_NETWORK_REQUEST, WebKitNetworkRequestPrivate))
......
......@@ -47,6 +47,7 @@ extern "C" {
enum {
CLEARED,
LOAD_COMMITTED,
LOAD_DONE,
TITLE_CHANGED,
HOVERING_OVER_LINK,
......@@ -55,8 +56,6 @@ enum {
static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, };
static void webkit_web_frame_real_title_changed(WebKitWebFrame* frame, gchar* title, gchar* location);
G_DEFINE_TYPE(WebKitWebFrame, webkit_web_frame, G_TYPE_OBJECT)
static void webkit_web_frame_finalize(GObject* object)
......@@ -65,7 +64,7 @@ static void webkit_web_frame_finalize(GObject* object)
privateData->frame->loader()->cancelAndClear();
g_free(privateData->name);
g_free(privateData->title);
g_free(privateData->location);
g_free(privateData->uri);
delete privateData->frame;
G_OBJECT_CLASS(webkit_web_frame_parent_class)->finalize(object);
......@@ -87,6 +86,15 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
webkit_web_frame_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
webkit_web_frame_signals[LOAD_DONE] = g_signal_new("load-done",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
......@@ -100,12 +108,12 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
webkit_web_frame_signals[TITLE_CHANGED] = g_signal_new("title-changed",
G_TYPE_FROM_CLASS(frameClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
G_STRUCT_OFFSET(WebKitWebFrameClass, title_changed),
0,
NULL,
NULL,
webkit_marshal_VOID__STRING_STRING,
G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRING);
webkit_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
webkit_web_frame_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
G_TYPE_FROM_CLASS(frameClass),
......@@ -117,23 +125,12 @@ static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass)
G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRING);
frameClass->title_changed = webkit_web_frame_real_title_changed;
/*
* implementations of virtual methods
*/
G_OBJECT_CLASS(frameClass)->finalize = webkit_web_frame_finalize;
}
static void webkit_web_frame_real_title_changed(WebKitWebFrame* frame, gchar* title, gchar* location)
{
WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(frame);
g_free(frameData->title);
g_free(frameData->location);
frameData->title = g_strdup(title);
frameData->location = g_strdup(location);
}
static void webkit_web_frame_init(WebKitWebFrame* frame)
{
// TODO: Move constructor code here.
......@@ -167,7 +164,7 @@ WebKitWebFrame* webkit_web_frame_new(WebKitWebView* webView)
frameData->webView = webView;
frameData->name = 0;
frameData->title = 0;
frameData->location = 0;
frameData->uri = 0;
return frame;
}
......@@ -199,12 +196,12 @@ const gchar* webkit_web_frame_get_title(WebKitWebFrame* frame)
return frameData->title;
}
const gchar* webkit_web_frame_get_location(WebKitWebFrame* frame)
const gchar* webkit_web_frame_get_uri(WebKitWebFrame* frame)
{
g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL);
WebKitWebFramePrivate* frameData = WEBKIT_WEB_FRAME_GET_PRIVATE(frame);
return frameData->location;
return frameData->uri;
}
/**
......@@ -418,7 +415,6 @@ gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame)
return g_strdup(string.utf8().data());
}
#if GTK_CHECK_VERSION(2,10,0)
// This could be shared between ports once it's complete
......
......@@ -43,13 +43,12 @@ struct _WebKitWebFrame {
struct _WebKitWebFrameClass {
GObjectClass parent;
void (*title_changed) (WebKitWebFrame* frame, gchar* title, gchar* location);
void (*_webkit_reserved1) (void);
void (*_webkit_reserved2) (void);
void (*_webkit_reserved3) (void);
void (*_webkit_reserved4) (void);
void (*_webkit_reserved5) (void);
void (*_webkit_reserved6) (void);
};
WEBKIT_API GType
......@@ -68,7 +67,7 @@ WEBKIT_API const gchar*
webkit_web_frame_get_title (WebKitWebFrame* frame);
WEBKIT_API const gchar*
webkit_web_frame_get_location (WebKitWebFrame* frame);
webkit_web_frame_get_uri (WebKitWebFrame* frame);
WEBKIT_API WebKitWebFrame*
webkit_web_frame_get_parent (WebKitWebFrame* frame);
......
......@@ -56,6 +56,7 @@ enum {
NAVIGATION_REQUESTED,
WINDOW_OBJECT_CLEARED,
LOAD_STARTED,
LOAD_COMMITTED,
LOAD_PROGRESS_CHANGED,
LOAD_FINISHED,
TITLE_CHANGED,
......@@ -330,7 +331,7 @@ static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebF
window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
dialog = gtk_message_dialog_new(GTK_WIDGET_TOPLEVEL(window) ? GTK_WINDOW(window) : 0, GTK_DIALOG_DESTROY_WITH_PARENT, messageType, buttons, "%s", message);
gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_location(frame), NULL);
gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL);
gtk_window_set_title(GTK_WINDOW(dialog), title);
g_free(title);
......@@ -494,6 +495,24 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_TYPE_NONE, 1,
WEBKIT_TYPE_WEB_FRAME);
/**
* WebKitWebView::load-committed:
* @web_view: the object on which the signal is emitted
* @frame: the main frame that received the first data
*
* When a #WebKitWebFrame loaded the first data this signal is emitted.
*/
webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
WEBKIT_TYPE_WEB_FRAME);
/**
* WebKitWebView::load-progress-changed:
* @web_view: the #WebKitWebView
......@@ -519,15 +538,24 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_TYPE_NONE, 1,
WEBKIT_TYPE_WEB_FRAME);
/**
* WebKitWebView::title-changed:
* @web_view: the object on which the signal is emitted
* @frame: the main frame
* @title: the new title
*
* When a #WebKitWebFrame changes the document title this signal is emitted.
*/
webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
NULL,
NULL,
webkit_marshal_VOID__STRING_STRING,
webkit_marshal_VOID__OBJECT_STRING,
G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRING);
WEBKIT_TYPE_WEB_FRAME,
G_TYPE_STRING);
webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
G_TYPE_FROM_CLASS(webViewClass),
......
2007-12-17 Luca Bruno <lethalman88@gmail.com>
Reviewed by Alp Toker.
http://bugs.webkit.org/show_bug.cgi?id=13542
gdklauncher doesnt change URL in adress GTKEntry.
* GtkLauncher/main.c:
(load_commit_cb): added
(title_change_cb):
(create_browser):
2007-12-16 Dimitri Glazkov <dimitri@glazkov.com>
Reviewed by Adam Roben.
......
......@@ -65,10 +65,8 @@ link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpoin
}
static void
title_change_cb (WebKitWebView* page, const gchar* title, const gchar* uri, gpointer data)
title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar* title, gpointer data)
{
gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
if (main_title)
g_free (main_title);
main_title = g_strdup (title);
......@@ -82,6 +80,14 @@ progress_change_cb (WebKitWebView* page, gint progress, gpointer data)
update_title (GTK_WINDOW (main_window));
}
static void
load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
{
const gchar* uri = webkit_web_frame_get_uri(frame);
if (uri)
gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
}
static void
destroy_cb (GtkWidget* widget, gpointer data)
{
......@@ -111,6 +117,7 @@ create_browser ()
g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
return scrolled_window;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment