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