View | Details | Raw Unified | Return to bug 17066 | Differences between
and this patch

Collapse All | Expand All

(-)a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (+23 lines)
Lines 160-165 String FrameLoaderClient::userAgent(const KURL&) Link Here
160
    return m_userAgent;
160
    return m_userAgent;
161
}
161
}
162
162
163
static void notifyStatus(WebKitWebFrame* frame, WebKitLoadStatus loadStatus)
164
{
165
    frame->priv->loadStatus = loadStatus;
166
    g_object_notify(G_OBJECT(frame), "load-status");
167
168
    WebKitWebView* webView = getViewFromFrame(frame);
169
    if (frame == webkit_web_view_get_main_frame(webView)) {
170
        webView->priv->loadStatus = loadStatus;
171
        g_object_notify(G_OBJECT(webView), "load-status");
172
    }
173
}
174
163
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
175
WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClient::createDocumentLoader(const WebCore::ResourceRequest& request, const SubstituteData& substituteData)
164
{
176
{
165
    return DocumentLoader::create(request, substituteData);
177
    return DocumentLoader::create(request, substituteData);
Lines 232-237 void FrameLoaderClient::postProgressStartedNotification() Link Here
232
{
244
{
233
    WebKitWebView* webView = getViewFromFrame(m_frame);
245
    WebKitWebView* webView = getViewFromFrame(m_frame);
234
    g_signal_emit_by_name(webView, "load-started", m_frame);
246
    g_signal_emit_by_name(webView, "load-started", m_frame);
247
248
    g_object_notify(G_OBJECT(webView), "progress");
235
}
249
}
236
250
237
void FrameLoaderClient::postProgressEstimateChangedNotification()
251
void FrameLoaderClient::postProgressEstimateChangedNotification()
Lines 240-245 void FrameLoaderClient::postProgressEstimateChangedNotification() Link Here
240
    Page* corePage = core(webView);
254
    Page* corePage = core(webView);
241
255
242
    g_signal_emit_by_name(webView, "load-progress-changed", lround(corePage->progress()->estimatedProgress()*100));
256
    g_signal_emit_by_name(webView, "load-progress-changed", lround(corePage->progress()->estimatedProgress()*100));
257
258
    g_object_notify(G_OBJECT(webView), "progress");
243
}
259
}
244
260
245
void FrameLoaderClient::postProgressFinishedNotification()
261
void FrameLoaderClient::postProgressFinishedNotification()
Lines 247-252 void FrameLoaderClient::postProgressFinishedNotification() Link Here
247
    WebKitWebView* webView = getViewFromFrame(m_frame);
263
    WebKitWebView* webView = getViewFromFrame(m_frame);
248
264
249
    g_signal_emit_by_name(webView, "load-finished", m_frame);
265
    g_signal_emit_by_name(webView, "load-finished", m_frame);
266
267
    g_object_notify(G_OBJECT(webView), "progress");
250
}
268
}
251
269
252
void FrameLoaderClient::frameLoaderDestroyed()
270
void FrameLoaderClient::frameLoaderDestroyed()
Lines 492-497 bool FrameLoaderClient::hasWebView() const Link Here
492
void FrameLoaderClient::dispatchDidFinishLoad()
510
void FrameLoaderClient::dispatchDidFinishLoad()
493
{
511
{
494
    g_signal_emit_by_name(m_frame, "load-done", true);
512
    g_signal_emit_by_name(m_frame, "load-done", true);
513
514
    notifyStatus(m_frame, WEBKIT_LOAD_FINISHED);
495
}
515
}
496
516
497
void FrameLoaderClient::frameLoadCompleted()
517
void FrameLoaderClient::frameLoadCompleted()
Lines 591-596 void FrameLoaderClient::dispatchDidReceiveIcon() Link Here
591
611
592
void FrameLoaderClient::dispatchDidStartProvisionalLoad()
612
void FrameLoaderClient::dispatchDidStartProvisionalLoad()
593
{
613
{
614
    notifyStatus(m_frame, WEBKIT_LOAD_PROVISIONAL);
594
}
615
}
595
616
596
void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)
617
void FrameLoaderClient::dispatchDidReceiveTitle(const String& title)
Lines 616-621 void FrameLoaderClient::dispatchDidCommitLoad() Link Here
616
    WebKitWebView* webView = getViewFromFrame(m_frame);
637
    WebKitWebView* webView = getViewFromFrame(m_frame);
617
    if (m_frame == webkit_web_view_get_main_frame(webView))
638
    if (m_frame == webkit_web_view_get_main_frame(webView))
618
        g_signal_emit_by_name(webView, "load-committed", m_frame);
639
        g_signal_emit_by_name(webView, "load-committed", m_frame);
640
641
    notifyStatus(m_frame, WEBKIT_LOAD_COMMITTED);
619
}
642
}
620
643
621
void FrameLoaderClient::dispatchDidFinishDocumentLoad()
644
void FrameLoaderClient::dispatchDidFinishDocumentLoad()
(-)a/WebKit/gtk/webkit/webkitprivate.h (+2 lines)
Lines 101-106 extern "C" { Link Here
101
        GtkAdjustment* verticalAdjustment;
101
        GtkAdjustment* verticalAdjustment;
102
102
103
        gboolean zoomFullContent;
103
        gboolean zoomFullContent;
104
        WebKitLoadStatus loadStatus;
104
    };
105
    };
105
106
106
    #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
107
    #define WEBKIT_WEB_FRAME_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_FRAME, WebKitWebFramePrivate))
Lines 112-117 extern "C" { Link Here
112
        gchar* name;
113
        gchar* name;
113
        gchar* title;
114
        gchar* title;
114
        gchar* uri;
115
        gchar* uri;
116
        WebKitLoadStatus loadStatus;
115
    };
117
    };
116
118
117
    PassRefPtr<WebCore::Frame>
119
    PassRefPtr<WebCore::Frame>
(-)a/WebKit/gtk/webkit/webkitwebframe.cpp (-1 / +37 lines)
Lines 26-31 Link Here
26
26
27
#include "webkitwebframe.h"
27
#include "webkitwebframe.h"
28
#include "webkitwebview.h"
28
#include "webkitwebview.h"
29
#include "webkitenumtypes.h"
29
#include "webkitmarshal.h"
30
#include "webkitmarshal.h"
30
#include "webkitprivate.h"
31
#include "webkitprivate.h"
31
32
Lines 84-90 enum { Link Here
84
85
85
    PROP_NAME,
86
    PROP_NAME,
86
    PROP_TITLE,
87
    PROP_TITLE,
87
    PROP_URI
88
    PROP_URI,
89
    PROP_LOAD_STATUS
88
};
90
};
89
91
90
static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, };
92
static guint webkit_web_frame_signals[LAST_SIGNAL] = { 0, };
Lines 105-110 static void webkit_web_frame_get_property(GObject* object, guint prop_id, GValue Link Here
105
    case PROP_URI:
107
    case PROP_URI:
106
        g_value_set_string(value, webkit_web_frame_get_uri(frame));
108
        g_value_set_string(value, webkit_web_frame_get_uri(frame));
107
        break;
109
        break;
110
    case PROP_LOAD_STATUS:
111
        g_value_set_enum(value, webkit_web_frame_get_load_status(frame));
112
        break;
108
    default:
113
    default:
109
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
114
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
110
        break;
115
        break;
Lines 223-228 static void webkit_web_frame_class_init(WebKitWebFrameClass* frameClass) Link Here
223
                                                        NULL,
228
                                                        NULL,
224
                                                        WEBKIT_PARAM_READABLE));
229
                                                        WEBKIT_PARAM_READABLE));
225
230
231
    /**
232
    * WebKitWebFrame:load-status:
233
    *
234
    * Determines the current status of the load.
235
    *
236
    * Since: 1.1.1
237
    */
238
    g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
239
                                    g_param_spec_enum("load-status",
240
                                                      "Load Status",
241
                                                      "Determines the current status of the load",
242
                                                      WEBKIT_TYPE_LOAD_STATUS,
243
                                                      WEBKIT_LOAD_FINISHED,
244
                                                      WEBKIT_PARAM_READABLE));
245
226
    g_type_class_add_private(frameClass, sizeof(WebKitWebFramePrivate));
246
    g_type_class_add_private(frameClass, sizeof(WebKitWebFramePrivate));
227
}
247
}
228
248
Lines 662-665 unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame) Link Here
662
    return controller->numberOfActiveAnimations();
682
    return controller->numberOfActiveAnimations();
663
}
683
}
664
684
685
/**
686
 * webkit_web_frame_get_load_status:
687
 * @frame: a #WebKitWebView
688
 *
689
 * Determines the current status of the load.
690
 *
691
 * Since: 1.1.1
692
 */
693
WebKitLoadStatus webkit_web_frame_get_load_status(WebKitWebFrame* frame)
694
{
695
    g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), WEBKIT_LOAD_FINISHED);
696
697
    WebKitWebFramePrivate* priv = frame->priv;
698
    return priv->loadStatus;
699
}
700
665
}
701
}
(-)a/WebKit/gtk/webkit/webkitwebframe.h (+9 lines)
Lines 57-62 struct _WebKitWebFrameClass { Link Here
57
    void (*_webkit_reserved6) (void);
57
    void (*_webkit_reserved6) (void);
58
};
58
};
59
59
60
typedef enum {
61
    WEBKIT_LOAD_PROVISIONAL,
62
    WEBKIT_LOAD_COMMITTED,
63
    WEBKIT_LOAD_FINISHED
64
} WebKitLoadStatus;
65
60
WEBKIT_API GType
66
WEBKIT_API GType
61
webkit_web_frame_get_type           (void);
67
webkit_web_frame_get_type           (void);
62
68
Lines 97-102 webkit_web_frame_find_frame (WebKitWebFrame *frame, Link Here
97
WEBKIT_API JSGlobalContextRef
103
WEBKIT_API JSGlobalContextRef
98
webkit_web_frame_get_global_context (WebKitWebFrame       *frame);
104
webkit_web_frame_get_global_context (WebKitWebFrame       *frame);
99
105
106
WEBKIT_API WebKitLoadStatus
107
webkit_web_frame_get_load_status    (WebKitWebFrame       *frame);
108
100
G_END_DECLS
109
G_END_DECLS
101
110
102
#endif
111
#endif
(-)a/WebKit/gtk/webkit/webkitwebview.cpp (-1 / +70 lines)
Lines 59-64 Link Here
59
#include "PasteboardHelper.h"
59
#include "PasteboardHelper.h"
60
#include "PlatformKeyboardEvent.h"
60
#include "PlatformKeyboardEvent.h"
61
#include "PlatformWheelEvent.h"
61
#include "PlatformWheelEvent.h"
62
#include "ProgressTracker.h"
62
#include "ScriptValue.h"
63
#include "ScriptValue.h"
63
#include "Scrollbar.h"
64
#include "Scrollbar.h"
64
#include "SubstituteData.h"
65
#include "SubstituteData.h"
Lines 146-152 enum { Link Here
146
    PROP_WINDOW_FEATURES,
147
    PROP_WINDOW_FEATURES,
147
    PROP_TRANSPARENT,
148
    PROP_TRANSPARENT,
148
    PROP_ZOOM_LEVEL,
149
    PROP_ZOOM_LEVEL,
149
    PROP_FULL_CONTENT_ZOOM
150
    PROP_FULL_CONTENT_ZOOM,
151
    PROP_LOAD_STATUS,
152
    PROP_PROGRESS
150
};
153
};
151
154
152
static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
155
static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
Lines 304-309 static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* Link Here
304
    case PROP_FULL_CONTENT_ZOOM:
307
    case PROP_FULL_CONTENT_ZOOM:
305
        g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView));
308
        g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView));
306
        break;
309
        break;
310
    case PROP_LOAD_STATUS:
311
        g_value_set_enum(value, webkit_web_view_get_load_status(webView));
312
        break;
313
    case PROP_PROGRESS:
314
        g_value_set_double(value, webkit_web_view_get_progress(webView));
315
        break;
307
    default:
316
    default:
308
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
317
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
309
    }
318
    }
Lines 1569-1574 static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) Link Here
1569
                                                         FALSE,
1578
                                                         FALSE,
1570
                                                         WEBKIT_PARAM_READWRITE));
1579
                                                         WEBKIT_PARAM_READWRITE));
1571
1580
1581
    /**
1582
    * WebKitWebView:load-status:
1583
    *
1584
    * Determines the current status of the load.
1585
    *
1586
    * Since: 1.1.1
1587
    */
1588
    g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
1589
                                    g_param_spec_enum("load-status",
1590
                                                      "Load Status",
1591
                                                      "Determines the current status of the load",
1592
                                                      WEBKIT_TYPE_LOAD_STATUS,
1593
                                                      WEBKIT_LOAD_FINISHED,
1594
                                                      WEBKIT_PARAM_READABLE));
1595
1596
    /**
1597
    * WebKitWebView:progress:
1598
    *
1599
    * Determines the current progress of the load.
1600
    *
1601
    * Since: 1.1.1
1602
    */
1603
    g_object_class_install_property(objectClass, PROP_PROGRESS,
1604
                                    g_param_spec_double("progress",
1605
                                                        "Progress",
1606
                                                        "Determines the current progress of the load",
1607
                                                        0.0, 1.0, 1.0,
1608
                                                        WEBKIT_PARAM_READABLE));
1609
1572
    g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate));
1610
    g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate));
1573
}
1611
}
1574
1612
Lines 2672-2675 void webkit_web_view_set_full_content_zoom(WebKitWebView* webView, gboolean zoom Link Here
2672
    g_object_notify(G_OBJECT(webView), "full-content-zoom");
2710
    g_object_notify(G_OBJECT(webView), "full-content-zoom");
2673
}
2711
}
2674
2712
2713
/**
2714
 * webkit_web_view_get_load_status:
2715
 * @web_view: a #WebKitWebView
2716
 *
2717
 * Determines the current status of the load.
2718
 *
2719
 * Since: 1.1.1
2720
 */
2721
WebKitLoadStatus webkit_web_view_get_load_status(WebKitWebView* webView)
2722
{
2723
    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), WEBKIT_LOAD_FINISHED);
2724
2725
    WebKitWebViewPrivate* priv = webView->priv;
2726
    return priv->loadStatus;
2727
}
2728
2729
/**
2730
 * webkit_web_view_get_progress:
2731
 * @web_view: a #WebKitWebView
2732
 *
2733
 * Determines the current progress of the load.
2734
 *
2735
 * Since: 1.1.1
2736
 */
2737
gdouble webkit_web_view_get_progress(WebKitWebView* webView)
2738
{
2739
    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 1.0);
2740
2741
    return lround(core(webView)->progress()->estimatedProgress() * 100);
2742
}
2743
2675
}
2744
}
(-)a/WebKit/gtk/webkit/webkitwebview.h (+7 lines)
Lines 27-32 Link Here
27
27
28
#include <webkit/webkitdefines.h>
28
#include <webkit/webkitdefines.h>
29
#include <webkit/webkitwebbackforwardlist.h>
29
#include <webkit/webkitwebbackforwardlist.h>
30
#include <webkit/webkitwebframe.h>
30
#include <webkit/webkitwebhistoryitem.h>
31
#include <webkit/webkitwebhistoryitem.h>
31
#include <webkit/webkitwebsettings.h>
32
#include <webkit/webkitwebsettings.h>
32
33
Lines 296-301 WEBKIT_API void Link Here
296
webkit_web_view_set_full_content_zoom           (WebKitWebView        *web_view,
297
webkit_web_view_set_full_content_zoom           (WebKitWebView        *web_view,
297
                                                 gboolean              full_content_zoom);
298
                                                 gboolean              full_content_zoom);
298
299
300
WEBKIT_API WebKitLoadStatus
301
webkit_web_view_get_load_status                 (WebKitWebView        *web_view);
302
303
WEBKIT_API gdouble
304
webkit_web_view_get_progress                    (WebKitWebView        *web_view);
305
299
G_END_DECLS
306
G_END_DECLS
300
307
301
#endif
308
#endif
(-)a/WebKitTools/GtkLauncher/main.c (-14 / +19 lines)
Lines 32-38 static GtkWidget* uri_entry; Link Here
32
static GtkStatusbar* main_statusbar;
32
static GtkStatusbar* main_statusbar;
33
static WebKitWebView* web_view;
33
static WebKitWebView* web_view;
34
static gchar* main_title;
34
static gchar* main_title;
35
static gint load_progress;
35
static gdouble load_progress;
36
static guint status_context_id;
36
static guint status_context_id;
37
37
38
static void
38
static void
Lines 49-55 update_title (GtkWindow* window) Link Here
49
    GString* string = g_string_new (main_title);
49
    GString* string = g_string_new (main_title);
50
    g_string_append (string, " - WebKit Launcher");
50
    g_string_append (string, " - WebKit Launcher");
51
    if (load_progress < 100)
51
    if (load_progress < 100)
52
        g_string_append_printf (string, " (%d%%)", load_progress);
52
        g_string_append_printf (string, " (%f%%)", load_progress);
53
    gchar* title = g_string_free (string, FALSE);
53
    gchar* title = g_string_free (string, FALSE);
54
    gtk_window_set_title (window, title);
54
    gtk_window_set_title (window, title);
55
    g_free (title);
55
    g_free (title);
Lines 74-91 title_change_cb (WebKitWebView* web_view, WebKitWebFrame* web_frame, const gchar Link Here
74
}
74
}
75
75
76
static void
76
static void
77
progress_change_cb (WebKitWebView* page, gint progress, gpointer data)
77
notify_load_status_cb (WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
78
{
78
{
79
    load_progress = progress;
79
    if (webkit_web_view_get_load_status (web_view) == WEBKIT_LOAD_COMMITTED) {
80
    update_title (GTK_WINDOW (main_window));
80
        WebKitWebFrame* frame = webkit_web_view_get_main_frame (web_view);
81
        const gchar* uri = webkit_web_frame_get_uri (frame);
82
        if (uri)
83
            gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
84
    }
81
}
85
}
82
86
83
static void
87
static void
84
load_commit_cb (WebKitWebView* page, WebKitWebFrame* frame, gpointer data)
88
notify_progress_cb (WebKitWebView* web_view, GParamSpec* pspec, gpointer data)
85
{
89
{
86
    const gchar* uri = webkit_web_frame_get_uri(frame);
90
    load_progress = webkit_web_view_get_progress (web_view);
87
    if (uri)
91
    update_title (GTK_WINDOW (main_window));
88
        gtk_entry_set_text (GTK_ENTRY (uri_entry), uri);
89
}
92
}
90
93
91
static void
94
static void
Lines 115-124 create_browser () Link Here
115
    web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
118
    web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ());
116
    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
119
    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (web_view));
117
120
118
    g_signal_connect (G_OBJECT (web_view), "title-changed", G_CALLBACK (title_change_cb), web_view);
121
    g_signal_connect (web_view, "title-changed", G_CALLBACK (title_change_cb), web_view);
119
    g_signal_connect (G_OBJECT (web_view), "load-progress-changed", G_CALLBACK (progress_change_cb), web_view);
122
    g_signal_connect (web_view, "notify::load-status", G_CALLBACK (notify_load_status_cb), web_view);
120
    g_signal_connect (G_OBJECT (web_view), "load-committed", G_CALLBACK (load_commit_cb), web_view);
123
    g_signal_connect (web_view, "notify::progress", G_CALLBACK (notify_progress_cb), web_view);
121
    g_signal_connect (G_OBJECT (web_view), "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
124
    g_signal_connect (web_view, "hovering-over-link", G_CALLBACK (link_hover_cb), web_view);
122
125
123
    return scrolled_window;
126
    return scrolled_window;
124
}
127
}
Lines 174-180 create_window () Link Here
174
    GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
177
    GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
175
    gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
178
    gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
176
    gtk_widget_set_name (window, "GtkLauncher");
179
    gtk_widget_set_name (window, "GtkLauncher");
177
    g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (destroy_cb), NULL);
180
    g_signal_connect (window, "destroy", G_CALLBACK (destroy_cb), NULL);
178
181
179
    return window;
182
    return window;
180
}
183
}
Lines 183-188 int Link Here
183
main (int argc, char* argv[])
186
main (int argc, char* argv[])
184
{
187
{
185
    gtk_init (&argc, &argv);
188
    gtk_init (&argc, &argv);
189
    if (!g_thread_supported ())
190
        g_thread_init (NULL);
186
191
187
    GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
192
    GtkWidget* vbox = gtk_vbox_new (FALSE, 0);
188
    gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);
193
    gtk_box_pack_start (GTK_BOX (vbox), create_toolbar (), FALSE, FALSE, 0);

Return to bug 17066