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