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