[Gtk][WK1] Use mock scrollbars when testing
[WebKit-https.git] / Source / WebKit / gtk / webkit / webkitwebview.cpp
1 /*
2  *  Copyright (C) 2007, 2008 Holger Hans Peter Freyther
3  *  Copyright (C) 2007, 2008, 2009 Christian Dywan <christian@imendio.com>
4  *  Copyright (C) 2007 Xan Lopez <xan@gnome.org>
5  *  Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
6  *  Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com>
7  *  Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
8  *  Copyright (C) 2008 Nuanti Ltd.
9  *  Copyright (C) 2008, 2009, 2010 Collabora Ltd.
10  *  Copyright (C) 2009, 2010, 2012 Igalia S.L.
11  *  Copyright (C) 2009 Movial Creative Technologies Inc.
12  *  Copyright (C) 2009 Bobby Powers
13  *  Copyright (C) 2010 Joone Hur <joone@kldp.org>
14  *  Copyright (C) 2012 Igalia S.L.
15  *
16  *  This library is free software; you can redistribute it and/or
17  *  modify it under the terms of the GNU Lesser General Public
18  *  License as published by the Free Software Foundation; either
19  *  version 2 of the License, or (at your option) any later version.
20  *
21  *  This library is distributed in the hope that it will be useful,
22  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24  *  Lesser General Public License for more details.
25  *
26  *  You should have received a copy of the GNU Lesser General Public
27  *  License along with this library; if not, write to the Free Software
28  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
29  */
30
31 #include "config.h"
32 #include "webkitwebview.h"
33
34 #include "AXObjectCache.h"
35 #include "AbstractDatabase.h"
36 #include "BackForwardListImpl.h"
37 #include "CairoUtilities.h"
38 #include "Chrome.h"
39 #include "ChromeClientGtk.h"
40 #include "ClipboardUtilitiesGtk.h"
41 #include "ContextMenu.h"
42 #include "ContextMenuClientGtk.h"
43 #include "ContextMenuController.h"
44 #include "Cursor.h"
45 #include "Document.h"
46 #include "DocumentLoader.h"
47 #include "DragActions.h"
48 #include "DragClientGtk.h"
49 #include "DragController.h"
50 #include "DragData.h"
51 #include "DragSession.h"
52 #include "DumpRenderTreeSupportGtk.h"
53 #include "Editor.h"
54 #include "EditorClientGtk.h"
55 #include "EventHandler.h"
56 #include "FloatQuad.h"
57 #include "FocusController.h"
58 #include "FrameLoader.h"
59 #include "FrameLoaderClient.h"
60 #include "FrameLoaderTypes.h"
61 #include "FrameView.h"
62 #include "GOwnPtrGtk.h"
63 #include "GeolocationClientGtk.h"
64 #include "GeolocationClientMock.h"
65 #include "GeolocationController.h"
66 #include "GraphicsContext.h"
67 #include "GtkUtilities.h"
68 #include "GtkVersioning.h"
69 #include "HTMLNames.h"
70 #include "HitTestRequest.h"
71 #include "HitTestResult.h"
72 #include "InspectorClientGtk.h"
73 #include "MemoryCache.h"
74 #include "MouseEventWithHitTestResults.h"
75 #include "NotImplemented.h"
76 #include "PageCache.h"
77 #include "Pasteboard.h"
78 #include "PasteboardHelper.h"
79 #include "PlatformKeyboardEvent.h"
80 #include "PlatformWheelEvent.h"
81 #include "ProgressTracker.h"
82 #include "RenderView.h"
83 #include "ResourceHandle.h"
84 #include "ScriptValue.h"
85 #include "Settings.h"
86 #include "webkit/WebKitDOMDocumentPrivate.h"
87 #include "webkitdownload.h"
88 #include "webkitdownloadprivate.h"
89 #include "webkitenumtypes.h"
90 #include "webkitfavicondatabase.h"
91 #include "webkitgeolocationpolicydecision.h"
92 #include "webkitglobalsprivate.h"
93 #include "webkithittestresultprivate.h"
94 #include "webkiticondatabase.h"
95 #include "webkitmarshal.h"
96 #include "webkitnetworkrequest.h"
97 #include "webkitnetworkresponse.h"
98 #include "webkitviewportattributes.h"
99 #include "webkitviewportattributesprivate.h"
100 #include "webkitwebbackforwardlist.h"
101 #include "webkitwebframeprivate.h"
102 #include "webkitwebhistoryitem.h"
103 #include "webkitwebhistoryitemprivate.h"
104 #include "webkitwebinspector.h"
105 #include "webkitwebinspectorprivate.h"
106 #include "webkitwebpolicydecision.h"
107 #include "webkitwebresource.h"
108 #include "webkitwebsettingsprivate.h"
109 #include "webkitwebplugindatabaseprivate.h"
110 #include "webkitwebwindowfeatures.h"
111 #include "webkitwebviewprivate.h"
112 #include <gdk/gdkkeysyms.h>
113 #include <glib/gi18n-lib.h>
114 #include <wtf/gobject/GOwnPtr.h>
115 #include <wtf/text/CString.h>
116
117 #if ENABLE(DEVICE_ORIENTATION)
118 #include "DeviceMotionClientGtk.h"
119 #include "DeviceOrientationClientGtk.h"
120 #endif
121
122 #if ENABLE(MEDIA_STREAM)
123 #include "UserMediaClientGtk.h"
124 #endif
125
126 /**
127  * SECTION:webkitwebview
128  * @short_description: The central class of the WebKitGTK+ API
129  * @see_also: #WebKitWebSettings, #WebKitWebFrame
130  *
131  * #WebKitWebView is the central class of the WebKitGTK+ API. It is a
132  * #GtkWidget implementing the scrolling interface which means you can
133  * embed in a #GtkScrolledWindow. It is responsible for managing the
134  * drawing of the content, forwarding of events. You can load any URI
135  * into the #WebKitWebView or any kind of data string. With #WebKitWebSettings
136  * you can control various aspects of the rendering and loading of the content.
137  * Each #WebKitWebView has exactly one #WebKitWebFrame as main frame. A
138  * #WebKitWebFrame can have n children.
139  *
140  * <programlisting>
141  * /<!-- -->* Create the widgets *<!-- -->/
142  * GtkWidget *main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
143  * GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
144  * GtkWidget *web_view = webkit_web_view_new ();
145  *
146  * /<!-- -->* Place the WebKitWebView in the GtkScrolledWindow *<!-- -->/
147  * gtk_container_add (GTK_CONTAINER (scrolled_window), web_view);
148  * gtk_container_add (GTK_CONTAINER (main_window), scrolled_window);
149  *
150  * /<!-- -->* Open a webpage *<!-- -->/
151  * webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org");
152  *
153  * /<!-- -->* Show the result *<!-- -->/
154  * gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600);
155  * gtk_widget_show_all (main_window);
156  * </programlisting>
157  */
158
159 using namespace WebKit;
160 using namespace WebCore;
161
162 enum {
163     /* normal signals */
164     NAVIGATION_REQUESTED,
165     NEW_WINDOW_POLICY_DECISION_REQUESTED,
166     NAVIGATION_POLICY_DECISION_REQUESTED,
167     MIME_TYPE_POLICY_DECISION_REQUESTED,
168     CREATE_WEB_VIEW,
169     WEB_VIEW_READY,
170     WINDOW_OBJECT_CLEARED,
171     LOAD_STARTED,
172     LOAD_COMMITTED,
173     LOAD_PROGRESS_CHANGED,
174     LOAD_ERROR,
175     LOAD_FINISHED,
176     TITLE_CHANGED,
177     HOVERING_OVER_LINK,
178     POPULATE_POPUP,
179     STATUS_BAR_TEXT_CHANGED,
180     ICON_LOADED,
181     SELECTION_CHANGED,
182     CONSOLE_MESSAGE,
183     SCRIPT_ALERT,
184     SCRIPT_CONFIRM,
185     SCRIPT_PROMPT,
186     SELECT_ALL,
187     COPY_CLIPBOARD,
188     PASTE_CLIPBOARD,
189     CUT_CLIPBOARD,
190     DOWNLOAD_REQUESTED,
191     MOVE_CURSOR,
192     PRINT_REQUESTED,
193     PLUGIN_WIDGET,
194     CLOSE_WEB_VIEW,
195     UNDO,
196     REDO,
197     DATABASE_QUOTA_EXCEEDED,
198     RESOURCE_REQUEST_STARTING,
199     DOCUMENT_LOAD_FINISHED,
200     GEOLOCATION_POLICY_DECISION_REQUESTED,
201     GEOLOCATION_POLICY_DECISION_CANCELLED,
202     ONLOAD_EVENT,
203     FRAME_CREATED,
204     SHOULD_BEGIN_EDITING,
205     SHOULD_END_EDITING,
206     SHOULD_INSERT_NODE,
207     SHOULD_INSERT_TEXT,
208     SHOULD_DELETE_RANGE,
209     SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT,
210     SHOULD_CHANGE_SELECTED_RANGE,
211     SHOULD_APPLY_STYLE,
212     EDITING_BEGAN,
213     USER_CHANGED_CONTENTS,
214     EDITING_ENDED,
215     VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED,
216     VIEWPORT_ATTRIBUTES_CHANGED,
217     RESOURCE_RESPONSE_RECEIVED,
218     RESOURCE_LOAD_FINISHED,
219     RESOURCE_CONTENT_LENGTH_RECEIVED,
220     RESOURCE_LOAD_FAILED,
221     ENTERING_FULLSCREEN,
222     LEAVING_FULLSCREEN,
223     CONTEXT_MENU,
224
225     LAST_SIGNAL
226 };
227
228 enum {
229     PROP_0,
230
231     PROP_TITLE,
232     PROP_URI,
233     PROP_COPY_TARGET_LIST,
234     PROP_PASTE_TARGET_LIST,
235     PROP_EDITABLE,
236     PROP_SETTINGS,
237     PROP_WEB_INSPECTOR,
238     PROP_VIEWPORT_ATTRIBUTES,
239     PROP_WINDOW_FEATURES,
240     PROP_TRANSPARENT,
241     PROP_ZOOM_LEVEL,
242     PROP_FULL_CONTENT_ZOOM,
243     PROP_LOAD_STATUS,
244     PROP_PROGRESS,
245     PROP_ENCODING,
246     PROP_CUSTOM_ENCODING,
247     PROP_ICON_URI,
248     PROP_IM_CONTEXT,
249 #ifdef GTK_API_VERSION_2
250     PROP_VIEW_MODE,
251 #else
252     PROP_VIEW_MODE,
253     PROP_HADJUSTMENT,
254     PROP_VADJUSTMENT,
255     PROP_HSCROLL_POLICY,
256     PROP_VSCROLL_POLICY,
257 #endif
258
259     // Undocumented. Leave these properties at the end of the list
260     // so that we can remove them without breaking ABI compatibility.
261     PROP_SELF_SCROLLING
262 };
263
264 static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
265
266 #ifdef GTK_API_VERSION_2
267 G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
268 #else
269 G_DEFINE_TYPE_WITH_CODE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER,
270                         G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, 0))
271 #endif
272
273 static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
274 static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
275
276 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*);
277
278 #if ENABLE(CONTEXT_MENUS)
279 static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
280 {
281     WebKitWebView* view = WEBKIT_WEB_VIEW(userData);
282     WebKitWebViewPrivate* priv = view->priv;
283     GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view));
284     GtkRequisition menuSize;
285
286 #ifdef GTK_API_VERSION_2
287     gtk_widget_size_request(GTK_WIDGET(menu), &menuSize);
288 #else
289     gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, NULL);
290 #endif
291
292     *x = priv->lastPopupXPosition;
293     if ((*x + menuSize.width) >= gdk_screen_get_width(screen))
294       *x -= menuSize.width;
295
296     *y = priv->lastPopupYPosition;
297     if ((*y + menuSize.height) >= gdk_screen_get_height(screen))
298       *y -= menuSize.height;
299
300     *pushIn = FALSE;
301 }
302 #endif
303
304 static Node* getFocusedNode(Frame* frame)
305 {
306     if (Document* doc = frame->document())
307         return doc->focusedNode();
308     return 0;
309 }
310
311 #if ENABLE(CONTEXT_MENUS)
312 static void contextMenuItemActivated(GtkMenuItem* item, ContextMenuController* controller)
313 {
314     ContextMenuItem contextItem(item);
315     controller->contextMenuItemSelected(&contextItem);
316 }
317
318 static void contextMenuConnectActivate(GtkMenuItem* item, ContextMenuController* controller)
319 {
320     if (GTK_IS_SEPARATOR_MENU_ITEM(item))
321         return;
322
323     if (GtkWidget* menu = gtk_menu_item_get_submenu(item)) {
324         gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback)contextMenuConnectActivate, controller);
325         return;
326     }
327
328     g_signal_connect(item, "activate", G_CALLBACK(contextMenuItemActivated), controller);
329 }
330
331 static MouseEventWithHitTestResults prepareMouseEventForFrame(Frame* frame, const PlatformMouseEvent& event)
332 {
333     HitTestRequest request(HitTestRequest::Active);
334     IntPoint point = frame->view()->windowToContents(event.position());
335     return frame->document()->prepareMouseEvent(request, point, event);
336 }
337
338 // Check enable-default-context-menu setting for compatibility.
339 static bool defaultContextMenuEnabled(WebKitWebView* webView)
340 {
341     gboolean enableDefaultContextMenu;
342     g_object_get(webkit_web_view_get_settings(webView), "enable-default-context-menu", &enableDefaultContextMenu, NULL);
343     return enableDefaultContextMenu;
344 }
345
346 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event, bool triggeredWithKeyboard)
347 {
348     Page* page = core(webView);
349     page->contextMenuController()->clearContextMenu();
350     Frame* focusedFrame;
351     Frame* mainFrame = page->mainFrame();
352     gboolean mousePressEventResult = FALSE;
353     GRefPtr<WebKitHitTestResult> hitTestResult;
354
355     if (!mainFrame->view())
356         return FALSE;
357
358     mainFrame->view()->setCursor(pointerCursor());
359     if (page->frameCount()) {
360         MouseEventWithHitTestResults mev = prepareMouseEventForFrame(mainFrame, event);
361         Frame* targetFrame = EventHandler::subframeForHitTestResult(mev);
362         if (!targetFrame)
363             targetFrame = mainFrame;
364
365         focusedFrame = page->focusController()->focusedOrMainFrame();
366         if (targetFrame != focusedFrame) {
367             page->focusController()->setFocusedFrame(targetFrame);
368             focusedFrame = targetFrame;
369         }
370         if (focusedFrame == mainFrame)
371             hitTestResult = adoptGRef(kit(mev.hitTestResult()));
372     } else
373         focusedFrame = mainFrame;
374
375     if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event))
376         mousePressEventResult = TRUE;
377
378     bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event);
379     if (!handledEvent)
380         return FALSE;
381
382     // If coreMenu is NULL, this means WebCore decided to not create
383     // the default context menu; this may happen when the page is
384     // handling the right-click for reasons other than the context menu.
385     ContextMenuController* controller = page->contextMenuController();
386     ContextMenu* coreMenu = controller->contextMenu();
387     if (!coreMenu)
388         return mousePressEventResult;
389
390     GtkMenu* defaultMenu = coreMenu->platformDescription();
391     ASSERT(defaultMenu);
392
393     // We connect the "activate" signal here rather than in ContextMenuGtk to avoid
394     // a layering violation. ContextMenuGtk should not know about the ContextMenuController.
395     gtk_container_foreach(GTK_CONTAINER(defaultMenu), reinterpret_cast<GtkCallback>(contextMenuConnectActivate), controller);
396
397     if (!hitTestResult) {
398         MouseEventWithHitTestResults mev = prepareMouseEventForFrame(focusedFrame, event);
399         hitTestResult = adoptGRef(kit(mev.hitTestResult()));
400     }
401
402     gboolean handled;
403     g_signal_emit(webView, webkit_web_view_signals[CONTEXT_MENU], 0, defaultMenu, hitTestResult.get(), triggeredWithKeyboard, &handled);
404     if (handled)
405         return TRUE;
406
407     // Return now if default context menu is disabled by enable-default-context-menu setting.
408     // Check enable-default-context-menu setting for compatibility.
409     if (!defaultContextMenuEnabled(webView))
410         return FALSE;
411
412     // Emit populate-popup signal for compatibility.
413     g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, defaultMenu);
414
415     // If the context menu is now empty, don't show it.
416     GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(defaultMenu)));
417     if (!items)
418         return FALSE;
419
420     WebKitWebViewPrivate* priv = webView->priv;
421     priv->currentMenu = defaultMenu;
422     priv->lastPopupXPosition = event.globalPosition().x();
423     priv->lastPopupYPosition = event.globalPosition().y();
424
425     gtk_menu_popup(defaultMenu, 0, 0, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time());
426     return TRUE;
427 }
428
429 static const int gContextMenuMargin = 1;
430 static IntPoint getLocationForKeyboardGeneratedContextMenu(Frame* frame)
431 {
432     FrameSelection* selection = frame->selection();
433     if (!selection->selection().isNonOrphanedCaretOrRange()
434          || (selection->selection().isCaret() && !selection->selection().isContentEditable())) {
435         if (Node* focusedNode = getFocusedNode(frame))
436             return focusedNode->getRect().location();
437
438         // There was no selection and no focused node, so just put the context
439         // menu into the corner of the view, offset slightly.
440         return IntPoint(gContextMenuMargin, gContextMenuMargin);
441     }
442
443     // selection->selection().firstRange can return 0 here, but if that was the case
444     // selection->selection().isNonOrphanedCaretOrRange() would have returned false
445     // above, so we do not have to check it.
446     IntRect firstRect = frame->editor()->firstRectForRange(selection->selection().firstRange().get());
447     return IntPoint(firstRect.x(), firstRect.maxY());
448 }
449
450 static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
451 {
452     Frame* frame = core(WEBKIT_WEB_VIEW(widget))->focusController()->focusedOrMainFrame();
453     IntPoint location = getLocationForKeyboardGeneratedContextMenu(frame);
454
455     FrameView* view = frame->view();
456     if (!view)
457         return FALSE;
458
459     // Never let the context menu touch the very edge of the view.
460     location = view->contentsToWindow(location);
461     location.expandedTo(IntPoint(gContextMenuMargin, gContextMenuMargin));
462     location.shrunkTo(IntPoint(view->width() - gContextMenuMargin, view->height() - gContextMenuMargin));
463
464     IntPoint globalPoint(convertWidgetPointToScreenPoint(widget, location));
465     PlatformMouseEvent event(location, globalPoint, RightButton, PlatformEvent::MousePressed, 0, false, false, false, false, gtk_get_current_event_time());
466     return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event, true);
467 }
468 #endif // ENABLE(CONTEXT_MENUS)
469
470 static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
471 {
472     // This may be called after the page has been destroyed, in which case we do nothing.
473     Page* page = core(webView);
474     if (page)
475         static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setHorizontalAdjustment(adjustment);
476 }
477
478 static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
479 {
480     // This may be called after the page has been destroyed, in which case we do nothing.
481     Page* page = core(webView);
482     if (page)
483         static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setVerticalAdjustment(adjustment);
484 }
485
486 #ifndef GTK_API_VERSION_2
487 static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
488 {
489     Page* page = core(webView);
490     if (page)
491         return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->horizontalAdjustment();
492     return 0;
493 }
494
495 static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView)
496 {
497     Page* page = core(webView);
498     if (page)
499         return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->verticalAdjustment();
500     return 0;
501 }
502
503 static void setHorizontalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
504 {
505     webView->priv->horizontalScrollingPolicy = policy;
506     gtk_widget_queue_resize(GTK_WIDGET(webView));
507 }
508
509 static void setVerticalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
510 {
511     webView->priv->verticalScrollingPolicy = policy;
512     gtk_widget_queue_resize(GTK_WIDGET(webView));
513 }
514
515 static GtkScrollablePolicy getHorizontalScrollPolicy(WebKitWebView* webView)
516 {
517     return webView->priv->horizontalScrollingPolicy;
518 }
519
520 static GtkScrollablePolicy getVerticalScrollPolicy(WebKitWebView* webView)
521 {
522     return webView->priv->verticalScrollingPolicy;
523 }
524
525 #endif
526
527 static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
528 {
529     WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
530
531     switch(prop_id) {
532     case PROP_TITLE:
533         g_value_set_string(value, webkit_web_view_get_title(webView));
534         break;
535     case PROP_URI:
536         g_value_set_string(value, webkit_web_view_get_uri(webView));
537         break;
538     case PROP_COPY_TARGET_LIST:
539         g_value_set_boxed(value, webkit_web_view_get_copy_target_list(webView));
540         break;
541     case PROP_PASTE_TARGET_LIST:
542         g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView));
543         break;
544     case PROP_EDITABLE:
545         g_value_set_boolean(value, webkit_web_view_get_editable(webView));
546         break;
547     case PROP_SETTINGS:
548         g_value_set_object(value, webkit_web_view_get_settings(webView));
549         break;
550     case PROP_WEB_INSPECTOR:
551         g_value_set_object(value, webkit_web_view_get_inspector(webView));
552         break;
553     case PROP_VIEWPORT_ATTRIBUTES:
554         g_value_set_object(value, webkit_web_view_get_viewport_attributes(webView));
555         break;
556     case PROP_WINDOW_FEATURES:
557         g_value_set_object(value, webkit_web_view_get_window_features(webView));
558         break;
559     case PROP_TRANSPARENT:
560         g_value_set_boolean(value, webkit_web_view_get_transparent(webView));
561         break;
562     case PROP_ZOOM_LEVEL:
563         g_value_set_float(value, webkit_web_view_get_zoom_level(webView));
564         break;
565     case PROP_FULL_CONTENT_ZOOM:
566         g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView));
567         break;
568     case PROP_ENCODING:
569         g_value_set_string(value, webkit_web_view_get_encoding(webView));
570         break;
571     case PROP_CUSTOM_ENCODING:
572         g_value_set_string(value, webkit_web_view_get_custom_encoding(webView));
573         break;
574     case PROP_LOAD_STATUS:
575         g_value_set_enum(value, webkit_web_view_get_load_status(webView));
576         break;
577     case PROP_PROGRESS:
578         g_value_set_double(value, webkit_web_view_get_progress(webView));
579         break;
580     case PROP_ICON_URI:
581         g_value_set_string(value, webkit_web_view_get_icon_uri(webView));
582         break;
583     case PROP_IM_CONTEXT:
584         g_value_set_object(value, webkit_web_view_get_im_context(webView));
585         break;
586     case PROP_VIEW_MODE:
587         g_value_set_enum(value, webkit_web_view_get_view_mode(webView));
588         break;
589 #ifndef GTK_API_VERSION_2
590     case PROP_HADJUSTMENT:
591         g_value_set_object(value, getHorizontalAdjustment(webView));
592         break;
593     case PROP_VADJUSTMENT:
594         g_value_set_object(value, getVerticalAdjustment(webView));
595         break;
596     case PROP_HSCROLL_POLICY:
597         g_value_set_enum(value, getHorizontalScrollPolicy(webView));
598         break;
599     case PROP_VSCROLL_POLICY:
600         g_value_set_enum(value, getVerticalScrollPolicy(webView));
601         break;
602 #endif
603     case PROP_SELF_SCROLLING:
604         g_value_set_boolean(value, webView->priv->selfScrolling);
605         break;
606     default:
607         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
608     }
609 }
610
611 static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
612 {
613     WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
614
615     switch(prop_id) {
616     case PROP_EDITABLE:
617         webkit_web_view_set_editable(webView, g_value_get_boolean(value));
618         break;
619     case PROP_SETTINGS:
620         webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value)));
621         break;
622     case PROP_WINDOW_FEATURES:
623         webkit_web_view_set_window_features(webView, WEBKIT_WEB_WINDOW_FEATURES(g_value_get_object(value)));
624         break;
625     case PROP_TRANSPARENT:
626         webkit_web_view_set_transparent(webView, g_value_get_boolean(value));
627         break;
628     case PROP_ZOOM_LEVEL:
629         webkit_web_view_set_zoom_level(webView, g_value_get_float(value));
630         break;
631     case PROP_FULL_CONTENT_ZOOM:
632         webkit_web_view_set_full_content_zoom(webView, g_value_get_boolean(value));
633         break;
634     case PROP_CUSTOM_ENCODING:
635         webkit_web_view_set_custom_encoding(webView, g_value_get_string(value));
636         break;
637     case PROP_VIEW_MODE:
638         webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value)));
639         break;
640 #ifndef GTK_API_VERSION_2
641     case PROP_HADJUSTMENT:
642         setHorizontalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
643         break;
644     case PROP_VADJUSTMENT:
645         setVerticalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
646         break;
647     case PROP_HSCROLL_POLICY:
648         setHorizontalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
649         break;
650     case PROP_VSCROLL_POLICY:
651         setVerticalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
652         break;
653 #endif
654     case PROP_SELF_SCROLLING:
655         webView->priv->selfScrolling = g_value_get_boolean(value);
656         break;
657     default:
658         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
659     }
660 }
661
662 #ifdef GTK_API_VERSION_2
663 static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event)
664 {
665     int rectCount;
666     GOwnPtr<GdkRectangle> rects;
667     gdk_region_get_rectangles(event->region, &rects.outPtr(), &rectCount);
668
669     RefPtr<cairo_t> cr = adoptRef(gdk_cairo_create(event->window));
670     for (int i = 0; i < rectCount; i++) {
671         copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(),
672                                           cr.get(), IntSize(), IntRect(rects.get()[i]));
673     }
674
675     // Chaining up to the parent forces child widgets to be drawn.
676     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->expose_event(widget, event);
677     return FALSE;
678 }
679 #else
680 static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
681 {
682     GdkRectangle clipRect;
683     if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
684         return FALSE;
685
686     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
687 #if USE(TEXTURE_MAPPER_GL)
688     if (priv->acceleratedCompositingContext->renderLayersToWindow(clipRect))
689         return FALSE;
690 #endif
691
692     cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr);
693     if (rectList->status || !rectList->num_rectangles) {
694         cairo_rectangle_list_destroy(rectList);
695         return FALSE;
696     }
697
698     Vector<IntRect> rects;
699     for (int i = 0; i < rectList->num_rectangles; i++) {
700         copyRectFromCairoSurfaceToContext(priv->backingStore->cairoSurface(), cr, IntSize(),
701                                           enclosingIntRect(FloatRect(rectList->rectangles[i])));
702     }
703     cairo_rectangle_list_destroy(rectList);
704
705     // Chaining up to the parent forces child widgets to be drawn.
706     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
707     return FALSE;
708 }
709 #endif // GTK_API_VERSION_2
710
711 static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
712 {
713     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
714
715     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
716     PlatformKeyboardEvent keyboardEvent(event);
717
718     if (!frame->view())
719         return FALSE;
720
721     if (frame->eventHandler()->keyEvent(keyboardEvent))
722         return TRUE;
723
724     /* Chain up to our parent class for binding activation */
725     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event);
726 }
727
728 static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event)
729 {
730     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
731
732     // GTK+ IM contexts often require us to filter key release events, which
733     // WebCore does not do by default, so we filter the event here. We only block
734     // the event if we don't have a pending composition, because that means we
735     // are using a context like 'simple' which marks every keystroke as filtered.
736     WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
737     if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition())
738         return TRUE;
739
740     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
741     if (!frame->view())
742         return FALSE;
743
744     PlatformKeyboardEvent keyboardEvent(event);
745     if (frame->eventHandler()->keyEvent(keyboardEvent))
746         return TRUE;
747
748     /* Chain up to our parent class for binding activation */
749     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_release_event(widget, event);
750 }
751
752 static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
753 {
754     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
755     WebKitWebViewPrivate* priv = webView->priv;
756
757     // FIXME: need to keep track of subframe focus for key events
758     gtk_widget_grab_focus(widget);
759
760     if (!priv->clickCounter.shouldProcessButtonEvent(event))
761         return TRUE;
762
763     PlatformMouseEvent platformEvent(event);
764     int count = priv->clickCounter.clickCountForGdkButtonEvent(widget, event);
765     platformEvent.setClickCount(count);
766
767 #if ENABLE(CONTEXT_MENUS)
768     if (event->button == 3)
769         return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event), false);
770 #endif
771
772     Frame* frame = core(webView)->mainFrame();
773     if (!frame->view())
774         return FALSE;
775
776     gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent);
777     // Handle the IM context when a mouse press fires
778     static_cast<WebKit::EditorClient*>(core(webView)->editorClient())->handleInputMethodMousePress();
779
780 #if PLATFORM(X11)
781     /* Copy selection to the X11 selection clipboard */
782     if (event->button == 2) {
783         PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
784         bool wasUsingPrimary = helper->usePrimarySelectionClipboard();
785         helper->setUsePrimarySelectionClipboard(true);
786
787         Editor* editor = webView->priv->corePage->focusController()->focusedOrMainFrame()->editor();
788         result = result || editor->canPaste() || editor->canDHTMLPaste();
789         editor->paste();
790
791         helper->setUsePrimarySelectionClipboard(wasUsingPrimary);
792     }
793 #endif
794
795     return result;
796 }
797
798 static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
799 {
800     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
801
802     Frame* focusedFrame = core(webView)->focusController()->focusedFrame();
803
804     if (focusedFrame && focusedFrame->editor()->canEdit()) {
805 #ifdef MAEMO_CHANGES
806         WebKitWebViewPrivate* priv = webView->priv;
807         hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event);
808 #endif
809     }
810
811     Frame* mainFrame = core(webView)->mainFrame();
812     if (mainFrame->view())
813         mainFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
814
815     /* We always return FALSE here because WebKit can, for the same click, decide
816      * to not handle press-event but handle release-event, which can totally confuse
817      * some GTK+ containers when there are no other events in between. This way we
818      * guarantee that this case never happens, and that if press-event goes through
819      * release-event also goes through.
820      */
821
822     return FALSE;
823 }
824
825 static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event)
826 {
827     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
828
829     Frame* frame = core(webView)->mainFrame();
830     if (!frame->view())
831         return FALSE;
832
833     return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
834 }
835
836 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
837 {
838     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
839
840     Frame* frame = core(webView)->mainFrame();
841     if (!frame->view())
842         return FALSE;
843
844     PlatformWheelEvent wheelEvent(event);
845     return frame->eventHandler()->handleWheelEvent(wheelEvent);
846 }
847
848 #ifdef GTK_API_VERSION_2
849 static void webkit_web_view_size_request(GtkWidget* widget, GtkRequisition* requisition)
850 {
851     WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
852     Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
853     if (!coreFrame)
854         return;
855
856     FrameView* view = coreFrame->view();
857     if (!view)
858         return;
859
860     requisition->width = view->contentsWidth();
861     requisition->height = view->contentsHeight();
862 }
863 #else
864 static void webkit_web_view_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural)
865 {
866     WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
867     Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
868     if (!coreFrame)
869         return;
870
871     FrameView* view = coreFrame->view();
872     if (!view)
873         return;
874
875     *minimum = *natural = view->contentsWidth();
876 }
877
878 static void webkit_web_view_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural)
879 {
880     WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
881     Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
882     if (!coreFrame)
883         return;
884
885     FrameView* view = coreFrame->view();
886     if (!view)
887         return;
888
889     *minimum = *natural = view->contentsHeight();
890 }
891 #endif
892
893 static void updateChildAllocationFromPendingAllocation(GtkWidget* child, void*)
894 {
895     if (!gtk_widget_get_visible(child))
896         return;
897
898     GtkAllocation* allocation = static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(child), "delayed-allocation"));
899     if (!allocation)
900         return;
901
902     g_object_set_data(G_OBJECT(child), "delayed-allocation", 0);
903     gtk_widget_size_allocate(child, allocation);
904     *allocation = IntRect();
905 }
906
907 static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* allocation)
908 {
909     Page* page = core(webView);
910     IntSize oldSize;
911     if (FrameView* frameView = page->mainFrame()->view()) {
912         oldSize = frameView->size();
913         frameView->resize(allocation->width, allocation->height);
914     }
915
916     gtk_container_forall(GTK_CONTAINER(webView), updateChildAllocationFromPendingAllocation, 0);
917
918     WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
919     chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
920     chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
921
922 #if USE(ACCELERATED_COMPOSITING)
923     webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
924 #endif
925 }
926
927 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
928 {
929     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
930
931     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
932     if (!gtk_widget_get_mapped(widget)) {
933         webView->priv->needsResizeOnMap = true;
934         return;
935     }
936     resizeWebViewFromAllocation(webView, allocation);
937 }
938
939 static void webkitWebViewMap(GtkWidget* widget)
940 {
941     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->map(widget);
942
943     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
944     if (!webView->priv->needsResizeOnMap)
945         return;
946
947     GtkAllocation allocation;
948     gtk_widget_get_allocation(widget, &allocation);
949     resizeWebViewFromAllocation(webView, &allocation);
950     webView->priv->needsResizeOnMap = false;
951 }
952
953 static void webkit_web_view_grab_focus(GtkWidget* widget)
954 {
955
956     if (gtk_widget_is_sensitive(widget)) {
957         WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
958         FocusController* focusController = core(webView)->focusController();
959
960         focusController->setActive(true);
961
962         if (focusController->focusedFrame())
963             focusController->setFocused(true);
964         else
965             focusController->setFocusedFrame(core(webView)->mainFrame());
966     }
967
968     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget);
969 }
970
971 static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* event)
972 {
973     // TODO: Improve focus handling as suggested in
974     // http://bugs.webkit.org/show_bug.cgi?id=16910
975     GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
976     if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
977         WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
978         FocusController* focusController = core(webView)->focusController();
979
980         focusController->setActive(true);
981
982         if (focusController->focusedFrame())
983             focusController->setFocused(true);
984         else
985             focusController->setFocusedFrame(core(webView)->mainFrame());
986
987         if (focusController->focusedFrame()->editor()->canEdit())
988             gtk_im_context_focus_in(webView->priv->imContext.get());
989     }
990     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event);
991 }
992
993 static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus* event)
994 {
995     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
996
997     // We may hit this code while destroying the widget, and we might
998     // no longer have a page, then.
999     Page* page = core(webView);
1000     if (page) {
1001         page->focusController()->setActive(false);
1002         page->focusController()->setFocused(false);
1003     }
1004
1005     if (webView->priv->imContext)
1006         gtk_im_context_focus_out(webView->priv->imContext.get());
1007
1008     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event);
1009 }
1010
1011 static void webkit_web_view_realize(GtkWidget* widget)
1012 {
1013     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
1014
1015     gtk_widget_set_realized(widget, TRUE);
1016
1017     GtkAllocation allocation;
1018 #if GTK_CHECK_VERSION(2, 18, 0)
1019     gtk_widget_get_allocation(widget, &allocation);
1020 #else
1021     allocation = widget->allocation;
1022 #endif
1023
1024     GdkWindowAttr attributes;
1025     attributes.window_type = GDK_WINDOW_CHILD;
1026     attributes.x = allocation.x;
1027     attributes.y = allocation.y;
1028     attributes.width = allocation.width;
1029     attributes.height = allocation.height;
1030     attributes.wclass = GDK_INPUT_OUTPUT;
1031     attributes.visual = gtk_widget_get_visual(widget);
1032 #ifdef GTK_API_VERSION_2
1033     attributes.colormap = gtk_widget_get_colormap(widget);
1034 #endif
1035     attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
1036                             | GDK_EXPOSURE_MASK
1037                             | GDK_BUTTON_PRESS_MASK
1038                             | GDK_BUTTON_RELEASE_MASK
1039                             | GDK_SCROLL_MASK
1040                             | GDK_POINTER_MOTION_MASK
1041                             | GDK_KEY_PRESS_MASK
1042                             | GDK_KEY_RELEASE_MASK
1043                             | GDK_BUTTON_MOTION_MASK
1044                             | GDK_BUTTON1_MOTION_MASK
1045                             | GDK_BUTTON2_MOTION_MASK
1046                             | GDK_BUTTON3_MOTION_MASK;
1047
1048     gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
1049 #ifdef GTK_API_VERSION_2
1050     attributes_mask |= GDK_WA_COLORMAP;
1051 #endif
1052     GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
1053
1054 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
1055     priv->hasNativeWindow = gdk_window_ensure_native(window);
1056 #endif
1057     gtk_widget_set_window(widget, window);
1058     gdk_window_set_user_data(window, widget);
1059
1060 #ifdef GTK_API_VERSION_2
1061 #if GTK_CHECK_VERSION(2, 20, 0)
1062     gtk_widget_style_attach(widget);
1063 #else
1064     widget->style = gtk_style_attach(gtk_widget_get_style(widget), window);
1065 #endif
1066     gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL);
1067 #else
1068     gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
1069 #endif
1070
1071     gtk_im_context_set_client_window(priv->imContext.get(), window);
1072 }
1073
1074 #ifdef GTK_API_VERSION_2
1075 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* horizontalAdjustment, GtkAdjustment* verticalAdjustment)
1076 {
1077     setHorizontalAdjustment(webView, horizontalAdjustment);
1078     setVerticalAdjustment(webView, verticalAdjustment);
1079 }
1080 #endif
1081
1082 static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget)
1083 {
1084     WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1085     WebKitWebViewPrivate* priv = webView->priv;
1086
1087     priv->children.add(widget);
1088     gtk_widget_set_parent(widget, GTK_WIDGET(container));
1089 }
1090
1091 static void webkit_web_view_container_remove(GtkContainer* container, GtkWidget* widget)
1092 {
1093     WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1094     WebKitWebViewPrivate* priv = webView->priv;
1095
1096     if (priv->children.contains(widget)) {
1097         gtk_widget_unparent(widget);
1098         priv->children.remove(widget);
1099     }
1100 }
1101
1102 static void webkit_web_view_container_forall(GtkContainer* container, gboolean, GtkCallback callback, gpointer callbackData)
1103 {
1104     WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1105     WebKitWebViewPrivate* priv = webView->priv;
1106
1107     HashSet<GtkWidget*> children = priv->children;
1108     HashSet<GtkWidget*>::const_iterator end = children.end();
1109     for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current)
1110         (*callback)(*current, callbackData);
1111 }
1112
1113 static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*, WebKitWebFrame*)
1114 {
1115     return 0;
1116 }
1117
1118 static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*)
1119 {
1120     return FALSE;
1121 }
1122
1123 static gboolean webkit_web_view_real_close_web_view(WebKitWebView*)
1124 {
1125     return FALSE;
1126 }
1127
1128 static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame*, WebKitNetworkRequest*)
1129 {
1130     return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
1131 }
1132
1133 static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object)
1134 {
1135     notImplemented();
1136 }
1137
1138 static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name)
1139 {
1140     notImplemented();
1141     return g_strdup(old_name);
1142 }
1143
1144 typedef enum {
1145     WEBKIT_SCRIPT_DIALOG_ALERT,
1146     WEBKIT_SCRIPT_DIALOG_CONFIRM,
1147     WEBKIT_SCRIPT_DIALOG_PROMPT
1148  } WebKitScriptDialogType;
1149
1150 static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, WebKitScriptDialogType type, const gchar* defaultValue, gchar** value)
1151 {
1152     GtkMessageType messageType;
1153     GtkButtonsType buttons;
1154     gint defaultResponse;
1155     GtkWidget* window;
1156     GtkWidget* dialog;
1157     GtkWidget* entry = 0;
1158     gboolean didConfirm = FALSE;
1159
1160     switch (type) {
1161     case WEBKIT_SCRIPT_DIALOG_ALERT:
1162         messageType = GTK_MESSAGE_WARNING;
1163         buttons = GTK_BUTTONS_CLOSE;
1164         defaultResponse = GTK_RESPONSE_CLOSE;
1165         break;
1166     case WEBKIT_SCRIPT_DIALOG_CONFIRM:
1167         messageType = GTK_MESSAGE_QUESTION;
1168         buttons = GTK_BUTTONS_OK_CANCEL;
1169         defaultResponse = GTK_RESPONSE_OK;
1170         break;
1171     case WEBKIT_SCRIPT_DIALOG_PROMPT:
1172         messageType = GTK_MESSAGE_QUESTION;
1173         buttons = GTK_BUTTONS_OK_CANCEL;
1174         defaultResponse = GTK_RESPONSE_OK;
1175         break;
1176     default:
1177         g_warning("Unknown value for WebKitScriptDialogType.");
1178         return FALSE;
1179     }
1180
1181     window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
1182     dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(window) ? GTK_WINDOW(window) : 0,
1183                                     GTK_DIALOG_DESTROY_WITH_PARENT,
1184                                     messageType,
1185                                     buttons,
1186                                     "%s",
1187                                     message);
1188     gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL);
1189     gtk_window_set_title(GTK_WINDOW(dialog), title);
1190     g_free(title);
1191
1192     if (type == WEBKIT_SCRIPT_DIALOG_PROMPT) {
1193         entry = gtk_entry_new();
1194         gtk_entry_set_text(GTK_ENTRY(entry), defaultValue);
1195         gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry);
1196         gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
1197         gtk_widget_show(entry);
1198     }
1199
1200     gtk_dialog_set_default_response(GTK_DIALOG(dialog), defaultResponse);
1201     gint response = gtk_dialog_run(GTK_DIALOG(dialog));
1202
1203     switch (response) {
1204     case GTK_RESPONSE_OK:
1205         didConfirm = TRUE;
1206         if (entry)
1207             *value = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
1208         break;
1209     case GTK_RESPONSE_CANCEL:
1210         didConfirm = FALSE;
1211         break;
1212
1213     }
1214     gtk_widget_destroy(GTK_WIDGET(dialog));
1215     return didConfirm;
1216 }
1217
1218 static gboolean webkit_web_view_real_script_alert(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message)
1219 {
1220     webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_ALERT, 0, 0);
1221     return TRUE;
1222 }
1223
1224 static gboolean webkit_web_view_real_script_confirm(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm)
1225 {
1226     *didConfirm = webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_CONFIRM, 0, 0);
1227     return TRUE;
1228 }
1229
1230 static gboolean webkit_web_view_real_script_prompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value)
1231 {
1232     if (!webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_PROMPT, defaultValue, value))
1233         *value = NULL;
1234     return TRUE;
1235 }
1236
1237 static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, const gchar* message, unsigned int line, const gchar* sourceId)
1238 {
1239     g_message("console message: %s @%d: %s\n", sourceId, line, message);
1240     return TRUE;
1241 }
1242
1243 static void webkit_web_view_real_select_all(WebKitWebView* webView)
1244 {
1245     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1246     frame->editor()->command("SelectAll").execute();
1247 }
1248
1249 static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView)
1250 {
1251     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1252     frame->editor()->command("Cut").execute();
1253 }
1254
1255 static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView)
1256 {
1257     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1258     frame->editor()->command("Copy").execute();
1259 }
1260
1261 static void webkit_web_view_real_undo(WebKitWebView* webView)
1262 {
1263     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1264     frame->editor()->command("Undo").execute();
1265 }
1266
1267 static void webkit_web_view_real_redo(WebKitWebView* webView)
1268 {
1269     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1270     frame->editor()->command("Redo").execute();
1271 }
1272
1273 static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count)
1274 {
1275     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW (webView), FALSE);
1276     g_return_val_if_fail(step == GTK_MOVEMENT_VISUAL_POSITIONS ||
1277                          step == GTK_MOVEMENT_DISPLAY_LINES ||
1278                          step == GTK_MOVEMENT_PAGES ||
1279                          step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
1280     g_return_val_if_fail(count == 1 || count == -1, FALSE);
1281
1282     ScrollDirection direction;
1283     ScrollGranularity granularity;
1284
1285     switch (step) {
1286     case GTK_MOVEMENT_DISPLAY_LINES:
1287         granularity = ScrollByLine;
1288         if (count == 1)
1289             direction = ScrollDown;
1290         else
1291             direction = ScrollUp;
1292         break;
1293     case GTK_MOVEMENT_VISUAL_POSITIONS:
1294         granularity = ScrollByLine;
1295         if (count == 1)
1296             direction = ScrollRight;
1297         else
1298             direction = ScrollLeft;
1299         break;
1300     case GTK_MOVEMENT_PAGES:
1301         granularity = ScrollByPage;
1302         if (count == 1)
1303             direction = ScrollDown;
1304         else
1305             direction = ScrollUp;
1306         break;
1307     case GTK_MOVEMENT_BUFFER_ENDS:
1308         granularity = ScrollByDocument;
1309         if (count == 1)
1310             direction = ScrollDown;
1311         else
1312             direction = ScrollUp;
1313         break;
1314     default:
1315         g_assert_not_reached();
1316         return false;
1317     }
1318
1319     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1320     if (!frame->eventHandler()->scrollOverflow(direction, granularity))
1321         frame->view()->scroll(direction, granularity);
1322
1323     return true;
1324 }
1325
1326 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)
1327 {
1328     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1329     frame->editor()->command("Paste").execute();
1330 }
1331
1332 static gboolean webkit_web_view_real_should_allow_editing_action(WebKitWebView*)
1333 {
1334     return TRUE;
1335 }
1336
1337 static gboolean webkit_web_view_real_entering_fullscreen(WebKitWebView* webView)
1338 {
1339     return FALSE;
1340 }
1341
1342 static gboolean webkit_web_view_real_leaving_fullscreen(WebKitWebView* webView)
1343 {
1344     return FALSE;
1345 }
1346
1347 static void webkit_web_view_dispose(GObject* object)
1348 {
1349     WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
1350     WebKitWebViewPrivate* priv = webView->priv;
1351
1352     priv->disposing = TRUE;
1353
1354     // Make sure GtkAdjustmentWatcher won't be reacting to adjustment changes after the
1355     // WebView is destroyed.
1356     setHorizontalAdjustment(webView, 0);
1357     setVerticalAdjustment(webView, 0);
1358
1359     // These smart pointers are cleared manually, because some cleanup operations are
1360     // very sensitive to their value. We may crash if these are done in the wrong order.
1361     priv->backForwardList.clear();
1362
1363     if (priv->corePage) {
1364         webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object));
1365         core(priv->mainFrame)->loader()->detachFromParent();
1366         delete priv->corePage;
1367         priv->corePage = 0;
1368     }
1369
1370     if (priv->webSettings) {
1371         g_signal_handlers_disconnect_by_func(priv->webSettings.get(), reinterpret_cast<void*>(webkit_web_view_settings_notify), webView);
1372         priv->webSettings.clear();
1373     }
1374
1375     if (priv->currentMenu) {
1376         gtk_widget_destroy(GTK_WIDGET(priv->currentMenu));
1377         priv->currentMenu = 0;
1378     }
1379
1380     priv->webInspector.clear();
1381     priv->viewportAttributes.clear();
1382     priv->webWindowFeatures.clear();
1383     priv->mainResource.clear();
1384     priv->subResources.clear();
1385
1386     G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
1387 }
1388
1389 static void webkit_web_view_finalize(GObject* object)
1390 {
1391     // We need to manually call the destructor here, since this object's memory is managed
1392     // by GLib. This calls all C++ members' destructors and prevents memory leaks.
1393     WEBKIT_WEB_VIEW(object)->priv->~WebKitWebViewPrivate();
1394     G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
1395 }
1396
1397 static gboolean webkit_signal_accumulator_object_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1398 {
1399     gpointer newWebView = g_value_get_object(handlerReturn);
1400     g_value_set_object(returnAccu, newWebView);
1401
1402     // Continue if we don't have a newWebView
1403     return !newWebView;
1404 }
1405
1406 static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1407 {
1408     WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn);
1409     g_value_set_enum(returnAccu, navigationResponse);
1410
1411     if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
1412         return FALSE;
1413
1414     return TRUE;
1415 }
1416
1417 static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
1418 {
1419     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1420     if (!core(webView))
1421         return 0;
1422
1423     if (!AXObjectCache::accessibilityEnabled())
1424         AXObjectCache::enableAccessibility();
1425
1426     Frame* coreFrame = core(webView)->mainFrame();
1427     if (!coreFrame)
1428         return 0;
1429
1430     Document* doc = coreFrame->document();
1431     if (!doc)
1432         return 0;
1433
1434     AccessibilityObject* rootAccessible = doc->axObjectCache()->rootObject();
1435     if (!rootAccessible)
1436         return 0;
1437
1438     AtkObject* axRoot = rootAccessible->wrapper();
1439     if (!axRoot || !ATK_IS_OBJECT(axRoot))
1440         return 0;
1441
1442     // Ensure the parent is set to make top-down and bottom-up navigation work.
1443     GtkWidget* parentWidget = gtk_widget_get_parent(widget);
1444     AtkObject* axParent = parentWidget ? gtk_widget_get_accessible(parentWidget) : 0;
1445     if (axParent)
1446         atk_object_set_parent(axRoot, axParent);
1447
1448     return axRoot;
1449 }
1450
1451 static double screenDPI(GdkScreen* screen)
1452 {
1453     // gdk_screen_get_resolution() returns -1 when no DPI is set.
1454     double dpi = gdk_screen_get_resolution(screen);
1455     if (dpi != -1)
1456         return dpi;
1457
1458     static const double kMillimetresPerInch = 25.4;
1459     double diagonalSizeInPixels = hypot(gdk_screen_get_width(screen), gdk_screen_get_height(screen));
1460     double diagonalSizeInInches = hypot(gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm(screen)) / kMillimetresPerInch;
1461     return diagonalSizeInPixels / diagonalSizeInInches;
1462 }
1463
1464 static gdouble webViewGetDPI(WebKitWebView* webView)
1465 {
1466     if (webView->priv->webSettings->priv->enforce96DPI)
1467         return 96;
1468
1469     static const double defaultDPI = 96;
1470     GdkScreen* screen = gtk_widget_has_screen(GTK_WIDGET(webView)) ? gtk_widget_get_screen(GTK_WIDGET(webView)) : gdk_screen_get_default();
1471     return screen ? screenDPI(screen) : defaultDPI;
1472 }
1473
1474 static inline gint webViewConvertFontSizeToPixels(WebKitWebView* webView, double fontSize)
1475 {
1476     return fontSize / 72.0 * webViewGetDPI(webView);
1477 }
1478
1479 static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previousScreen)
1480 {
1481     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1482     WebKitWebViewPrivate* priv = webView->priv;
1483
1484     if (priv->disposing)
1485         return;
1486
1487     WebKitWebSettings* webSettings = priv->webSettings.get();
1488     Settings* settings = core(webView)->settings();
1489     guint defaultFontSize, defaultMonospaceFontSize, minimumFontSize, minimumLogicalFontSize;
1490
1491     g_object_get(webSettings,
1492                  "default-font-size", &defaultFontSize,
1493                  "default-monospace-font-size", &defaultMonospaceFontSize,
1494                  "minimum-font-size", &minimumFontSize,
1495                  "minimum-logical-font-size", &minimumLogicalFontSize,
1496                  NULL);
1497
1498     settings->setDefaultFontSize(webViewConvertFontSizeToPixels(webView, defaultFontSize));
1499     settings->setDefaultFixedFontSize(webViewConvertFontSizeToPixels(webView, defaultMonospaceFontSize));
1500     settings->setMinimumFontSize(webViewConvertFontSizeToPixels(webView, minimumFontSize));
1501     settings->setMinimumLogicalFontSize(webViewConvertFontSizeToPixels(webView, minimumLogicalFontSize));
1502 }
1503
1504 static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
1505 {
1506     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1507     if (!webView->priv->dragAndDropHelper.handleDragEnd(context))
1508         return;
1509
1510     Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1511     if (!frame)
1512         return;
1513
1514     // Synthesize a button release event to send with the drag end action.
1515     GOwnPtr<GdkEvent> event(gdk_event_new(GDK_BUTTON_RELEASE));
1516     int x, y, xRoot, yRoot;
1517     GdkModifierType modifiers = static_cast<GdkModifierType>(0);
1518 #ifdef GTK_API_VERSION_2
1519     GdkDisplay* display = gdk_display_get_default();
1520     gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers);
1521     event->button.window = gdk_display_get_window_at_pointer(display, &x, &y);
1522 #else
1523     GdkDevice* device = gdk_drag_context_get_device(context);
1524     event->button.window = gdk_device_get_window_at_position(device, &x, &y);
1525     gdk_device_get_position(device, 0, &xRoot, &yRoot);
1526 #endif
1527
1528     if (event->button.window)
1529         g_object_ref(event->button.window);
1530     event->button.x = x;
1531     event->button.y = y;
1532     event->button.x_root = xRoot;
1533     event->button.y_root = yRoot;
1534     event->button.state = modifiers;
1535
1536     PlatformMouseEvent platformEvent(&event->button);
1537     frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
1538 }
1539
1540 static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint)
1541 {
1542     WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleGetDragData(context, selectionData, info);
1543 }
1544
1545 static void dragExitedCallback(GtkWidget* widget, DragData* dragData, bool dropHappened)
1546 {
1547     // Don't call dragExited if we have just received a drag-drop signal. This
1548     // happens in the case of a successful drop onto the view.
1549     if (!dropHappened)
1550         core(WEBKIT_WEB_VIEW(widget))->dragController()->dragExited(dragData);
1551     core(WEBKIT_WEB_VIEW(widget))->dragController()->dragEnded();
1552 }
1553
1554 static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time)
1555 {
1556     WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleDragLeave(context, dragExitedCallback);
1557 }
1558
1559 static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1560 {
1561     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1562     OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragMotion(context, IntPoint(x, y), time));
1563     if (!dragData)
1564         return TRUE;
1565
1566     DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
1567     gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1568     return TRUE;
1569 }
1570
1571 static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
1572 {
1573     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1574     OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info));
1575     if (!dragData)
1576         return;
1577
1578     DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
1579     gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1580 }
1581
1582 static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1583 {
1584     WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1585     OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDrop(context, IntPoint(x, y)));
1586     if (!dragData)
1587         return FALSE;
1588
1589     core(webView)->dragController()->performDrag(dragData.get());
1590     gtk_drag_finish(context, TRUE, FALSE, time);
1591     return TRUE;
1592 }
1593
1594 #if GTK_CHECK_VERSION(2, 12, 0)
1595 static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip)
1596 {
1597     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
1598
1599     if (keyboard_mode) {
1600         WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1601
1602         // Get the title of the current focused element.
1603         Frame* coreFrame = core(webView)->focusController()->focusedOrMainFrame();
1604         if (!coreFrame)
1605             return FALSE;
1606
1607         Node* node = getFocusedNode(coreFrame);
1608         if (!node)
1609             return FALSE;
1610
1611         for (Node* titleNode = node; titleNode; titleNode = titleNode->parentNode()) {
1612             if (titleNode->isElementNode()) {
1613                 String title = static_cast<Element*>(titleNode)->title();
1614                 if (!title.isEmpty()) {
1615                     if (FrameView* view = coreFrame->view()) {
1616                         GdkRectangle area = view->contentsToWindow(node->getRect());
1617                         gtk_tooltip_set_tip_area(tooltip, &area);
1618                     }
1619                     gtk_tooltip_set_text(tooltip, title.utf8().data());
1620
1621                     return TRUE;
1622                 }
1623             }
1624         }
1625
1626         return FALSE;
1627     }
1628
1629     if (priv->tooltipText.length() > 0) {
1630         if (!keyboard_mode) {
1631             if (!priv->tooltipArea.isEmpty()) {
1632                 GdkRectangle area = priv->tooltipArea;
1633                 gtk_tooltip_set_tip_area(tooltip, &area);
1634             } else
1635                 gtk_tooltip_set_tip_area(tooltip, 0);
1636         }
1637         gtk_tooltip_set_text(tooltip, priv->tooltipText.data());
1638         return TRUE;
1639     }
1640
1641     return FALSE;
1642 }
1643
1644 static gboolean webkit_web_view_show_help(GtkWidget* widget, GtkWidgetHelpType help_type)
1645 {
1646     if (help_type == GTK_WIDGET_HELP_TOOLTIP)
1647         gtk_widget_set_has_tooltip(widget, TRUE);
1648
1649     return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->show_help(widget, help_type);
1650 }
1651 #endif
1652
1653 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
1654 {
1655     g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
1656     return GTK_IM_CONTEXT(webView->priv->imContext.get());
1657 }
1658
1659 static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
1660 {
1661     GtkBindingSet* binding_set;
1662
1663     webkitInit();
1664
1665     /*
1666      * Signals
1667      */
1668
1669     /**
1670      * WebKitWebView::create-web-view:
1671      * @web_view: the object on which the signal is emitted
1672      * @frame: the #WebKitWebFrame
1673      *
1674      * Emitted when the creation of a new window is requested.
1675      * If this signal is handled the signal handler should return the
1676      * newly created #WebKitWebView.
1677      *
1678      * The new #WebKitWebView should not be displayed to the user
1679      * until the #WebKitWebView::web-view-ready signal is emitted.
1680      *
1681      * The signal handlers should not try to deal with the reference count for
1682      * the new #WebKitWebView. The widget to which the widget is added will
1683      * handle that.
1684      *
1685      * Return value: (transfer full): a newly allocated #WebKitWebView, or %NULL
1686      *
1687      * Since: 1.0.3
1688      */
1689     webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view",
1690             G_TYPE_FROM_CLASS(webViewClass),
1691             (GSignalFlags)G_SIGNAL_RUN_LAST,
1692             G_STRUCT_OFFSET (WebKitWebViewClass, create_web_view),
1693             webkit_signal_accumulator_object_handled,
1694             NULL,
1695             webkit_marshal_OBJECT__OBJECT,
1696             WEBKIT_TYPE_WEB_VIEW , 1,
1697             WEBKIT_TYPE_WEB_FRAME);
1698
1699     /**
1700      * WebKitWebView::web-view-ready:
1701      * @web_view: the object on which the signal is emitted
1702      *
1703      * Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView
1704      * should be displayed to the user. When this signal is emitted
1705      * all the information about how the window should look, including
1706      * size, position, whether the location, status and scroll bars
1707      * should be displayed, is already set on the
1708      * #WebKitWebWindowFeatures object contained by the #WebKitWebView.
1709      *
1710      * Notice that some of that information may change during the life
1711      * time of the window, so you may want to connect to the ::notify
1712      * signal of the #WebKitWebWindowFeatures object to handle those.
1713      *
1714      * Return value: %TRUE to stop handlers from being invoked for the event or
1715      * %FALSE to propagate the event furter
1716      *
1717      * Since: 1.0.3
1718      */
1719     webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready",
1720             G_TYPE_FROM_CLASS(webViewClass),
1721             (GSignalFlags)G_SIGNAL_RUN_LAST,
1722             G_STRUCT_OFFSET (WebKitWebViewClass, web_view_ready),
1723             g_signal_accumulator_true_handled,
1724             NULL,
1725             webkit_marshal_BOOLEAN__VOID,
1726             G_TYPE_BOOLEAN, 0);
1727
1728     /**
1729      * WebKitWebView::close-web-view:
1730      * @web_view: the object on which the signal is emitted
1731      *
1732      * Emitted when closing a #WebKitWebView is requested. This occurs when a
1733      * call is made from JavaScript's window.close function. The default
1734      * signal handler does not do anything. It is the owner's responsibility
1735      * to hide or delete the web view, if necessary.
1736      *
1737      * Return value: %TRUE to stop handlers from being invoked for the event or
1738      * %FALSE to propagate the event furter
1739      *
1740      * Since: 1.1.11
1741      */
1742     webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view",
1743             G_TYPE_FROM_CLASS(webViewClass),
1744             (GSignalFlags)G_SIGNAL_RUN_LAST,
1745             G_STRUCT_OFFSET (WebKitWebViewClass, close_web_view),
1746             g_signal_accumulator_true_handled,
1747             NULL,
1748             webkit_marshal_BOOLEAN__VOID,
1749             G_TYPE_BOOLEAN, 0);
1750
1751     /**
1752      * WebKitWebView::navigation-requested:
1753      * @web_view: the object on which the signal is emitted
1754      * @frame: the #WebKitWebFrame that required the navigation
1755      * @request: a #WebKitNetworkRequest
1756      *
1757      * Emitted when @frame requests a navigation to another page.
1758      *
1759      * Return value: a #WebKitNavigationResponse
1760      *
1761      * Deprecated: Use WebKitWebView::navigation-policy-decision-requested
1762      * instead
1763      */
1764     webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
1765             G_TYPE_FROM_CLASS(webViewClass),
1766             (GSignalFlags)G_SIGNAL_RUN_LAST,
1767             G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested),
1768             webkit_navigation_request_handled,
1769             NULL,
1770             webkit_marshal_ENUM__OBJECT_OBJECT,
1771             WEBKIT_TYPE_NAVIGATION_RESPONSE, 2,
1772             WEBKIT_TYPE_WEB_FRAME,
1773             WEBKIT_TYPE_NETWORK_REQUEST);
1774
1775     /**
1776      * WebKitWebView::new-window-policy-decision-requested:
1777      * @web_view: the object on which the signal is emitted
1778      * @frame: the #WebKitWebFrame that required the navigation
1779      * @request: a #WebKitNetworkRequest
1780      * @navigation_action: a #WebKitWebNavigationAction
1781      * @policy_decision: a #WebKitWebPolicyDecision
1782      *
1783      * Emitted when @frame requests opening a new window. With this
1784      * signal the browser can use the context of the request to decide
1785      * about the new window. If the request is not handled the default
1786      * behavior is to allow opening the new window to load the URI,
1787      * which will cause a create-web-view signal emission where the
1788      * browser handles the new window action but without information
1789      * of the context that caused the navigation. The following
1790      * navigation-policy-decision-requested emissions will load the
1791      * page after the creation of the new window just with the
1792      * information of this new navigation context, without any
1793      * information about the action that made this new window to be
1794      * opened.
1795      *
1796      * Notice that if you return TRUE, meaning that you handled the
1797      * signal, you are expected to have decided what to do, by calling
1798      * webkit_web_policy_decision_ignore(),
1799      * webkit_web_policy_decision_use(), or
1800      * webkit_web_policy_decision_download() on the @policy_decision
1801      * object.
1802      *
1803      * Return value: %TRUE if a decision was made, %FALSE to have the
1804      * default behavior apply
1805      *
1806      * Since: 1.1.4
1807      */
1808     webkit_web_view_signals[NEW_WINDOW_POLICY_DECISION_REQUESTED] =
1809         g_signal_new("new-window-policy-decision-requested",
1810             G_TYPE_FROM_CLASS(webViewClass),
1811             (GSignalFlags)G_SIGNAL_RUN_LAST,
1812             0,
1813             g_signal_accumulator_true_handled,
1814             NULL,
1815             webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1816             G_TYPE_BOOLEAN, 4,
1817             WEBKIT_TYPE_WEB_FRAME,
1818             WEBKIT_TYPE_NETWORK_REQUEST,
1819             WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1820             WEBKIT_TYPE_WEB_POLICY_DECISION);
1821
1822     /**
1823      * WebKitWebView::navigation-policy-decision-requested:
1824      * @web_view: the object on which the signal is emitted
1825      * @frame: the #WebKitWebFrame that required the navigation
1826      * @request: a #WebKitNetworkRequest
1827      * @navigation_action: a #WebKitWebNavigationAction
1828      * @policy_decision: a #WebKitWebPolicyDecision
1829      *
1830      * Emitted when @frame requests a navigation to another page.
1831      * If this signal is not handled, the default behavior is to allow the
1832      * navigation.
1833      *
1834      * Notice that if you return TRUE, meaning that you handled the
1835      * signal, you are expected to have decided what to do, by calling
1836      * webkit_web_policy_decision_ignore(),
1837      * webkit_web_policy_decision_use(), or
1838      * webkit_web_policy_decision_download() on the @policy_decision
1839      * object.
1840      *
1841      * Return value: %TRUE if a decision was made, %FALSE to have the
1842      * default behavior apply
1843      *
1844      * Since: 1.0.3
1845      */
1846     webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested",
1847             G_TYPE_FROM_CLASS(webViewClass),
1848             (GSignalFlags)G_SIGNAL_RUN_LAST,
1849             0,
1850             g_signal_accumulator_true_handled,
1851             NULL,
1852             webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1853             G_TYPE_BOOLEAN, 4,
1854             WEBKIT_TYPE_WEB_FRAME,
1855             WEBKIT_TYPE_NETWORK_REQUEST,
1856             WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1857             WEBKIT_TYPE_WEB_POLICY_DECISION);
1858
1859     /**
1860      * WebKitWebView::mime-type-policy-decision-requested:
1861      * @web_view: the object on which the signal is emitted
1862      * @frame: the #WebKitWebFrame that required the policy decision
1863      * @request: a WebKitNetworkRequest
1864      * @mimetype: the MIME type attempted to load
1865      * @policy_decision: a #WebKitWebPolicyDecision
1866      *
1867      * Decide whether or not to display the given MIME type.  If this
1868      * signal is not handled, the default behavior is to show the
1869      * content of the requested URI if WebKit can show this MIME
1870      * type and the content disposition is not a download; if WebKit
1871      * is not able to show the MIME type nothing happens.
1872      *
1873      * Notice that if you return TRUE, meaning that you handled the
1874      * signal, you are expected to be aware of the "Content-Disposition"
1875      * header. A value of "attachment" usually indicates a download
1876      * regardless of the MIME type, see also
1877      * soup_message_headers_get_content_disposition(). And you must call
1878      * webkit_web_policy_decision_ignore(),
1879      * webkit_web_policy_decision_use(), or
1880      * webkit_web_policy_decision_download() on the @policy_decision
1881      * object.
1882      *
1883      * Return value: %TRUE if a decision was made, %FALSE to have the
1884      * default behavior apply
1885      *
1886      * Since: 1.0.3
1887      */
1888     webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested",
1889             G_TYPE_FROM_CLASS(webViewClass),
1890             (GSignalFlags)G_SIGNAL_RUN_LAST,
1891             0,
1892             g_signal_accumulator_true_handled,
1893             NULL,
1894             webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT,
1895             G_TYPE_BOOLEAN, 4,
1896             WEBKIT_TYPE_WEB_FRAME,
1897             WEBKIT_TYPE_NETWORK_REQUEST,
1898             G_TYPE_STRING,
1899             WEBKIT_TYPE_WEB_POLICY_DECISION);
1900
1901     /**
1902      * WebKitWebView::window-object-cleared:
1903      * @web_view: the object on which the signal is emitted
1904      * @frame: the #WebKitWebFrame to which @window_object belongs
1905      * @context: the #JSGlobalContextRef holding the global object and other
1906      * execution state; equivalent to the return value of
1907      * webkit_web_frame_get_global_context(@frame)
1908      * @window_object: the #JSObjectRef representing the frame's JavaScript
1909      * window object
1910      *
1911      * Emitted when the JavaScript window object in a #WebKitWebFrame has been
1912      * cleared in preparation for a new load. This is the preferred place to
1913      * set custom properties on the window object using the JavaScriptCore API.
1914      */
1915     webkit_web_view_signals[WINDOW_OBJECT_CLEARED] = g_signal_new("window-object-cleared",
1916             G_TYPE_FROM_CLASS(webViewClass),
1917             (GSignalFlags)G_SIGNAL_RUN_LAST,
1918             G_STRUCT_OFFSET (WebKitWebViewClass, window_object_cleared),
1919             NULL,
1920             NULL,
1921             webkit_marshal_VOID__OBJECT_POINTER_POINTER,
1922             G_TYPE_NONE, 3,
1923             WEBKIT_TYPE_WEB_FRAME,
1924             G_TYPE_POINTER,
1925             G_TYPE_POINTER);
1926
1927     /**
1928      * WebKitWebView::download-requested:
1929      * @web_view: the object on which the signal is emitted
1930      * @download: a #WebKitDownload object that lets you control the
1931      * download process
1932      *
1933      * A new Download is being requested. By default, if the signal is
1934      * not handled, the download is cancelled. If you handle the download
1935      * and call webkit_download_set_destination_uri(), it will be
1936      * started for you. If you need to set the destination asynchronously
1937      * you are responsible for starting or cancelling it yourself.
1938      *
1939      * If you intend to handle downloads yourself rather than using
1940      * the #WebKitDownload helper object you must handle this signal,
1941      * and return %FALSE.
1942      *
1943      * Also, keep in mind that the default policy for WebKitGTK+ is to
1944      * ignore files with a MIME type that it does not know how to
1945      * handle, which means this signal won't be emitted in the default
1946      * setup. One way to trigger downloads is to connect to
1947      * WebKitWebView::mime-type-policy-decision-requested and call
1948      * webkit_web_policy_decision_download() on the
1949      * #WebKitWebPolicyDecision in the parameter list for the kind of
1950      * files you want your application to download (a common solution
1951      * is to download anything that WebKit can't handle, which you can
1952      * figure out by using webkit_web_view_can_show_mime_type()).
1953      *
1954      * Return value: TRUE if the download should be performed, %FALSE to
1955      * cancel it
1956      *
1957      * Since: 1.1.2
1958      */
1959     webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested",
1960             G_TYPE_FROM_CLASS(webViewClass),
1961             (GSignalFlags)G_SIGNAL_RUN_LAST,
1962             0,
1963             g_signal_accumulator_true_handled,
1964             NULL,
1965             webkit_marshal_BOOLEAN__OBJECT,
1966             G_TYPE_BOOLEAN, 1,
1967             G_TYPE_OBJECT);
1968
1969     /**
1970      * WebKitWebView::load-started:
1971      * @web_view: the object on which the signal is emitted
1972      * @frame: the frame going to do the load
1973      *
1974      * When a #WebKitWebFrame begins to load this signal is emitted.
1975      *
1976      * Deprecated: Use the "load-status" property instead.
1977      */
1978     webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
1979             G_TYPE_FROM_CLASS(webViewClass),
1980             (GSignalFlags)G_SIGNAL_RUN_LAST,
1981             0,
1982             NULL,
1983             NULL,
1984             g_cclosure_marshal_VOID__OBJECT,
1985             G_TYPE_NONE, 1,
1986             WEBKIT_TYPE_WEB_FRAME);
1987
1988     /**
1989      * WebKitWebView::load-committed:
1990      * @web_view: the object on which the signal is emitted
1991      * @frame: the main frame that received the first data
1992      *
1993      * When a #WebKitWebFrame loaded the first data this signal is emitted.
1994      *
1995      * Deprecated: Use the "load-status" property instead.
1996      */
1997     webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
1998             G_TYPE_FROM_CLASS(webViewClass),
1999             (GSignalFlags)G_SIGNAL_RUN_LAST,
2000             0,
2001             NULL,
2002             NULL,
2003             g_cclosure_marshal_VOID__OBJECT,
2004             G_TYPE_NONE, 1,
2005             WEBKIT_TYPE_WEB_FRAME);
2006
2007
2008     /**
2009      * WebKitWebView::load-progress-changed:
2010      * @web_view: the #WebKitWebView
2011      * @progress: the global progress
2012      *
2013      * Deprecated: Use the "progress" property instead.
2014      */
2015     webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
2016             G_TYPE_FROM_CLASS(webViewClass),
2017             (GSignalFlags)G_SIGNAL_RUN_LAST,
2018             0,
2019             NULL,
2020             NULL,
2021             g_cclosure_marshal_VOID__INT,
2022             G_TYPE_NONE, 1,
2023             G_TYPE_INT);
2024
2025     /**
2026      * WebKitWebView::load-error
2027      * @web_view: the object on which the signal is emitted
2028      * @web_frame: the #WebKitWebFrame
2029      * @uri: the URI that triggered the error
2030      * @web_error: the #GError that was triggered
2031      *
2032      * An error occurred while loading. By default, if the signal is not
2033      * handled, the @web_view will display a stock error page. You need to
2034      * handle the signal if you want to provide your own error page.
2035      *
2036      * Since: 1.1.6
2037      *
2038      * Return value: %TRUE to stop other handlers from being invoked for the
2039      * event. %FALSE to propagate the event further.
2040      */
2041     webkit_web_view_signals[LOAD_ERROR] = g_signal_new("load-error",
2042             G_TYPE_FROM_CLASS(webViewClass),
2043             (GSignalFlags)(G_SIGNAL_RUN_LAST),
2044             0,
2045             g_signal_accumulator_true_handled,
2046             NULL,
2047             webkit_marshal_BOOLEAN__OBJECT_STRING_BOXED,
2048             G_TYPE_BOOLEAN, 3,
2049             WEBKIT_TYPE_WEB_FRAME,
2050             G_TYPE_STRING,
2051             G_TYPE_ERROR);
2052
2053     /**
2054      * WebKitWebView::load-finished:
2055      * @web_view: the #WebKitWebView
2056      * @frame: the #WebKitWebFrame
2057      *
2058      * Deprecated: Use the "load-status" property instead.
2059      */
2060     webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
2061             G_TYPE_FROM_CLASS(webViewClass),
2062             (GSignalFlags)G_SIGNAL_RUN_LAST,
2063             0,
2064             NULL,
2065             NULL,
2066             g_cclosure_marshal_VOID__OBJECT,
2067             G_TYPE_NONE, 1,
2068             WEBKIT_TYPE_WEB_FRAME);
2069
2070     /**
2071      * WebKitWebView::onload-event:
2072      * @web_view: the object on which the signal is emitted
2073      * @frame: the frame
2074      *
2075      * When a #WebKitWebFrame receives an onload event this signal is emitted.
2076      */
2077     webkit_web_view_signals[ONLOAD_EVENT] = g_signal_new("onload-event",
2078             G_TYPE_FROM_CLASS(webViewClass),
2079             (GSignalFlags)G_SIGNAL_RUN_LAST,
2080             0,
2081             NULL,
2082             NULL,
2083             g_cclosure_marshal_VOID__OBJECT,
2084             G_TYPE_NONE, 1,
2085             WEBKIT_TYPE_WEB_FRAME);
2086
2087     /**
2088      * WebKitWebView::title-changed:
2089      * @web_view: the object on which the signal is emitted
2090      * @frame: the main frame
2091      * @title: the new title
2092      *
2093      * When a #WebKitWebFrame changes the document title this signal is emitted.
2094      *
2095      * Deprecated: 1.1.4: Use "notify::title" instead.
2096      */
2097     webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed",
2098             G_TYPE_FROM_CLASS(webViewClass),
2099             (GSignalFlags)G_SIGNAL_RUN_LAST,
2100             0,
2101             NULL,
2102             NULL,
2103             webkit_marshal_VOID__OBJECT_STRING,
2104             G_TYPE_NONE, 2,
2105             WEBKIT_TYPE_WEB_FRAME,
2106             G_TYPE_STRING);
2107
2108     /**
2109      * WebKitWebView::hovering-over-link:
2110      * @web_view: the object on which the signal is emitted
2111      * @title: the link's title
2112      * @uri: the URI the link points to
2113      *
2114      * When the cursor is over a link, this signal is emitted.
2115      */
2116     webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
2117             G_TYPE_FROM_CLASS(webViewClass),
2118             (GSignalFlags)G_SIGNAL_RUN_LAST,
2119             0,
2120             NULL,
2121             NULL,
2122             webkit_marshal_VOID__STRING_STRING,
2123             G_TYPE_NONE, 2,
2124             G_TYPE_STRING,
2125             G_TYPE_STRING);
2126
2127     /**
2128      * WebKitWebView::populate-popup:
2129      * @web_view: the object on which the signal is emitted
2130      * @menu: the context menu
2131      *
2132      * When a context menu is about to be displayed this signal is emitted.
2133      *
2134      * Add menu items to #menu to extend the context menu.
2135      *
2136      * Deprecated: 1.10: Use #WebKitWebView::context-menu signal instead.
2137      */
2138     webkit_web_view_signals[POPULATE_POPUP] = g_signal_new("populate-popup",
2139             G_TYPE_FROM_CLASS(webViewClass),
2140             (GSignalFlags)G_SIGNAL_RUN_LAST,
2141             0,
2142             NULL,
2143             NULL,
2144             g_cclosure_marshal_VOID__OBJECT,
2145             G_TYPE_NONE, 1,
2146             GTK_TYPE_MENU);
2147
2148     /**
2149      * WebKitWebView::print-requested
2150      * @web_view: the object in which the signal is emitted
2151      * @web_frame: the frame that is requesting to be printed
2152      *
2153      * Emitted when printing is requested by the frame, usually
2154      * because of a javascript call. When handling this signal you
2155      * should call webkit_web_frame_print_full() or
2156      * webkit_web_frame_print() to do the actual printing.
2157      *
2158      * The default handler will present a print dialog and carry a
2159      * print operation. Notice that this means that if you intend to
2160      * ignore a print request you must connect to this signal, and
2161      * return %TRUE.
2162      *
2163      * Return value: %TRUE if the print request has been handled, %FALSE if
2164      * the default handler should run
2165      *
2166      * Since: 1.1.5
2167      */
2168     webkit_web_view_signals[PRINT_REQUESTED] = g_signal_new("print-requested",
2169             G_TYPE_FROM_CLASS(webViewClass),
2170             (GSignalFlags)G_SIGNAL_RUN_LAST,
2171             0,
2172             g_signal_accumulator_true_handled,
2173             NULL,
2174             webkit_marshal_BOOLEAN__OBJECT,
2175             G_TYPE_BOOLEAN, 1,
2176             WEBKIT_TYPE_WEB_FRAME);
2177
2178     webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed",
2179             G_TYPE_FROM_CLASS(webViewClass),
2180             (GSignalFlags)G_SIGNAL_RUN_LAST,
2181             0,
2182             NULL,
2183             NULL,
2184             g_cclosure_marshal_VOID__STRING,
2185             G_TYPE_NONE, 1,
2186             G_TYPE_STRING);
2187
2188     /**
2189      * WebKitWebView::icon-loaded:
2190      * @web_view: the object on which the signal is emitted
2191      * @icon_uri: the URI for the icon
2192      *
2193      * This signal is emitted when the main frame has got a favicon.
2194      * See WebKitIconDatabase::icon-loaded if you want to keep track of
2195      * icons for child frames.
2196      *
2197      * Since: 1.1.18
2198      */
2199     webkit_web_view_signals[ICON_LOADED] = g_signal_new("icon-loaded",
2200             G_TYPE_FROM_CLASS(webViewClass),
2201             (GSignalFlags)G_SIGNAL_RUN_LAST,
2202             0,
2203             NULL,
2204             NULL,
2205             g_cclosure_marshal_VOID__STRING,
2206             G_TYPE_NONE, 1,
2207             G_TYPE_STRING);
2208
2209     /**
2210      * WebKitWebView::console-message:
2211      * @web_view: the object on which the signal is emitted
2212      * @message: the message text
2213      * @line: the line where the error occured
2214      * @source_id: the source id
2215      *
2216      * A JavaScript console message was created.
2217      *
2218      * Return value: %TRUE to stop other handlers from being invoked for the
2219      * event. %FALSE to propagate the event further.
2220      */
2221     webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message",
2222             G_TYPE_FROM_CLASS(webViewClass),
2223             (GSignalFlags)G_SIGNAL_RUN_LAST,
2224             G_STRUCT_OFFSET(WebKitWebViewClass, console_message),
2225             g_signal_accumulator_true_handled,
2226             NULL,
2227             webkit_marshal_BOOLEAN__STRING_INT_STRING,
2228             G_TYPE_BOOLEAN, 3,
2229             G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
2230
2231     /**
2232      * WebKitWebView::script-alert:
2233      * @web_view: the object on which the signal is emitted
2234      * @frame: the relevant frame
2235      * @message: the message text
2236      *
2237      * A JavaScript alert dialog was created.
2238      *
2239      * Return value: %TRUE to stop other handlers from being invoked for the
2240      * event. %FALSE to propagate the event further.
2241      */
2242     webkit_web_view_signals[SCRIPT_ALERT] = g_signal_new("script-alert",
2243             G_TYPE_FROM_CLASS(webViewClass),
2244             (GSignalFlags)G_SIGNAL_RUN_LAST,
2245             G_STRUCT_OFFSET(WebKitWebViewClass, script_alert),
2246             g_signal_accumulator_true_handled,
2247             NULL,
2248             webkit_marshal_BOOLEAN__OBJECT_STRING,
2249             G_TYPE_BOOLEAN, 2,
2250             WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING);
2251
2252     /**
2253      * WebKitWebView::script-confirm:
2254      * @web_view: the object on which the signal is emitted
2255      * @frame: the relevant frame
2256      * @message: the message text
2257      * @confirmed: whether the dialog has been confirmed
2258      *
2259      * A JavaScript confirm dialog was created, providing Yes and No buttons.
2260      *
2261      * Return value: %TRUE to stop other handlers from being invoked for the
2262      * event. %FALSE to propagate the event further.
2263      */
2264     webkit_web_view_signals[SCRIPT_CONFIRM] = g_signal_new("script-confirm",
2265             G_TYPE_FROM_CLASS(webViewClass),
2266             (GSignalFlags)G_SIGNAL_RUN_LAST,
2267             G_STRUCT_OFFSET(WebKitWebViewClass, script_confirm),
2268             g_signal_accumulator_true_handled,
2269             NULL,
2270             webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER,
2271             G_TYPE_BOOLEAN, 3,
2272             WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_POINTER);
2273
2274     /**
2275      * WebKitWebView::script-prompt:
2276      * @web_view: the object on which the signal is emitted
2277      * @frame: the relevant frame
2278      * @message: the message text
2279      * @default: the default value
2280      * @text: To be filled with the return value or NULL if the dialog was cancelled.
2281      *
2282      * A JavaScript prompt dialog was created, providing an entry to input text.
2283      *
2284      * Return value: %TRUE to stop other handlers from being invoked for the
2285      * event. %FALSE to propagate the event further.
2286      */
2287     webkit_web_view_signals[SCRIPT_PROMPT] = g_signal_new("script-prompt",
2288             G_TYPE_FROM_CLASS(webViewClass),
2289             (GSignalFlags)G_SIGNAL_RUN_LAST,
2290             G_STRUCT_OFFSET(WebKitWebViewClass, script_prompt),
2291             g_signal_accumulator_true_handled,
2292             NULL,
2293             webkit_marshal_BOOLEAN__OBJECT_STRING_STRING_STRING,
2294             G_TYPE_BOOLEAN, 4,
2295             WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
2296
2297     /**
2298      * WebKitWebView::select-all:
2299      * @web_view: the object which received the signal
2300      *
2301      * The #WebKitWebView::select-all signal is a keybinding signal which gets emitted to
2302      * select the complete contents of the text view.
2303      *
2304      * The default bindings for this signal is Ctrl-a.
2305      */
2306     webkit_web_view_signals[SELECT_ALL] = g_signal_new("select-all",
2307             G_TYPE_FROM_CLASS(webViewClass),
2308             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2309             G_STRUCT_OFFSET(WebKitWebViewClass, select_all),
2310             NULL, NULL,
2311             g_cclosure_marshal_VOID__VOID,
2312             G_TYPE_NONE, 0);
2313
2314     /**
2315      * WebKitWebView::cut-clipboard:
2316      * @web_view: the object which received the signal
2317      *
2318      * The #WebKitWebView::cut-clipboard signal is a keybinding signal which gets emitted to
2319      * cut the selection to the clipboard.
2320      *
2321      * The default bindings for this signal are Ctrl-x and Shift-Delete.
2322      */
2323     webkit_web_view_signals[CUT_CLIPBOARD] = g_signal_new("cut-clipboard",
2324             G_TYPE_FROM_CLASS(webViewClass),
2325             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2326             G_STRUCT_OFFSET(WebKitWebViewClass, cut_clipboard),
2327             NULL, NULL,
2328             g_cclosure_marshal_VOID__VOID,
2329             G_TYPE_NONE, 0);
2330
2331     /**
2332      * WebKitWebView::copy-clipboard:
2333      * @web_view: the object which received the signal
2334      *
2335      * The #WebKitWebView::copy-clipboard signal is a keybinding signal which gets emitted to
2336      * copy the selection to the clipboard.
2337      *
2338      * The default bindings for this signal are Ctrl-c and Ctrl-Insert.
2339      */
2340     webkit_web_view_signals[COPY_CLIPBOARD] = g_signal_new("copy-clipboard",
2341             G_TYPE_FROM_CLASS(webViewClass),
2342             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2343             G_STRUCT_OFFSET(WebKitWebViewClass, copy_clipboard),
2344             NULL, NULL,
2345             g_cclosure_marshal_VOID__VOID,
2346             G_TYPE_NONE, 0);
2347
2348     /**
2349      * WebKitWebView::paste-clipboard:
2350      * @web_view: the object which received the signal
2351      *
2352      * The #WebKitWebView::paste-clipboard signal is a keybinding signal which gets emitted to
2353      * paste the contents of the clipboard into the Web view.
2354      *
2355      * The default bindings for this signal are Ctrl-v and Shift-Insert.
2356      */
2357     webkit_web_view_signals[PASTE_CLIPBOARD] = g_signal_new("paste-clipboard",
2358             G_TYPE_FROM_CLASS(webViewClass),
2359             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2360             G_STRUCT_OFFSET(WebKitWebViewClass, paste_clipboard),
2361             NULL, NULL,
2362             g_cclosure_marshal_VOID__VOID,
2363             G_TYPE_NONE, 0);
2364
2365     /**
2366      * WebKitWebView::undo
2367      * @web_view: the object which received the signal
2368      *
2369      * The #WebKitWebView::undo signal is a keybinding signal which gets emitted to
2370      * undo the last editing command.
2371      *
2372      * The default binding for this signal is Ctrl-z
2373      *
2374      * Since: 1.1.14
2375      */
2376     webkit_web_view_signals[UNDO] = g_signal_new("undo",
2377             G_TYPE_FROM_CLASS(webViewClass),
2378             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2379             G_STRUCT_OFFSET(WebKitWebViewClass, undo),
2380             NULL, NULL,
2381             g_cclosure_marshal_VOID__VOID,
2382             G_TYPE_NONE, 0);
2383
2384     /**
2385      * WebKitWebView::redo
2386      * @web_view: the object which received the signal
2387      *
2388      * The #WebKitWebView::redo signal is a keybinding signal which gets emitted to
2389      * redo the last editing command.
2390      *
2391      * The default binding for this signal is Ctrl-Shift-z
2392      *
2393      * Since: 1.1.14
2394      */
2395     webkit_web_view_signals[REDO] = g_signal_new("redo",
2396             G_TYPE_FROM_CLASS(webViewClass),
2397             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2398             G_STRUCT_OFFSET(WebKitWebViewClass, redo),
2399             NULL, NULL,
2400             g_cclosure_marshal_VOID__VOID,
2401             G_TYPE_NONE, 0);
2402
2403     /**
2404      * WebKitWebView::move-cursor:
2405      * @web_view: the object which received the signal
2406      * @step: the type of movement, one of #GtkMovementStep
2407      * @count: an integer indicating the subtype of movement. Currently
2408      *         the permitted values are '1' = forward, '-1' = backwards.
2409      *
2410      * The #WebKitWebView::move-cursor will be emitted to apply the
2411      * cursor movement described by its parameters to the @view.
2412      *
2413      * Return value: %TRUE or %FALSE
2414      * 
2415      * Since: 1.1.4
2416      */
2417     webkit_web_view_signals[MOVE_CURSOR] = g_signal_new("move-cursor",
2418             G_TYPE_FROM_CLASS(webViewClass),
2419             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2420             G_STRUCT_OFFSET(WebKitWebViewClass, move_cursor),
2421             NULL, NULL,
2422             webkit_marshal_BOOLEAN__ENUM_INT,
2423             G_TYPE_BOOLEAN, 2,
2424             GTK_TYPE_MOVEMENT_STEP,
2425             G_TYPE_INT);
2426
2427     /**
2428      * WebKitWebView::create-plugin-widget:
2429      * @web_view: the object which received the signal
2430      * @mime_type: the mimetype of the requested object
2431      * @uri: the URI to load
2432      * @param: a #GHashTable with additional attributes (strings)
2433      *
2434      * The #WebKitWebView::create-plugin-widget signal will be emitted to
2435      * create a plugin widget for embed or object HTML tags. This
2436      * allows to embed a GtkWidget as a plugin into HTML content. In
2437      * case of a textual selection of the GtkWidget WebCore will attempt
2438      * to set the property value of "webkit-widget-is-selected". This can
2439      * be used to draw a visual indicator of the selection.
2440      *
2441      * Return value: (transfer full): a new #GtkWidget, or %NULL
2442      *
2443      * Since: 1.1.8
2444      */
2445     webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("create-plugin-widget",
2446             G_TYPE_FROM_CLASS(webViewClass),
2447             (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2448             0,
2449             webkit_signal_accumulator_object_handled,
2450             NULL,
2451             webkit_marshal_OBJECT__STRING_STRING_POINTER,
2452             GTK_TYPE_WIDGET, 3,
2453             G_TYPE_STRING, G_TYPE_STRING, G_TYPE_HASH_TABLE);
2454
2455     /**
2456      * WebKitWebView::database-quota-exceeded
2457      * @web_view: the object which received the signal
2458      * @frame: the relevant frame
2459      * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin
2460      *
2461      * The #WebKitWebView::database-quota-exceeded signal will be emitted when
2462      * a Web Database exceeds the quota of its security origin. This signal
2463      * may be used to increase the size of the quota before the originating
2464      * operation fails.
2465      *
2466      * Since: 1.1.14
2467      */
2468     webkit_web_view_signals[DATABASE_QUOTA_EXCEEDED] = g_signal_new("database-quota-exceeded",
2469             G_TYPE_FROM_CLASS(webViewClass),
2470             (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2471             0,
2472             NULL, NULL,
2473             webkit_marshal_VOID__OBJECT_OBJECT,
2474             G_TYPE_NONE, 2,
2475             G_TYPE_OBJECT, G_TYPE_OBJECT);
2476
2477     /**
2478      * WebKitWebView::resource-request-starting:
2479      * @web_view: the object which received the signal
2480      * @web_frame: the #WebKitWebFrame whose load dispatched this request
2481      * @web_resource: an empty #WebKitWebResource object
2482      * @request: the #WebKitNetworkRequest that will be dispatched
2483      * @response: the #WebKitNetworkResponse representing the redirect
2484      * response, if any
2485      *
2486      * Emitted when a request is about to be sent. You can modify the
2487      * request while handling this signal. You can set the URI in the
2488      * #WebKitNetworkRequest object itself, and add/remove/replace
2489      * headers using the #SoupMessage object it carries, if it is
2490      * present. See webkit_network_request_get_message(). Setting the
2491      * request URI to "about:blank" will effectively cause the request
2492      * to load nothing, and can be used to disable the loading of
2493      * specific resources.
2494      *
2495      * Notice that information about an eventual redirect is available
2496      * in @response's #SoupMessage, not in the #SoupMessage carried by
2497      * the @request. If @response is %NULL, then this is not a
2498      * redirected request.
2499      *
2500      * The #WebKitWebResource object will be the same throughout all
2501      * the lifetime of the resource, but the contents may change from
2502      * inbetween signal emissions.
2503      *
2504      * Since: 1.1.14
2505      */
2506     webkit_web_view_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting",
2507             G_TYPE_FROM_CLASS(webViewClass),
2508             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2509             0,
2510             NULL, NULL,
2511             webkit_marshal_VOID__OBJECT_OBJECT_OBJECT_OBJECT,
2512             G_TYPE_NONE, 4,
2513             WEBKIT_TYPE_WEB_FRAME,
2514             WEBKIT_TYPE_WEB_RESOURCE,
2515             WEBKIT_TYPE_NETWORK_REQUEST,
2516             WEBKIT_TYPE_NETWORK_RESPONSE);
2517
2518     /**
2519      * WebKitWebView::geolocation-policy-decision-requested:
2520      * @web_view: the object on which the signal is emitted
2521      * @frame: the frame that requests permission
2522      * @policy_decision: a WebKitGeolocationPolicyDecision
2523      *
2524      * This signal is emitted when a @frame wants to obtain the user's
2525      * location. The decision can be made asynchronously, but you must
2526      * call g_object_ref() the @policy_decision, and return %TRUE if
2527      * you are going to handle the request. To actually make the
2528      * decision you need to call webkit_geolocation_policy_allow() or
2529      * webkit_geolocation_policy_deny() on @policy_decision.
2530      *
2531      * Since: 1.1.23
2532      */
2533     webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-requested",
2534             G_TYPE_FROM_CLASS(webViewClass),
2535             (GSignalFlags)(G_SIGNAL_RUN_LAST),
2536             0,
2537             NULL, NULL,
2538             webkit_marshal_BOOLEAN__OBJECT_OBJECT,
2539             G_TYPE_BOOLEAN, 2,
2540             WEBKIT_TYPE_WEB_FRAME,
2541             WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION);
2542
2543     /**
2544      * WebKitWebView::geolocation-policy-decision-cancelled:
2545      * @web_view: the object on which the signal is emitted
2546      * @frame: the frame that cancels geolocation request.
2547      *
2548      * When a @frame wants to cancel geolocation permission it had requested
2549      * before.
2550      *
2551      * Since: 1.1.23
2552      */
2553     webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_CANCELLED] = g_signal_new("geolocation-policy-decision-cancelled",
2554             G_TYPE_FROM_CLASS(webViewClass),
2555             (GSignalFlags)(G_SIGNAL_RUN_LAST),
2556             0,
2557             NULL, NULL,
2558             g_cclosure_marshal_VOID__OBJECT,
2559             G_TYPE_NONE, 1,
2560             WEBKIT_TYPE_WEB_FRAME);
2561
2562     /*
2563      * DOM-related signals. These signals are experimental, for now,
2564      * and may change API and ABI. Their comments lack one * on
2565      * purpose, to make them not be catched by gtk-doc.
2566      */
2567
2568     /**
2569      * WebKitWebView::document-load-finished:
2570      * @web_view: the object which received the signal
2571      * @web_frame: the #WebKitWebFrame whose load dispatched this request
2572      *
2573      * Emitted when the DOM document object load is finished for the
2574      * given frame.
2575      */
2576     webkit_web_view_signals[DOCUMENT_LOAD_FINISHED] = g_signal_new("document-load-finished",
2577             G_TYPE_FROM_CLASS(webViewClass),
2578             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2579             0,
2580             NULL, NULL,
2581             g_cclosure_marshal_VOID__OBJECT,
2582             G_TYPE_NONE, 1,
2583             WEBKIT_TYPE_WEB_FRAME);
2584
2585     /**
2586      * WebKitWebView::frame-created:
2587      * @web_view: the object which received the signal
2588      * @web_frame: the #WebKitWebFrame which was just created.
2589      *
2590      * Emitted when a WebKitWebView has created a new frame. This signal will
2591      * be emitted for all sub-frames created during page load. It will not be
2592      * emitted for the main frame, which originates in the WebKitWebView constructor
2593      * and may be accessed at any time using webkit_web_view_get_main_frame.
2594      *
2595      * Since: 1.3.4
2596      */
2597     webkit_web_view_signals[FRAME_CREATED] = g_signal_new("frame-created",
2598             G_TYPE_FROM_CLASS(webViewClass),
2599             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2600             0,
2601             NULL, NULL,
2602             g_cclosure_marshal_VOID__OBJECT,
2603             G_TYPE_NONE, 1,
2604             WEBKIT_TYPE_WEB_FRAME);
2605
2606     webkit_web_view_signals[SHOULD_BEGIN_EDITING] = g_signal_new("should-begin-editing",
2607         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2608         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2609         webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2610
2611     webkit_web_view_signals[SHOULD_END_EDITING] = g_signal_new("should-end-editing", G_TYPE_FROM_CLASS(webViewClass),
2612         static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2613         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2614         webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2615
2616     webkit_web_view_signals[SHOULD_INSERT_NODE] = g_signal_new("should-insert-node", G_TYPE_FROM_CLASS(webViewClass), 
2617         static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2618         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2619         webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM, G_TYPE_BOOLEAN,
2620         3, WEBKIT_TYPE_DOM_NODE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2621
2622     webkit_web_view_signals[SHOULD_INSERT_TEXT] = g_signal_new("should-insert-text", G_TYPE_FROM_CLASS(webViewClass),
2623         static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2624         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2625         webkit_marshal_BOOLEAN__STRING_OBJECT_ENUM, G_TYPE_BOOLEAN,
2626         3, G_TYPE_STRING, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2627
2628     webkit_web_view_signals[SHOULD_DELETE_RANGE] = g_signal_new("should-delete-range", G_TYPE_FROM_CLASS(webViewClass),
2629         static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2630         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2631         webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2632
2633     webkit_web_view_signals[SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT] = g_signal_new("should-show-delete-interface-for-element",
2634         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2635         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2636         webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2637
2638     webkit_web_view_signals[SHOULD_CHANGE_SELECTED_RANGE] = g_signal_new("should-change-selected-range",
2639         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2640         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2641         webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM_BOOLEAN, G_TYPE_BOOLEAN,
2642          4, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_SELECTION_AFFINITY, G_TYPE_BOOLEAN);
2643
2644     webkit_web_view_signals[SHOULD_APPLY_STYLE] = g_signal_new("should-apply-style",
2645         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2646         G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2647         webkit_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN,
2648          2, WEBKIT_TYPE_DOM_CSS_STYLE_DECLARATION, WEBKIT_TYPE_DOM_RANGE);
2649
2650     webkit_web_view_signals[EDITING_BEGAN] = g_signal_new("editing-began",
2651         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2652         g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2653
2654     webkit_web_view_signals[USER_CHANGED_CONTENTS] = g_signal_new("user-changed-contents",
2655         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2656         g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2657
2658     webkit_web_view_signals[EDITING_ENDED] = g_signal_new("editing-ended",
2659         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2660         g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2661
2662     webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed",
2663         G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2664         g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2665
2666     /*
2667      * WebKitWebView::viewport-attributes-recompute-requested
2668      * @web_view: the object which received the signal
2669      * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2670      *
2671      * The #WebKitWebView::viewport-attributes-recompute-requested 
2672      * signal will be emitted when a page with a viewport meta tag
2673      * loads and when webkit_viewport_attributes_recompute is called.
2674      *
2675      * The #WebKitViewportAttributes will have device size, available size,
2676      * desktop width, and device DPI pre-filled by values that make sense 
2677      * for the current screen and widget, but you can override those values 
2678      * if you have special requirements (for instance, if you made your
2679      * widget bigger than the available visible area, you should override 
2680      * the available-width and available-height properties to the actual 
2681      * visible area).
2682      *
2683      * Since: 1.3.8
2684      */
2685     webkit_web_view_signals[VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED] = g_signal_new("viewport-attributes-recompute-requested",
2686             G_TYPE_FROM_CLASS(webViewClass),
2687             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2688             0,
2689             0, 0,
2690             g_cclosure_marshal_VOID__OBJECT,
2691             G_TYPE_NONE, 1,
2692             WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2693
2694     /*
2695      * WebKitWebView::viewport-attributes-changed
2696      * @web_view: the object which received the signal
2697      * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2698      *
2699      * The #WebKitWebView::viewport-attributes-changed signal will be emitted 
2700      * after the emission of #WebKitWebView::viewport-attributes-recompute-requested 
2701      * and the subsequent viewport attribute recomputation. At this point, 
2702      * if the #WebKitViewportAttributes are valid, the viewport attributes are available.
2703      * 
2704      * Since: 1.3.8
2705      */
2706     webkit_web_view_signals[VIEWPORT_ATTRIBUTES_CHANGED] = g_signal_new("viewport-attributes-changed",
2707             G_TYPE_FROM_CLASS(webViewClass),
2708             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2709             0,
2710             0, 0,
2711             g_cclosure_marshal_VOID__OBJECT,
2712             G_TYPE_NONE, 1,
2713             WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2714
2715     /**
2716      * WebKitWebView::entering-fullscreen:
2717      * @web_view: the #WebKitWebView on which the signal is emitted.
2718      * @element: the #WebKitDOMHTMLElement which has requested full screen display.
2719      *
2720      * Emitted when JavaScript code calls
2721      * <function>element.webkitRequestFullScreen</function>. If the
2722      * signal is not handled the WebView will proceed to full screen
2723      * its top level window. This signal can be used by client code to
2724      * request permission to the user prior doing the full screen
2725      * transition and eventually prepare the top-level window
2726      * (e.g. hide some widgets that would otherwise be part of the
2727      * full screen window).
2728      *
2729      * Returns: %TRUE to stop other handlers from being invoked for the event.
2730      *    %FALSE to continue emission of the event.
2731      *
2732      * Since: 1.9.0
2733      */
2734     webkit_web_view_signals[ENTERING_FULLSCREEN] =
2735             g_signal_new("entering-fullscreen",
2736                          G_TYPE_FROM_CLASS(webViewClass),
2737                          G_SIGNAL_RUN_LAST,
2738                          G_STRUCT_OFFSET(WebKitWebViewClass, entering_fullscreen),
2739                          g_signal_accumulator_true_handled, 0,
2740                          webkit_marshal_BOOLEAN__OBJECT,
2741                          G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2742
2743
2744     /**
2745      * WebKitWebView::leaving-fullscreen:
2746      * @web_view: the #WebKitWebView on which the signal is emitted.
2747      * @element: the #WebKitDOMHTMLElement which is currently displayed full screen.
2748      *
2749      * Emitted when the WebView is about to restore its top level
2750      * window out of its full screen state. This signal can be used by
2751      * client code to restore widgets hidden during the
2752      * entering-fullscreen stage for instance.
2753      *
2754      * Returns: %TRUE to stop other handlers from being invoked for the event.
2755      *    %FALSE to continue emission of the event.
2756      *
2757      * Since: 1.9.0
2758      */
2759     webkit_web_view_signals[LEAVING_FULLSCREEN] =
2760             g_signal_new("leaving-fullscreen",
2761                          G_TYPE_FROM_CLASS(webViewClass),
2762                          G_SIGNAL_RUN_LAST,
2763                          G_STRUCT_OFFSET(WebKitWebViewClass, leaving_fullscreen),
2764                          g_signal_accumulator_true_handled, 0,
2765                          webkit_marshal_BOOLEAN__OBJECT,
2766                          G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2767
2768     /**
2769      * WebKitWebView::resource-response-received:
2770      * @web_view: the object which received the signal
2771      * @web_frame: the #WebKitWebFrame the response was received for
2772      * @web_resource: the #WebKitWebResource being loaded
2773      * @response: the #WebKitNetworkResponse that was received
2774      *
2775      * Emitted when the first byte of data arrives
2776      *
2777      * Since: 1.7.5
2778      */
2779     webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received",
2780             G_TYPE_FROM_CLASS(webViewClass),
2781             G_SIGNAL_RUN_LAST,
2782             0,
2783             0, 0,
2784             webkit_marshal_VOID__OBJECT_OBJECT_OBJECT,
2785             G_TYPE_NONE, 3,
2786             WEBKIT_TYPE_WEB_FRAME,
2787             WEBKIT_TYPE_WEB_RESOURCE,
2788             WEBKIT_TYPE_NETWORK_RESPONSE);
2789
2790     /**
2791      * WebKitWebView::resource-load-finished:
2792      * @web_view: the object which received the signal
2793      * @web_frame: the #WebKitWebFrame the response was received for
2794      * @web_resource: the #WebKitWebResource that was loaded
2795      *
2796      * Emitted when all the data for the resource was loaded
2797      *
2798      * Since: 1.7.5
2799      */
2800     webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished",
2801             G_TYPE_FROM_CLASS(webViewClass),
2802             G_SIGNAL_RUN_LAST,
2803             0,
2804             0, 0,
2805             webkit_marshal_VOID__OBJECT_OBJECT,
2806             G_TYPE_NONE, 2,
2807             WEBKIT_TYPE_WEB_FRAME,
2808             WEBKIT_TYPE_WEB_RESOURCE);
2809
2810     /**
2811      * WebKitWebView::resource-content-length-received:
2812      * @web_view: the object which received the signal
2813      * @web_frame: the #WebKitWebFrame the response was received for
2814      * @web_resource: the #WebKitWebResource that was loaded
2815      * @length_received: the amount of data received since the last signal emission
2816      *
2817      * Emitted when new resource data has been received. The
2818      * @length_received variable stores the amount of bytes received
2819      * since the last time this signal was emitted. This is useful to
2820      * provide progress information about the resource load operation.
2821      *
2822      * Since: 1.7.5
2823      */
2824     webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received",
2825             G_TYPE_FROM_CLASS(webViewClass),
2826             G_SIGNAL_RUN_LAST,
2827             0,
2828             0, 0,
2829             webkit_marshal_VOID__OBJECT_OBJECT_INT,
2830             G_TYPE_NONE, 3,
2831             WEBKIT_TYPE_WEB_FRAME,
2832             WEBKIT_TYPE_WEB_RESOURCE,
2833             G_TYPE_INT);
2834
2835     /**
2836      * WebKitWebView::resource-load-failed:
2837      * @web_view: the object which received the signal
2838      * @web_frame: the #WebKitWebFrame the response was received for
2839      * @web_resource: the #WebKitWebResource that was loaded
2840      * @error: the #GError that was triggered
2841      *
2842      * Invoked when a resource failed to load
2843      *
2844      * Since: 1.7.5
2845      */
2846     webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed",
2847             G_TYPE_FROM_CLASS(webViewClass),
2848             G_SIGNAL_RUN_LAST,
2849             0,
2850             0, 0,
2851             webkit_marshal_VOID__OBJECT_OBJECT_BOXED,
2852             G_TYPE_NONE, 3,
2853             WEBKIT_TYPE_WEB_FRAME,
2854             WEBKIT_TYPE_WEB_RESOURCE,
2855             G_TYPE_ERROR);
2856
2857     /**
2858      * WebKitWebView::context-menu:
2859      * @web_view: the object which received the signal
2860      * @default_menu: the default context menu
2861      * @hit_test_result: a #WebKitHitTestResult with the context of the current position.
2862      * @triggered_with_keyboard: %TRUE if the context menu was triggered using the keyboard
2863      *
2864      * Emmited when a context menu is about to be displayed to give the application
2865      * a chance to create and handle its own context menu. If you only want to add custom
2866      * options to the default context menu you can simply modify the given @default_menu.
2867      *
2868      * When @triggered_with_keyboard is %TRUE the coordinates of the given @hit_test_result should be
2869      * used to position the popup menu. When the context menu has been triggered by a
2870      * mouse event you could either use the @hit_test_result coordinates or pass %NULL
2871      * to the #GtkMenuPositionFunc parameter of gtk_menu_popup() function.
2872      * Note that coordinates of @hit_test_result are relative to @web_view window.
2873      *
2874      * If your application will create and display its own popup menu, %TRUE should be returned.
2875      * Note that when the context menu is handled by the application, the #WebKitWebSettings:enable-default-context-menu
2876      * setting will be ignored and the #WebKitWebView::populate-popup signal won't be emitted.
2877      * If you don't want any context menu to be shown, you can simply connect to this signal
2878      * and return %TRUE without doing anything else.
2879      *
2880      * Since: 1.10
2881      */
2882     webkit_web_view_signals[CONTEXT_MENU] = g_signal_new("context-menu",
2883             G_TYPE_FROM_CLASS(webViewClass),
2884             G_SIGNAL_RUN_LAST,
2885             0, 0, 0,
2886             webkit_marshal_BOOLEAN__OBJECT_OBJECT_BOOLEAN,
2887             G_TYPE_BOOLEAN, 3,
2888             GTK_TYPE_WIDGET,
2889             WEBKIT_TYPE_HIT_TEST_RESULT,
2890             G_TYPE_BOOLEAN);
2891
2892     /*
2893      * implementations of virtual methods
2894      */
2895     webViewClass->create_web_view = webkit_web_view_real_create_web_view;
2896     webViewClass->web_view_ready = webkit_web_view_real_web_view_ready;
2897     webViewClass->close_web_view = webkit_web_view_real_close_web_view;
2898     webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
2899     webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
2900     webViewClass->choose_file = webkit_web_view_real_choose_file;
2901     webViewClass->script_alert = webkit_web_view_real_script_alert;
2902     webViewClass->script_confirm = webkit_web_view_real_script_confirm;
2903     webViewClass->script_prompt = webkit_web_view_real_script_prompt;
2904     webViewClass->console_message = webkit_web_view_real_console_message;
2905     webViewClass->select_all = webkit_web_view_real_select_all;
2906     webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard;
2907     webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard;
2908     webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
2909     webViewClass->undo = webkit_web_view_real_undo;
2910     webViewClass->redo = webkit_web_view_real_redo;
2911     webViewClass->move_cursor = webkit_web_view_real_move_cursor;
2912     webViewClass->should_allow_editing_action = webkit_web_view_real_should_allow_editing_action;
2913     webViewClass->entering_fullscreen = webkit_web_view_real_entering_fullscreen;
2914     webViewClass->leaving_fullscreen = webkit_web_view_real_leaving_fullscreen;
2915
2916     GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
2917     objectClass->dispose = webkit_web_view_dispose;
2918     objectClass->finalize = webkit_web_view_finalize;
2919     objectClass->get_property = webkit_web_view_get_property;
2920     objectClass->set_property = webkit_web_view_set_property;
2921
2922     GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass);
2923     widgetClass->realize = webkit_web_view_realize;
2924 #ifdef GTK_API_VERSION_2
2925     widgetClass->expose_event = webkit_web_view_expose_event;
2926 #else
2927     widgetClass->draw = webkit_web_view_draw;
2928 #endif
2929     widgetClass->key_press_event = webkit_web_view_key_press_event;
2930     widgetClass->key_release_event = webkit_web_view_key_release_event;
2931     widgetClass->button_press_event = webkit_web_view_button_press_event;
2932     widgetClass->button_release_event = webkit_web_view_button_release_event;
2933     widgetClass->motion_notify_event = webkit_web_view_motion_event;
2934     widgetClass->scroll_event = webkit_web_view_scroll_event;
2935     widgetClass->size_allocate = webkit_web_view_size_allocate;
2936 #ifdef GTK_API_VERSION_2
2937     widgetClass->size_request = webkit_web_view_size_request;
2938 #else
2939     widgetClass->get_preferred_width = webkit_web_view_get_preferred_width;
2940     widgetClass->get_preferred_height = webkit_web_view_get_preferred_height;
2941 #endif
2942 #if ENABLE(CONTEXT_MENUS)
2943     widgetClass->popup_menu = webkit_web_view_popup_menu_handler;
2944 #else
2945     widgetClass->popup_menu = NULL;
2946 #endif
2947     widgetClass->grab_focus = webkit_web_view_grab_focus;
2948     widgetClass->focus_in_event = webkit_web_view_focus_in_event;
2949     widgetClass->focus_out_event = webkit_web_view_focus_out_event;
2950     widgetClass->get_accessible = webkit_web_view_get_accessible;
2951     widgetClass->screen_changed = webkit_web_view_screen_changed;
2952     widgetClass->drag_end = webkit_web_view_drag_end;
2953     widgetClass->drag_data_get = webkit_web_view_drag_data_get;
2954     widgetClass->drag_motion = webkit_web_view_drag_motion;
2955     widgetClass->drag_leave = webkit_web_view_drag_leave;
2956     widgetClass->drag_drop = webkit_web_view_drag_drop;
2957     widgetClass->drag_data_received = webkit_web_view_drag_data_received;
2958 #if GTK_CHECK_VERSION(2, 12, 0)
2959     widgetClass->query_tooltip = webkit_web_view_query_tooltip;
2960     widgetClass->show_help = webkit_web_view_show_help;
2961 #endif
2962     widgetClass->map = webkitWebViewMap;
2963
2964     GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass);
2965     containerClass->add = webkit_web_view_container_add;
2966     containerClass->remove = webkit_web_view_container_remove;
2967     containerClass->forall = webkit_web_view_container_forall;
2968
2969     /*
2970      * make us scrollable (e.g. addable to a GtkScrolledWindow)
2971      */
2972 #ifdef GTK_API_VERSION_2
2973     webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
2974     GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
2975             G_TYPE_FROM_CLASS(webViewClass),
2976             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2977             G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments),
2978             NULL, NULL,
2979             webkit_marshal_VOID__OBJECT_OBJECT,
2980             G_TYPE_NONE, 2,
2981             GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
2982 #else
2983     g_object_class_override_property(objectClass, PROP_HADJUSTMENT, "hadjustment");
2984     g_object_class_override_property(objectClass, PROP_VADJUSTMENT, "vadjustment");
2985     g_object_class_override_property(objectClass, PROP_HSCROLL_POLICY, "hscroll-policy");
2986     g_object_class_override_property(objectClass, PROP_VSCROLL_POLICY, "vscroll-policy");
2987 #endif
2988
2989     /*
2990      * Key bindings
2991      */
2992
2993     binding_set = gtk_binding_set_by_class(webViewClass);
2994
2995     gtk_binding_entry_add_signal(binding_set, GDK_a, GDK_CONTROL_MASK,
2996                                  "select_all", 0);
2997
2998     /* Cut/copy/paste */
2999
3000     gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK,
3001                                  "cut_clipboard", 0);
3002     gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK,
3003                                  "copy_clipboard", 0);
3004     gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK,
3005                                  "paste_clipboard", 0);
3006     gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK,
3007                                  "undo", 0);
3008     gtk_binding_entry_add_signal(binding_set, GDK_z, static_cast<GdkModifierType>(GDK_CONTROL_MASK | GDK_SHIFT_MASK),
3009                                  "redo", 0);
3010
3011     gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK,
3012                                  "cut_clipboard", 0);
3013     gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK,
3014                                  "copy_clipboard", 0);
3015     gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK,
3016                                  "paste_clipboard", 0);
3017
3018     /* Movement */
3019     
3020     gtk_binding_entry_add_signal(binding_set, GDK_Down, static_cast<GdkModifierType>(0),
3021                                  "move-cursor", 2,
3022                                  G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
3023                                  G_TYPE_INT, 1);
3024     gtk_binding_entry_add_signal(binding_set, GDK_Up, static_cast<GdkModifierType>(0),
3025                                  "move-cursor", 2,
3026                                  G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
3027                                  G_TYPE_INT, -1);
3028     gtk_binding_entry_add_signal(binding_set, GDK_Right, static_cast<GdkModifierType>(0),
3029                                  "move-cursor", 2,
3030                                  G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
3031                                  G_TYPE_INT, 1);
3032     gtk_binding_entry_add_signal(binding_set, GDK_Left, static_cast<GdkModifierType>(0),
3033                                  "move-cursor", 2,
3034                                  G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
3035                                  G_TYPE_INT, -1);
3036     gtk_binding_entry_add_signal(binding_set, GDK_space, static_cast<GdkModifierType>(0),
3037                                  "move-cursor", 2,
3038                                  G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3039                                  G_TYPE_INT, 1);
3040     gtk_binding_entry_add_signal(binding_set, GDK_space, GDK_SHIFT_MASK,
3041                                  "move-cursor", 2,
3042                                  G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3043                                  G_TYPE_INT, -1);
3044     gtk_binding_entry_add_signal(binding_set, GDK_Page_Down, static_cast<GdkModifierType>(0),
3045                                  "move-cursor", 2,
3046                                  G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3047                                  G_TYPE_INT, 1);
3048     gtk_binding_entry_add_signal(binding_set, GDK_Page_Up, static_cast<GdkModifierType>(0),
3049                                  "move-cursor", 2,
3050                                  G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3051                                  G_TYPE_INT, -1);
3052     gtk_binding_entry_add_signal(binding_set, GDK_End, static_cast<GdkModifierType>(0),
3053                                  "move-cursor", 2,
3054                                  G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
3055                                  G_TYPE_INT, 1);
3056     gtk_binding_entry_add_signal(binding_set, GDK_Home, static_cast<GdkModifierType>(0),
3057                                  "move-cursor", 2,
3058                                  G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
3059                                  G_TYPE_INT, -1);
3060
3061     /*
3062      * properties
3063      */
3064
3065     /**
3066     * WebKitWebView:title:
3067     *
3068     * Returns: the @web_view's document title.
3069     *
3070     * Since: 1.1.4
3071     */
3072     g_object_class_install_property(objectClass, PROP_TITLE,
3073                                     g_param_spec_string("title",
3074                                                         _("Title"),
3075                                                         _("Returns the @web_view's document title"),
3076                                                         NULL,
3077                                                         WEBKIT_PARAM_READABLE));
3078
3079     /**
3080     * WebKitWebView:uri:
3081     *
3082     * Returns: the current URI of the contents displayed by the @web_view.
3083     *
3084     * Since: 1.1.4
3085     */
3086     g_object_class_install_property(objectClass, PROP_URI,
3087                                     g_param_spec_string("uri",
3088                                                         _("URI"),
3089                                                         _("Returns the current URI of the contents displayed by the @web_view"),
3090                                                         NULL,
3091                                                         WEBKIT_PARAM_READABLE));
3092
3093     /**
3094     * WebKitWebView:copy-target-list:
3095     *
3096     * The list of targets this web view supports for clipboard copying.
3097     *
3098     * Since: 1.0.2
3099     */
3100     g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST,
3101                                     g_param_spec_boxed("copy-target-list",
3102                                                        _("Copy target list"),
3103                                                        _("The list of targets this web view supports for clipboard copying"),
3104                                                        GTK_TYPE_TARGET_LIST,
3105                                                        WEBKIT_PARAM_READABLE));
3106
3107     /**
3108     * WebKitWebView:paste-target-list:
3109     *
3110     * The list of targets this web view supports for clipboard pasting.
3111     *
3112     * Since: 1.0.2
3113     */
3114     g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST,
3115                                     g_param_spec_boxed("paste-target-list",
3116                                                        _("Paste target list"),
3117                                                        _("The list of targets this web view supports for clipboard pasting"),
3118                                                        GTK_TYPE_TARGET_LIST,
3119                                                        WEBKIT_PARAM_READABLE));
3120
3121     g_object_class_install_property(objectClass, PROP_SETTINGS,
3122                                     g_param_spec_object("settings",
3123                                                         _("Settings"),
3124                                                         _("An associated WebKitWebSettings instance"),
3125                                                         WEBKIT_TYPE_WEB_SETTINGS,
3126                                                         WEBKIT_PARAM_READWRITE));
3127
3128     /**
3129     * WebKitWebView:web-inspector:
3130     *
3131     * The associated WebKitWebInspector instance.
3132     *
3133     * Since: 1.0.3
3134     */
3135     g_object_class_install_property(objectClass, PROP_WEB_INSPECTOR,
3136                                     g_param_spec_object("web-inspector",
3137                                                         _("Web Inspector"),
3138                                                         _("The associated WebKitWebInspector instance"),
3139                                                         WEBKIT_TYPE_WEB_INSPECTOR,
3140                                                         WEBKIT_PARAM_READABLE));
3141
3142     /**
3143     * WebKitWebView:viewport-attributes:
3144     *
3145     * The associated #WebKitViewportAttributes instance.
3146     *
3147     * Since: 1.3.8
3148     */
3149     g_object_class_install_property(objectClass, PROP_VIEWPORT_ATTRIBUTES,
3150                                     g_param_spec_object("viewport-attributes",
3151                                                         _("Viewport Attributes"),
3152                                                         _("The associated WebKitViewportAttributes instance"),
3153                                                         WEBKIT_TYPE_VIEWPORT_ATTRIBUTES,
3154                                                         WEBKIT_PARAM_READABLE));
3155
3156     /**
3157     * WebKitWebView:window-features:
3158     *
3159     * An associated WebKitWebWindowFeatures instance.
3160     *
3161     * Since: 1.0.3
3162     */
3163     g_object_class_install_property(objectClass, PROP_WINDOW_FEATURES,
3164                                     g_param_spec_object("window-features",
3165                                                         "Window Features",
3166                                                         "An associated WebKitWebWindowFeatures instance",
3167                                                         WEBKIT_TYPE_WEB_WINDOW_FEATURES,
3168                                                         WEBKIT_PARAM_READWRITE));
3169
3170     g_object_class_install_property(objectClass, PROP_EDITABLE,
3171                                     g_param_spec_boolean("editable",
3172                                                          _("Editable"),
3173                                                          _("Whether content can be modified by the user"),
3174                                                          FALSE,
3175                                                          WEBKIT_PARAM_READWRITE));
3176
3177     g_object_class_install_property(objectClass, PROP_TRANSPARENT,
3178                                     g_param_spec_boolean("transparent",
3179                                                          _("Transparent"),
3180                                                          _("Whether content has a transparent background"),
3181                                                          FALSE,
3182                                                          WEBKIT_PARAM_READWRITE));
3183
3184     /**
3185     * WebKitWebView:zoom-level:
3186     *
3187     * The level of zoom of the content.
3188     *
3189     * Since: 1.0.1
3190     */
3191     g_object_class_install_property(objectClass, PROP_ZOOM_LEVEL,
3192                                     g_param_spec_float("zoom-level",
3193                                                        _("Zoom level"),
3194                                                        _("The level of zoom of the content"),
3195                                                        G_MINFLOAT,
3196                                                        G_MAXFLOAT,
3197                                                        1.0f,
3198                                                        WEBKIT_PARAM_READWRITE));
3199
3200     /**
3201     * WebKitWebView:full-content-zoom:
3202     *
3203     * Whether the full content is scaled when zooming.
3204     *
3205     * Since: 1.0.1
3206     */
3207     g_object_class_install_property(objectClass, PROP_FULL_CONTENT_ZOOM,
3208                                     g_param_spec_boolean("full-content-zoom",
3209                                                          _("Full content zoom"),
3210                                                          _("Whether the full content is scaled when zooming"),
3211                                                          FALSE,
3212                                                          WEBKIT_PARAM_READWRITE));
3213
3214     /**
3215      * WebKitWebView:encoding:
3216      *
3217      * The default encoding of the web view.
3218      *
3219      * Since: 1.1.2
3220      */
3221     g_object_class_install_property(objectClass, PROP_ENCODING,
3222                                     g_param_spec_string("encoding",
3223                                                         _("Encoding"),
3224                                                         _("The default encoding of the web view"),
3225                                                         NULL,
3226                                                         WEBKIT_PARAM_READABLE));
3227
3228     /**
3229      * WebKitWebView:custom-encoding:
3230      *
3231      * The custom encoding of the web view.
3232      *
3233      * Since: 1.1.2
3234      */
3235     g_object_class_install_property(objectClass, PROP_CUSTOM_ENCODING,
3236                                     g_param_spec_string("custom-encoding",
3237                                                         _("Custom Encoding"),
3238                                                         _("The custom encoding of the web view"),
3239                                                         NULL,
3240                                                         WEBKIT_PARAM_READWRITE));
3241
3242     /**
3243     * WebKitWebView:load-status:
3244     *
3245     * Determines the current status of the load.
3246     *
3247     * Connect to "notify::load-status" to monitor loading.
3248     *
3249     * Some versions of WebKitGTK+ emitted this signal for the default
3250     * error page, while loading it. This behavior was considered bad,
3251     * because it was essentially exposing an implementation
3252     * detail. From 1.1.19 onwards this signal is no longer emitted for
3253     * the default error pages, but keep in mind that if you override
3254     * the error pages by using webkit_web_frame_load_alternate_string()
3255     * the signals will be emitted.
3256     *
3257     * Since: 1.1.7
3258     */
3259     g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
3260                                     g_param_spec_enum("load-status",
3261                                                       "Load Status",
3262                                                       "Determines the current status of the load",
3263                                                       WEBKIT_TYPE_LOAD_STATUS,
3264                                                       WEBKIT_LOAD_FINISHED,
3265                                                       WEBKIT_PARAM_READABLE));
3266
3267     /**
3268     * WebKitWebView:progress:
3269     *
3270     * Determines the current progress of the load.
3271     *
3272     * Since: 1.1.7
3273     */
3274     g_object_class_install_property(objectClass, PROP_PROGRESS,
3275                                     g_param_spec_double("progress",
3276                                                         "Progress",
3277                                                         "Determines the current progress of the load",
3278                                                         0.0, 1.0, 1.0,
3279                                                         WEBKIT_PARAM_READABLE));
3280
3281     /**
3282      * WebKitWebView:icon-uri:
3283      *
3284      * The URI for the favicon for the #WebKitWebView.
3285      *
3286      * Since: 1.1.18
3287      */
3288     g_object_class_install_property(objectClass, PROP_ICON_URI,
3289                                     g_param_spec_string("icon-uri",
3290                                                         _("Icon URI"),
3291                                                         _("The URI for the favicon for the #WebKitWebView."),
3292