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.
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.
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.
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
32 #include "webkitwebview.h"
34 #include "AXObjectCache.h"
35 #include "AbstractDatabase.h"
36 #include "BackForwardListImpl.h"
37 #include "CairoUtilities.h"
39 #include "ChromeClientGtk.h"
40 #include "ClipboardUtilitiesGtk.h"
41 #include "ContextMenu.h"
42 #include "ContextMenuClientGtk.h"
43 #include "ContextMenuController.h"
46 #include "DocumentLoader.h"
47 #include "DragActions.h"
48 #include "DragClientGtk.h"
49 #include "DragController.h"
51 #include "DragSession.h"
52 #include "DumpRenderTreeSupportGtk.h"
54 #include "EditorClientGtk.h"
55 #include "EventHandler.h"
56 #include "FloatQuad.h"
57 #include "FocusController.h"
58 #include "FrameLoader.h"
59 #include "FrameLoaderClient.h"
60 #include "FrameLoaderTypes.h"
61 #include "FrameView.h"
62 #include "GOwnPtrGtk.h"
63 #include "GeolocationClientGtk.h"
64 #include "GeolocationClientMock.h"
65 #include "GeolocationController.h"
66 #include "GraphicsContext.h"
67 #include "GtkUtilities.h"
68 #include "GtkVersioning.h"
69 #include "HTMLNames.h"
70 #include "HitTestRequest.h"
71 #include "HitTestResult.h"
72 #include "InspectorClientGtk.h"
73 #include "MemoryCache.h"
74 #include "MouseEventWithHitTestResults.h"
75 #include "NotImplemented.h"
76 #include "PageCache.h"
77 #include "Pasteboard.h"
78 #include "PasteboardHelper.h"
79 #include "PlatformKeyboardEvent.h"
80 #include "PlatformWheelEvent.h"
81 #include "ProgressTracker.h"
82 #include "RenderView.h"
83 #include "ResourceHandle.h"
84 #include "ScriptValue.h"
86 #include "webkit/WebKitDOMDocumentPrivate.h"
87 #include "webkitdownload.h"
88 #include "webkitdownloadprivate.h"
89 #include "webkitenumtypes.h"
90 #include "webkitfavicondatabase.h"
91 #include "webkitgeolocationpolicydecision.h"
92 #include "webkitglobalsprivate.h"
93 #include "webkithittestresultprivate.h"
94 #include "webkiticondatabase.h"
95 #include "webkitmarshal.h"
96 #include "webkitnetworkrequest.h"
97 #include "webkitnetworkresponse.h"
98 #include "webkitviewportattributes.h"
99 #include "webkitviewportattributesprivate.h"
100 #include "webkitwebbackforwardlist.h"
101 #include "webkitwebframeprivate.h"
102 #include "webkitwebhistoryitem.h"
103 #include "webkitwebhistoryitemprivate.h"
104 #include "webkitwebinspector.h"
105 #include "webkitwebinspectorprivate.h"
106 #include "webkitwebpolicydecision.h"
107 #include "webkitwebresource.h"
108 #include "webkitwebsettingsprivate.h"
109 #include "webkitwebplugindatabaseprivate.h"
110 #include "webkitwebwindowfeatures.h"
111 #include "webkitwebviewprivate.h"
112 #include <gdk/gdkkeysyms.h>
113 #include <glib/gi18n-lib.h>
114 #include <wtf/gobject/GOwnPtr.h>
115 #include <wtf/text/CString.h>
117 #if ENABLE(DEVICE_ORIENTATION)
118 #include "DeviceMotionClientGtk.h"
119 #include "DeviceOrientationClientGtk.h"
122 #if ENABLE(MEDIA_STREAM)
123 #include "UserMediaClientGtk.h"
127 * SECTION:webkitwebview
128 * @short_description: The central class of the WebKitGTK+ API
129 * @see_also: #WebKitWebSettings, #WebKitWebFrame
131 * #WebKitWebView is the central class of the WebKitGTK+ API. It is a
132 * #GtkWidget implementing the scrolling interface which means you can
133 * embed in a #GtkScrolledWindow. It is responsible for managing the
134 * drawing of the content, forwarding of events. You can load any URI
135 * into the #WebKitWebView or any kind of data string. With #WebKitWebSettings
136 * you can control various aspects of the rendering and loading of the content.
137 * Each #WebKitWebView has exactly one #WebKitWebFrame as main frame. A
138 * #WebKitWebFrame can have n children.
141 * /<!-- -->* Create the widgets *<!-- -->/
142 * GtkWidget *main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
143 * GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
144 * GtkWidget *web_view = webkit_web_view_new ();
146 * /<!-- -->* Place the WebKitWebView in the GtkScrolledWindow *<!-- -->/
147 * gtk_container_add (GTK_CONTAINER (scrolled_window), web_view);
148 * gtk_container_add (GTK_CONTAINER (main_window), scrolled_window);
150 * /<!-- -->* Open a webpage *<!-- -->/
151 * webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org");
153 * /<!-- -->* Show the result *<!-- -->/
154 * gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600);
155 * gtk_widget_show_all (main_window);
159 using namespace WebKit;
160 using namespace WebCore;
164 NAVIGATION_REQUESTED,
165 NEW_WINDOW_POLICY_DECISION_REQUESTED,
166 NAVIGATION_POLICY_DECISION_REQUESTED,
167 MIME_TYPE_POLICY_DECISION_REQUESTED,
170 WINDOW_OBJECT_CLEARED,
173 LOAD_PROGRESS_CHANGED,
179 STATUS_BAR_TEXT_CHANGED,
197 DATABASE_QUOTA_EXCEEDED,
198 RESOURCE_REQUEST_STARTING,
199 DOCUMENT_LOAD_FINISHED,
200 GEOLOCATION_POLICY_DECISION_REQUESTED,
201 GEOLOCATION_POLICY_DECISION_CANCELLED,
204 SHOULD_BEGIN_EDITING,
209 SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT,
210 SHOULD_CHANGE_SELECTED_RANGE,
213 USER_CHANGED_CONTENTS,
215 VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED,
216 VIEWPORT_ATTRIBUTES_CHANGED,
217 RESOURCE_RESPONSE_RECEIVED,
218 RESOURCE_LOAD_FINISHED,
219 RESOURCE_CONTENT_LENGTH_RECEIVED,
220 RESOURCE_LOAD_FAILED,
233 PROP_COPY_TARGET_LIST,
234 PROP_PASTE_TARGET_LIST,
238 PROP_VIEWPORT_ATTRIBUTES,
239 PROP_WINDOW_FEATURES,
242 PROP_FULL_CONTENT_ZOOM,
246 PROP_CUSTOM_ENCODING,
249 #ifdef GTK_API_VERSION_2
259 // Undocumented. Leave these properties at the end of the list
260 // so that we can remove them without breaking ABI compatibility.
264 static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
266 #ifdef GTK_API_VERSION_2
267 G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
269 G_DEFINE_TYPE_WITH_CODE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER,
270 G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, 0))
273 static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
274 static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
276 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*);
278 #if ENABLE(CONTEXT_MENUS)
279 static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
281 WebKitWebView* view = WEBKIT_WEB_VIEW(userData);
282 WebKitWebViewPrivate* priv = view->priv;
283 GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view));
284 GtkRequisition menuSize;
286 #ifdef GTK_API_VERSION_2
287 gtk_widget_size_request(GTK_WIDGET(menu), &menuSize);
289 gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, NULL);
292 *x = priv->lastPopupXPosition;
293 if ((*x + menuSize.width) >= gdk_screen_get_width(screen))
294 *x -= menuSize.width;
296 *y = priv->lastPopupYPosition;
297 if ((*y + menuSize.height) >= gdk_screen_get_height(screen))
298 *y -= menuSize.height;
304 static Node* getFocusedNode(Frame* frame)
306 if (Document* doc = frame->document())
307 return doc->focusedNode();
311 #if ENABLE(CONTEXT_MENUS)
312 static void contextMenuItemActivated(GtkMenuItem* item, ContextMenuController* controller)
314 ContextMenuItem contextItem(item);
315 controller->contextMenuItemSelected(&contextItem);
318 static void contextMenuConnectActivate(GtkMenuItem* item, ContextMenuController* controller)
320 if (GTK_IS_SEPARATOR_MENU_ITEM(item))
323 if (GtkWidget* menu = gtk_menu_item_get_submenu(item)) {
324 gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback)contextMenuConnectActivate, controller);
328 g_signal_connect(item, "activate", G_CALLBACK(contextMenuItemActivated), controller);
331 static MouseEventWithHitTestResults prepareMouseEventForFrame(Frame* frame, const PlatformMouseEvent& event)
333 HitTestRequest request(HitTestRequest::Active);
334 IntPoint point = frame->view()->windowToContents(event.position());
335 return frame->document()->prepareMouseEvent(request, point, event);
338 // Check enable-default-context-menu setting for compatibility.
339 static bool defaultContextMenuEnabled(WebKitWebView* webView)
341 gboolean enableDefaultContextMenu;
342 g_object_get(webkit_web_view_get_settings(webView), "enable-default-context-menu", &enableDefaultContextMenu, NULL);
343 return enableDefaultContextMenu;
346 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event, bool triggeredWithKeyboard)
348 Page* page = core(webView);
349 page->contextMenuController()->clearContextMenu();
351 Frame* mainFrame = page->mainFrame();
352 gboolean mousePressEventResult = FALSE;
353 GRefPtr<WebKitHitTestResult> hitTestResult;
355 if (!mainFrame->view())
358 mainFrame->view()->setCursor(pointerCursor());
359 if (page->frameCount()) {
360 MouseEventWithHitTestResults mev = prepareMouseEventForFrame(mainFrame, event);
361 Frame* targetFrame = EventHandler::subframeForHitTestResult(mev);
363 targetFrame = mainFrame;
365 focusedFrame = page->focusController()->focusedOrMainFrame();
366 if (targetFrame != focusedFrame) {
367 page->focusController()->setFocusedFrame(targetFrame);
368 focusedFrame = targetFrame;
370 if (focusedFrame == mainFrame)
371 hitTestResult = adoptGRef(kit(mev.hitTestResult()));
373 focusedFrame = mainFrame;
375 if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event))
376 mousePressEventResult = TRUE;
378 bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event);
382 // If coreMenu is NULL, this means WebCore decided to not create
383 // the default context menu; this may happen when the page is
384 // handling the right-click for reasons other than the context menu.
385 ContextMenuController* controller = page->contextMenuController();
386 ContextMenu* coreMenu = controller->contextMenu();
388 return mousePressEventResult;
390 GtkMenu* defaultMenu = coreMenu->platformDescription();
393 // We connect the "activate" signal here rather than in ContextMenuGtk to avoid
394 // a layering violation. ContextMenuGtk should not know about the ContextMenuController.
395 gtk_container_foreach(GTK_CONTAINER(defaultMenu), reinterpret_cast<GtkCallback>(contextMenuConnectActivate), controller);
397 if (!hitTestResult) {
398 MouseEventWithHitTestResults mev = prepareMouseEventForFrame(focusedFrame, event);
399 hitTestResult = adoptGRef(kit(mev.hitTestResult()));
403 g_signal_emit(webView, webkit_web_view_signals[CONTEXT_MENU], 0, defaultMenu, hitTestResult.get(), triggeredWithKeyboard, &handled);
407 // Return now if default context menu is disabled by enable-default-context-menu setting.
408 // Check enable-default-context-menu setting for compatibility.
409 if (!defaultContextMenuEnabled(webView))
412 // Emit populate-popup signal for compatibility.
413 g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, defaultMenu);
415 // If the context menu is now empty, don't show it.
416 GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(defaultMenu)));
420 WebKitWebViewPrivate* priv = webView->priv;
421 priv->currentMenu = defaultMenu;
422 priv->lastPopupXPosition = event.globalPosition().x();
423 priv->lastPopupYPosition = event.globalPosition().y();
425 gtk_menu_popup(defaultMenu, 0, 0, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time());
429 static const int gContextMenuMargin = 1;
430 static IntPoint getLocationForKeyboardGeneratedContextMenu(Frame* frame)
432 FrameSelection* selection = frame->selection();
433 if (!selection->selection().isNonOrphanedCaretOrRange()
434 || (selection->selection().isCaret() && !selection->selection().isContentEditable())) {
435 if (Node* focusedNode = getFocusedNode(frame))
436 return focusedNode->getRect().location();
438 // There was no selection and no focused node, so just put the context
439 // menu into the corner of the view, offset slightly.
440 return IntPoint(gContextMenuMargin, gContextMenuMargin);
443 // selection->selection().firstRange can return 0 here, but if that was the case
444 // selection->selection().isNonOrphanedCaretOrRange() would have returned false
445 // above, so we do not have to check it.
446 IntRect firstRect = frame->editor()->firstRectForRange(selection->selection().firstRange().get());
447 return IntPoint(firstRect.x(), firstRect.maxY());
450 static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
452 Frame* frame = core(WEBKIT_WEB_VIEW(widget))->focusController()->focusedOrMainFrame();
453 IntPoint location = getLocationForKeyboardGeneratedContextMenu(frame);
455 FrameView* view = frame->view();
459 // Never let the context menu touch the very edge of the view.
460 location = view->contentsToWindow(location);
461 location.expandedTo(IntPoint(gContextMenuMargin, gContextMenuMargin));
462 location.shrunkTo(IntPoint(view->width() - gContextMenuMargin, view->height() - gContextMenuMargin));
464 IntPoint globalPoint(convertWidgetPointToScreenPoint(widget, location));
465 PlatformMouseEvent event(location, globalPoint, RightButton, PlatformEvent::MousePressed, 0, false, false, false, false, gtk_get_current_event_time());
466 return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event, true);
468 #endif // ENABLE(CONTEXT_MENUS)
470 static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
472 // This may be called after the page has been destroyed, in which case we do nothing.
473 Page* page = core(webView);
475 static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setHorizontalAdjustment(adjustment);
478 static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
480 // This may be called after the page has been destroyed, in which case we do nothing.
481 Page* page = core(webView);
483 static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setVerticalAdjustment(adjustment);
486 #ifndef GTK_API_VERSION_2
487 static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
489 Page* page = core(webView);
491 return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->horizontalAdjustment();
495 static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView)
497 Page* page = core(webView);
499 return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->verticalAdjustment();
503 static void setHorizontalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
505 webView->priv->horizontalScrollingPolicy = policy;
506 gtk_widget_queue_resize(GTK_WIDGET(webView));
509 static void setVerticalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
511 webView->priv->verticalScrollingPolicy = policy;
512 gtk_widget_queue_resize(GTK_WIDGET(webView));
515 static GtkScrollablePolicy getHorizontalScrollPolicy(WebKitWebView* webView)
517 return webView->priv->horizontalScrollingPolicy;
520 static GtkScrollablePolicy getVerticalScrollPolicy(WebKitWebView* webView)
522 return webView->priv->verticalScrollingPolicy;
527 static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
529 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
533 g_value_set_string(value, webkit_web_view_get_title(webView));
536 g_value_set_string(value, webkit_web_view_get_uri(webView));
538 case PROP_COPY_TARGET_LIST:
539 g_value_set_boxed(value, webkit_web_view_get_copy_target_list(webView));
541 case PROP_PASTE_TARGET_LIST:
542 g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView));
545 g_value_set_boolean(value, webkit_web_view_get_editable(webView));
548 g_value_set_object(value, webkit_web_view_get_settings(webView));
550 case PROP_WEB_INSPECTOR:
551 g_value_set_object(value, webkit_web_view_get_inspector(webView));
553 case PROP_VIEWPORT_ATTRIBUTES:
554 g_value_set_object(value, webkit_web_view_get_viewport_attributes(webView));
556 case PROP_WINDOW_FEATURES:
557 g_value_set_object(value, webkit_web_view_get_window_features(webView));
559 case PROP_TRANSPARENT:
560 g_value_set_boolean(value, webkit_web_view_get_transparent(webView));
562 case PROP_ZOOM_LEVEL:
563 g_value_set_float(value, webkit_web_view_get_zoom_level(webView));
565 case PROP_FULL_CONTENT_ZOOM:
566 g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView));
569 g_value_set_string(value, webkit_web_view_get_encoding(webView));
571 case PROP_CUSTOM_ENCODING:
572 g_value_set_string(value, webkit_web_view_get_custom_encoding(webView));
574 case PROP_LOAD_STATUS:
575 g_value_set_enum(value, webkit_web_view_get_load_status(webView));
578 g_value_set_double(value, webkit_web_view_get_progress(webView));
581 g_value_set_string(value, webkit_web_view_get_icon_uri(webView));
583 case PROP_IM_CONTEXT:
584 g_value_set_object(value, webkit_web_view_get_im_context(webView));
587 g_value_set_enum(value, webkit_web_view_get_view_mode(webView));
589 #ifndef GTK_API_VERSION_2
590 case PROP_HADJUSTMENT:
591 g_value_set_object(value, getHorizontalAdjustment(webView));
593 case PROP_VADJUSTMENT:
594 g_value_set_object(value, getVerticalAdjustment(webView));
596 case PROP_HSCROLL_POLICY:
597 g_value_set_enum(value, getHorizontalScrollPolicy(webView));
599 case PROP_VSCROLL_POLICY:
600 g_value_set_enum(value, getVerticalScrollPolicy(webView));
603 case PROP_SELF_SCROLLING:
604 g_value_set_boolean(value, webView->priv->selfScrolling);
607 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
611 static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
613 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
617 webkit_web_view_set_editable(webView, g_value_get_boolean(value));
620 webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value)));
622 case PROP_WINDOW_FEATURES:
623 webkit_web_view_set_window_features(webView, WEBKIT_WEB_WINDOW_FEATURES(g_value_get_object(value)));
625 case PROP_TRANSPARENT:
626 webkit_web_view_set_transparent(webView, g_value_get_boolean(value));
628 case PROP_ZOOM_LEVEL:
629 webkit_web_view_set_zoom_level(webView, g_value_get_float(value));
631 case PROP_FULL_CONTENT_ZOOM:
632 webkit_web_view_set_full_content_zoom(webView, g_value_get_boolean(value));
634 case PROP_CUSTOM_ENCODING:
635 webkit_web_view_set_custom_encoding(webView, g_value_get_string(value));
638 webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value)));
640 #ifndef GTK_API_VERSION_2
641 case PROP_HADJUSTMENT:
642 setHorizontalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
644 case PROP_VADJUSTMENT:
645 setVerticalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
647 case PROP_HSCROLL_POLICY:
648 setHorizontalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
650 case PROP_VSCROLL_POLICY:
651 setVerticalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
654 case PROP_SELF_SCROLLING:
655 webView->priv->selfScrolling = g_value_get_boolean(value);
658 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
662 #ifdef GTK_API_VERSION_2
663 static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event)
666 GOwnPtr<GdkRectangle> rects;
667 gdk_region_get_rectangles(event->region, &rects.outPtr(), &rectCount);
669 RefPtr<cairo_t> cr = adoptRef(gdk_cairo_create(event->window));
670 for (int i = 0; i < rectCount; i++) {
671 copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(),
672 cr.get(), IntSize(), IntRect(rects.get()[i]));
675 // Chaining up to the parent forces child widgets to be drawn.
676 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->expose_event(widget, event);
680 static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
682 GdkRectangle clipRect;
683 if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
686 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
687 #if USE(TEXTURE_MAPPER_GL)
688 if (priv->acceleratedCompositingContext->renderLayersToWindow(clipRect))
692 cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr);
693 if (rectList->status || !rectList->num_rectangles) {
694 cairo_rectangle_list_destroy(rectList);
698 Vector<IntRect> rects;
699 for (int i = 0; i < rectList->num_rectangles; i++) {
700 copyRectFromCairoSurfaceToContext(priv->backingStore->cairoSurface(), cr, IntSize(),
701 enclosingIntRect(FloatRect(rectList->rectangles[i])));
703 cairo_rectangle_list_destroy(rectList);
705 // Chaining up to the parent forces child widgets to be drawn.
706 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
709 #endif // GTK_API_VERSION_2
711 static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
713 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
715 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
716 PlatformKeyboardEvent keyboardEvent(event);
721 if (frame->eventHandler()->keyEvent(keyboardEvent))
724 /* Chain up to our parent class for binding activation */
725 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event);
728 static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event)
730 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
732 // GTK+ IM contexts often require us to filter key release events, which
733 // WebCore does not do by default, so we filter the event here. We only block
734 // the event if we don't have a pending composition, because that means we
735 // are using a context like 'simple' which marks every keystroke as filtered.
736 WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
737 if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition())
740 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
744 PlatformKeyboardEvent keyboardEvent(event);
745 if (frame->eventHandler()->keyEvent(keyboardEvent))
748 /* Chain up to our parent class for binding activation */
749 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_release_event(widget, event);
752 static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
754 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
755 WebKitWebViewPrivate* priv = webView->priv;
757 // FIXME: need to keep track of subframe focus for key events
758 gtk_widget_grab_focus(widget);
760 if (!priv->clickCounter.shouldProcessButtonEvent(event))
763 PlatformMouseEvent platformEvent(event);
764 int count = priv->clickCounter.clickCountForGdkButtonEvent(widget, event);
765 platformEvent.setClickCount(count);
767 #if ENABLE(CONTEXT_MENUS)
768 if (event->button == 3)
769 return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event), false);
772 Frame* frame = core(webView)->mainFrame();
776 gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent);
777 // Handle the IM context when a mouse press fires
778 static_cast<WebKit::EditorClient*>(core(webView)->editorClient())->handleInputMethodMousePress();
781 /* Copy selection to the X11 selection clipboard */
782 if (event->button == 2) {
783 PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
784 bool wasUsingPrimary = helper->usePrimarySelectionClipboard();
785 helper->setUsePrimarySelectionClipboard(true);
787 Editor* editor = webView->priv->corePage->focusController()->focusedOrMainFrame()->editor();
788 result = result || editor->canPaste() || editor->canDHTMLPaste();
791 helper->setUsePrimarySelectionClipboard(wasUsingPrimary);
798 static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
800 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
802 Frame* focusedFrame = core(webView)->focusController()->focusedFrame();
804 if (focusedFrame && focusedFrame->editor()->canEdit()) {
806 WebKitWebViewPrivate* priv = webView->priv;
807 hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event);
811 Frame* mainFrame = core(webView)->mainFrame();
812 if (mainFrame->view())
813 mainFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
815 /* We always return FALSE here because WebKit can, for the same click, decide
816 * to not handle press-event but handle release-event, which can totally confuse
817 * some GTK+ containers when there are no other events in between. This way we
818 * guarantee that this case never happens, and that if press-event goes through
819 * release-event also goes through.
825 static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event)
827 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
829 Frame* frame = core(webView)->mainFrame();
833 return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
836 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
838 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
840 Frame* frame = core(webView)->mainFrame();
844 PlatformWheelEvent wheelEvent(event);
845 return frame->eventHandler()->handleWheelEvent(wheelEvent);
848 #ifdef GTK_API_VERSION_2
849 static void webkit_web_view_size_request(GtkWidget* widget, GtkRequisition* requisition)
851 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
852 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
856 FrameView* view = coreFrame->view();
860 requisition->width = view->contentsWidth();
861 requisition->height = view->contentsHeight();
864 static void webkit_web_view_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural)
866 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
867 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
871 FrameView* view = coreFrame->view();
875 *minimum = *natural = view->contentsWidth();
878 static void webkit_web_view_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural)
880 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
881 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
885 FrameView* view = coreFrame->view();
889 *minimum = *natural = view->contentsHeight();
893 static void updateChildAllocationFromPendingAllocation(GtkWidget* child, void*)
895 if (!gtk_widget_get_visible(child))
898 GtkAllocation* allocation = static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(child), "delayed-allocation"));
902 g_object_set_data(G_OBJECT(child), "delayed-allocation", 0);
903 gtk_widget_size_allocate(child, allocation);
904 *allocation = IntRect();
907 static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* allocation)
909 Page* page = core(webView);
911 if (FrameView* frameView = page->mainFrame()->view()) {
912 oldSize = frameView->size();
913 frameView->resize(allocation->width, allocation->height);
916 gtk_container_forall(GTK_CONTAINER(webView), updateChildAllocationFromPendingAllocation, 0);
918 WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
919 chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
920 chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
922 #if USE(ACCELERATED_COMPOSITING)
923 webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
927 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
929 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
931 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
932 if (!gtk_widget_get_mapped(widget)) {
933 webView->priv->needsResizeOnMap = true;
936 resizeWebViewFromAllocation(webView, allocation);
939 static void webkitWebViewMap(GtkWidget* widget)
941 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->map(widget);
943 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
944 if (!webView->priv->needsResizeOnMap)
947 GtkAllocation allocation;
948 gtk_widget_get_allocation(widget, &allocation);
949 resizeWebViewFromAllocation(webView, &allocation);
950 webView->priv->needsResizeOnMap = false;
953 static void webkit_web_view_grab_focus(GtkWidget* widget)
956 if (gtk_widget_is_sensitive(widget)) {
957 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
958 FocusController* focusController = core(webView)->focusController();
960 focusController->setActive(true);
962 if (focusController->focusedFrame())
963 focusController->setFocused(true);
965 focusController->setFocusedFrame(core(webView)->mainFrame());
968 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget);
971 static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* event)
973 // TODO: Improve focus handling as suggested in
974 // http://bugs.webkit.org/show_bug.cgi?id=16910
975 GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
976 if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
977 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
978 FocusController* focusController = core(webView)->focusController();
980 focusController->setActive(true);
982 if (focusController->focusedFrame())
983 focusController->setFocused(true);
985 focusController->setFocusedFrame(core(webView)->mainFrame());
987 if (focusController->focusedFrame()->editor()->canEdit())
988 gtk_im_context_focus_in(webView->priv->imContext.get());
990 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event);
993 static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus* event)
995 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
997 // We may hit this code while destroying the widget, and we might
998 // no longer have a page, then.
999 Page* page = core(webView);
1001 page->focusController()->setActive(false);
1002 page->focusController()->setFocused(false);
1005 if (webView->priv->imContext)
1006 gtk_im_context_focus_out(webView->priv->imContext.get());
1008 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event);
1011 static void webkit_web_view_realize(GtkWidget* widget)
1013 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
1015 gtk_widget_set_realized(widget, TRUE);
1017 GtkAllocation allocation;
1018 #if GTK_CHECK_VERSION(2, 18, 0)
1019 gtk_widget_get_allocation(widget, &allocation);
1021 allocation = widget->allocation;
1024 GdkWindowAttr attributes;
1025 attributes.window_type = GDK_WINDOW_CHILD;
1026 attributes.x = allocation.x;
1027 attributes.y = allocation.y;
1028 attributes.width = allocation.width;
1029 attributes.height = allocation.height;
1030 attributes.wclass = GDK_INPUT_OUTPUT;
1031 attributes.visual = gtk_widget_get_visual(widget);
1032 #ifdef GTK_API_VERSION_2
1033 attributes.colormap = gtk_widget_get_colormap(widget);
1035 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
1037 | GDK_BUTTON_PRESS_MASK
1038 | GDK_BUTTON_RELEASE_MASK
1040 | GDK_POINTER_MOTION_MASK
1041 | GDK_KEY_PRESS_MASK
1042 | GDK_KEY_RELEASE_MASK
1043 | GDK_BUTTON_MOTION_MASK
1044 | GDK_BUTTON1_MOTION_MASK
1045 | GDK_BUTTON2_MOTION_MASK
1046 | GDK_BUTTON3_MOTION_MASK;
1048 gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
1049 #ifdef GTK_API_VERSION_2
1050 attributes_mask |= GDK_WA_COLORMAP;
1052 GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
1054 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
1055 priv->hasNativeWindow = gdk_window_ensure_native(window);
1057 gtk_widget_set_window(widget, window);
1058 gdk_window_set_user_data(window, widget);
1060 #ifdef GTK_API_VERSION_2
1061 #if GTK_CHECK_VERSION(2, 20, 0)
1062 gtk_widget_style_attach(widget);
1064 widget->style = gtk_style_attach(gtk_widget_get_style(widget), window);
1066 gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL);
1068 gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
1071 gtk_im_context_set_client_window(priv->imContext.get(), window);
1074 #ifdef GTK_API_VERSION_2
1075 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* horizontalAdjustment, GtkAdjustment* verticalAdjustment)
1077 setHorizontalAdjustment(webView, horizontalAdjustment);
1078 setVerticalAdjustment(webView, verticalAdjustment);
1082 static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget)
1084 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1085 WebKitWebViewPrivate* priv = webView->priv;
1087 priv->children.add(widget);
1088 gtk_widget_set_parent(widget, GTK_WIDGET(container));
1091 static void webkit_web_view_container_remove(GtkContainer* container, GtkWidget* widget)
1093 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1094 WebKitWebViewPrivate* priv = webView->priv;
1096 if (priv->children.contains(widget)) {
1097 gtk_widget_unparent(widget);
1098 priv->children.remove(widget);
1102 static void webkit_web_view_container_forall(GtkContainer* container, gboolean, GtkCallback callback, gpointer callbackData)
1104 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1105 WebKitWebViewPrivate* priv = webView->priv;
1107 HashSet<GtkWidget*> children = priv->children;
1108 HashSet<GtkWidget*>::const_iterator end = children.end();
1109 for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current)
1110 (*callback)(*current, callbackData);
1113 static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*, WebKitWebFrame*)
1118 static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*)
1123 static gboolean webkit_web_view_real_close_web_view(WebKitWebView*)
1128 static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame*, WebKitNetworkRequest*)
1130 return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
1133 static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object)
1138 static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name)
1141 return g_strdup(old_name);
1145 WEBKIT_SCRIPT_DIALOG_ALERT,
1146 WEBKIT_SCRIPT_DIALOG_CONFIRM,
1147 WEBKIT_SCRIPT_DIALOG_PROMPT
1148 } WebKitScriptDialogType;
1150 static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, WebKitScriptDialogType type, const gchar* defaultValue, gchar** value)
1152 GtkMessageType messageType;
1153 GtkButtonsType buttons;
1154 gint defaultResponse;
1157 GtkWidget* entry = 0;
1158 gboolean didConfirm = FALSE;
1161 case WEBKIT_SCRIPT_DIALOG_ALERT:
1162 messageType = GTK_MESSAGE_WARNING;
1163 buttons = GTK_BUTTONS_CLOSE;
1164 defaultResponse = GTK_RESPONSE_CLOSE;
1166 case WEBKIT_SCRIPT_DIALOG_CONFIRM:
1167 messageType = GTK_MESSAGE_QUESTION;
1168 buttons = GTK_BUTTONS_OK_CANCEL;
1169 defaultResponse = GTK_RESPONSE_OK;
1171 case WEBKIT_SCRIPT_DIALOG_PROMPT:
1172 messageType = GTK_MESSAGE_QUESTION;
1173 buttons = GTK_BUTTONS_OK_CANCEL;
1174 defaultResponse = GTK_RESPONSE_OK;
1177 g_warning("Unknown value for WebKitScriptDialogType.");
1181 window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
1182 dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(window) ? GTK_WINDOW(window) : 0,
1183 GTK_DIALOG_DESTROY_WITH_PARENT,
1188 gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL);
1189 gtk_window_set_title(GTK_WINDOW(dialog), title);
1192 if (type == WEBKIT_SCRIPT_DIALOG_PROMPT) {
1193 entry = gtk_entry_new();
1194 gtk_entry_set_text(GTK_ENTRY(entry), defaultValue);
1195 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry);
1196 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
1197 gtk_widget_show(entry);
1200 gtk_dialog_set_default_response(GTK_DIALOG(dialog), defaultResponse);
1201 gint response = gtk_dialog_run(GTK_DIALOG(dialog));
1204 case GTK_RESPONSE_OK:
1207 *value = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
1209 case GTK_RESPONSE_CANCEL:
1214 gtk_widget_destroy(GTK_WIDGET(dialog));
1218 static gboolean webkit_web_view_real_script_alert(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message)
1220 webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_ALERT, 0, 0);
1224 static gboolean webkit_web_view_real_script_confirm(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm)
1226 *didConfirm = webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_CONFIRM, 0, 0);
1230 static gboolean webkit_web_view_real_script_prompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value)
1232 if (!webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_PROMPT, defaultValue, value))
1237 static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, const gchar* message, unsigned int line, const gchar* sourceId)
1239 g_message("console message: %s @%d: %s\n", sourceId, line, message);
1243 static void webkit_web_view_real_select_all(WebKitWebView* webView)
1245 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1246 frame->editor()->command("SelectAll").execute();
1249 static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView)
1251 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1252 frame->editor()->command("Cut").execute();
1255 static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView)
1257 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1258 frame->editor()->command("Copy").execute();
1261 static void webkit_web_view_real_undo(WebKitWebView* webView)
1263 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1264 frame->editor()->command("Undo").execute();
1267 static void webkit_web_view_real_redo(WebKitWebView* webView)
1269 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1270 frame->editor()->command("Redo").execute();
1273 static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count)
1275 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW (webView), FALSE);
1276 g_return_val_if_fail(step == GTK_MOVEMENT_VISUAL_POSITIONS ||
1277 step == GTK_MOVEMENT_DISPLAY_LINES ||
1278 step == GTK_MOVEMENT_PAGES ||
1279 step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
1280 g_return_val_if_fail(count == 1 || count == -1, FALSE);
1282 ScrollDirection direction;
1283 ScrollGranularity granularity;
1286 case GTK_MOVEMENT_DISPLAY_LINES:
1287 granularity = ScrollByLine;
1289 direction = ScrollDown;
1291 direction = ScrollUp;
1293 case GTK_MOVEMENT_VISUAL_POSITIONS:
1294 granularity = ScrollByLine;
1296 direction = ScrollRight;
1298 direction = ScrollLeft;
1300 case GTK_MOVEMENT_PAGES:
1301 granularity = ScrollByPage;
1303 direction = ScrollDown;
1305 direction = ScrollUp;
1307 case GTK_MOVEMENT_BUFFER_ENDS:
1308 granularity = ScrollByDocument;
1310 direction = ScrollDown;
1312 direction = ScrollUp;
1315 g_assert_not_reached();
1319 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1320 if (!frame->eventHandler()->scrollOverflow(direction, granularity))
1321 frame->view()->scroll(direction, granularity);
1326 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)
1328 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1329 frame->editor()->command("Paste").execute();
1332 static gboolean webkit_web_view_real_should_allow_editing_action(WebKitWebView*)
1337 static gboolean webkit_web_view_real_entering_fullscreen(WebKitWebView* webView)
1342 static gboolean webkit_web_view_real_leaving_fullscreen(WebKitWebView* webView)
1347 static void webkit_web_view_dispose(GObject* object)
1349 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
1350 WebKitWebViewPrivate* priv = webView->priv;
1352 priv->disposing = TRUE;
1354 // Make sure GtkAdjustmentWatcher won't be reacting to adjustment changes after the
1355 // WebView is destroyed.
1356 setHorizontalAdjustment(webView, 0);
1357 setVerticalAdjustment(webView, 0);
1359 // These smart pointers are cleared manually, because some cleanup operations are
1360 // very sensitive to their value. We may crash if these are done in the wrong order.
1361 priv->backForwardList.clear();
1363 if (priv->corePage) {
1364 webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object));
1365 core(priv->mainFrame)->loader()->detachFromParent();
1366 delete priv->corePage;
1370 if (priv->webSettings) {
1371 g_signal_handlers_disconnect_by_func(priv->webSettings.get(), reinterpret_cast<void*>(webkit_web_view_settings_notify), webView);
1372 priv->webSettings.clear();
1375 if (priv->currentMenu) {
1376 gtk_widget_destroy(GTK_WIDGET(priv->currentMenu));
1377 priv->currentMenu = 0;
1380 priv->webInspector.clear();
1381 priv->viewportAttributes.clear();
1382 priv->webWindowFeatures.clear();
1383 priv->mainResource.clear();
1384 priv->subResources.clear();
1386 G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
1389 static void webkit_web_view_finalize(GObject* object)
1391 // We need to manually call the destructor here, since this object's memory is managed
1392 // by GLib. This calls all C++ members' destructors and prevents memory leaks.
1393 WEBKIT_WEB_VIEW(object)->priv->~WebKitWebViewPrivate();
1394 G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
1397 static gboolean webkit_signal_accumulator_object_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1399 gpointer newWebView = g_value_get_object(handlerReturn);
1400 g_value_set_object(returnAccu, newWebView);
1402 // Continue if we don't have a newWebView
1406 static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1408 WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn);
1409 g_value_set_enum(returnAccu, navigationResponse);
1411 if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
1417 static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
1419 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1423 if (!AXObjectCache::accessibilityEnabled())
1424 AXObjectCache::enableAccessibility();
1426 Frame* coreFrame = core(webView)->mainFrame();
1430 Document* doc = coreFrame->document();
1434 AccessibilityObject* rootAccessible = doc->axObjectCache()->rootObject();
1435 if (!rootAccessible)
1438 AtkObject* axRoot = rootAccessible->wrapper();
1439 if (!axRoot || !ATK_IS_OBJECT(axRoot))
1442 // Ensure the parent is set to make top-down and bottom-up navigation work.
1443 GtkWidget* parentWidget = gtk_widget_get_parent(widget);
1444 AtkObject* axParent = parentWidget ? gtk_widget_get_accessible(parentWidget) : 0;
1446 atk_object_set_parent(axRoot, axParent);
1451 static double screenDPI(GdkScreen* screen)
1453 // gdk_screen_get_resolution() returns -1 when no DPI is set.
1454 double dpi = gdk_screen_get_resolution(screen);
1458 static const double kMillimetresPerInch = 25.4;
1459 double diagonalSizeInPixels = hypot(gdk_screen_get_width(screen), gdk_screen_get_height(screen));
1460 double diagonalSizeInInches = hypot(gdk_screen_get_width_mm(screen), gdk_screen_get_height_mm(screen)) / kMillimetresPerInch;
1461 return diagonalSizeInPixels / diagonalSizeInInches;
1464 static gdouble webViewGetDPI(WebKitWebView* webView)
1466 if (webView->priv->webSettings->priv->enforce96DPI)
1469 static const double defaultDPI = 96;
1470 GdkScreen* screen = gtk_widget_has_screen(GTK_WIDGET(webView)) ? gtk_widget_get_screen(GTK_WIDGET(webView)) : gdk_screen_get_default();
1471 return screen ? screenDPI(screen) : defaultDPI;
1474 static inline gint webViewConvertFontSizeToPixels(WebKitWebView* webView, double fontSize)
1476 return fontSize / 72.0 * webViewGetDPI(webView);
1479 static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previousScreen)
1481 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1482 WebKitWebViewPrivate* priv = webView->priv;
1484 if (priv->disposing)
1487 WebKitWebSettings* webSettings = priv->webSettings.get();
1488 Settings* settings = core(webView)->settings();
1489 guint defaultFontSize, defaultMonospaceFontSize, minimumFontSize, minimumLogicalFontSize;
1491 g_object_get(webSettings,
1492 "default-font-size", &defaultFontSize,
1493 "default-monospace-font-size", &defaultMonospaceFontSize,
1494 "minimum-font-size", &minimumFontSize,
1495 "minimum-logical-font-size", &minimumLogicalFontSize,
1498 settings->setDefaultFontSize(webViewConvertFontSizeToPixels(webView, defaultFontSize));
1499 settings->setDefaultFixedFontSize(webViewConvertFontSizeToPixels(webView, defaultMonospaceFontSize));
1500 settings->setMinimumFontSize(webViewConvertFontSizeToPixels(webView, minimumFontSize));
1501 settings->setMinimumLogicalFontSize(webViewConvertFontSizeToPixels(webView, minimumLogicalFontSize));
1504 static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
1506 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1507 if (!webView->priv->dragAndDropHelper.handleDragEnd(context))
1510 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1514 // Synthesize a button release event to send with the drag end action.
1515 GOwnPtr<GdkEvent> event(gdk_event_new(GDK_BUTTON_RELEASE));
1516 int x, y, xRoot, yRoot;
1517 GdkModifierType modifiers = static_cast<GdkModifierType>(0);
1518 #ifdef GTK_API_VERSION_2
1519 GdkDisplay* display = gdk_display_get_default();
1520 gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers);
1521 event->button.window = gdk_display_get_window_at_pointer(display, &x, &y);
1523 GdkDevice* device = gdk_drag_context_get_device(context);
1524 event->button.window = gdk_device_get_window_at_position(device, &x, &y);
1525 gdk_device_get_position(device, 0, &xRoot, &yRoot);
1528 if (event->button.window)
1529 g_object_ref(event->button.window);
1530 event->button.x = x;
1531 event->button.y = y;
1532 event->button.x_root = xRoot;
1533 event->button.y_root = yRoot;
1534 event->button.state = modifiers;
1536 PlatformMouseEvent platformEvent(&event->button);
1537 frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
1540 static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint)
1542 WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleGetDragData(context, selectionData, info);
1545 static void dragExitedCallback(GtkWidget* widget, DragData* dragData, bool dropHappened)
1547 // Don't call dragExited if we have just received a drag-drop signal. This
1548 // happens in the case of a successful drop onto the view.
1550 core(WEBKIT_WEB_VIEW(widget))->dragController()->dragExited(dragData);
1551 core(WEBKIT_WEB_VIEW(widget))->dragController()->dragEnded();
1554 static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time)
1556 WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleDragLeave(context, dragExitedCallback);
1559 static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1561 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1562 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragMotion(context, IntPoint(x, y), time));
1566 DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
1567 gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1571 static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
1573 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1574 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info));
1578 DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
1579 gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1582 static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1584 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1585 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDrop(context, IntPoint(x, y)));
1589 core(webView)->dragController()->performDrag(dragData.get());
1590 gtk_drag_finish(context, TRUE, FALSE, time);
1594 #if GTK_CHECK_VERSION(2, 12, 0)
1595 static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip)
1597 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
1599 if (keyboard_mode) {
1600 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1602 // Get the title of the current focused element.
1603 Frame* coreFrame = core(webView)->focusController()->focusedOrMainFrame();
1607 Node* node = getFocusedNode(coreFrame);
1611 for (Node* titleNode = node; titleNode; titleNode = titleNode->parentNode()) {
1612 if (titleNode->isElementNode()) {
1613 String title = static_cast<Element*>(titleNode)->title();
1614 if (!title.isEmpty()) {
1615 if (FrameView* view = coreFrame->view()) {
1616 GdkRectangle area = view->contentsToWindow(node->getRect());
1617 gtk_tooltip_set_tip_area(tooltip, &area);
1619 gtk_tooltip_set_text(tooltip, title.utf8().data());
1629 if (priv->tooltipText.length() > 0) {
1630 if (!keyboard_mode) {
1631 if (!priv->tooltipArea.isEmpty()) {
1632 GdkRectangle area = priv->tooltipArea;
1633 gtk_tooltip_set_tip_area(tooltip, &area);
1635 gtk_tooltip_set_tip_area(tooltip, 0);
1637 gtk_tooltip_set_text(tooltip, priv->tooltipText.data());
1644 static gboolean webkit_web_view_show_help(GtkWidget* widget, GtkWidgetHelpType help_type)
1646 if (help_type == GTK_WIDGET_HELP_TOOLTIP)
1647 gtk_widget_set_has_tooltip(widget, TRUE);
1649 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->show_help(widget, help_type);
1653 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
1655 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
1656 return GTK_IM_CONTEXT(webView->priv->imContext.get());
1659 static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
1661 GtkBindingSet* binding_set;
1670 * WebKitWebView::create-web-view:
1671 * @web_view: the object on which the signal is emitted
1672 * @frame: the #WebKitWebFrame
1674 * Emitted when the creation of a new window is requested.
1675 * If this signal is handled the signal handler should return the
1676 * newly created #WebKitWebView.
1678 * The new #WebKitWebView should not be displayed to the user
1679 * until the #WebKitWebView::web-view-ready signal is emitted.
1681 * The signal handlers should not try to deal with the reference count for
1682 * the new #WebKitWebView. The widget to which the widget is added will
1685 * Return value: (transfer full): a newly allocated #WebKitWebView, or %NULL
1689 webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view",
1690 G_TYPE_FROM_CLASS(webViewClass),
1691 (GSignalFlags)G_SIGNAL_RUN_LAST,
1692 G_STRUCT_OFFSET (WebKitWebViewClass, create_web_view),
1693 webkit_signal_accumulator_object_handled,
1695 webkit_marshal_OBJECT__OBJECT,
1696 WEBKIT_TYPE_WEB_VIEW , 1,
1697 WEBKIT_TYPE_WEB_FRAME);
1700 * WebKitWebView::web-view-ready:
1701 * @web_view: the object on which the signal is emitted
1703 * Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView
1704 * should be displayed to the user. When this signal is emitted
1705 * all the information about how the window should look, including
1706 * size, position, whether the location, status and scroll bars
1707 * should be displayed, is already set on the
1708 * #WebKitWebWindowFeatures object contained by the #WebKitWebView.
1710 * Notice that some of that information may change during the life
1711 * time of the window, so you may want to connect to the ::notify
1712 * signal of the #WebKitWebWindowFeatures object to handle those.
1714 * Return value: %TRUE to stop handlers from being invoked for the event or
1715 * %FALSE to propagate the event furter
1719 webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready",
1720 G_TYPE_FROM_CLASS(webViewClass),
1721 (GSignalFlags)G_SIGNAL_RUN_LAST,
1722 G_STRUCT_OFFSET (WebKitWebViewClass, web_view_ready),
1723 g_signal_accumulator_true_handled,
1725 webkit_marshal_BOOLEAN__VOID,
1729 * WebKitWebView::close-web-view:
1730 * @web_view: the object on which the signal is emitted
1732 * Emitted when closing a #WebKitWebView is requested. This occurs when a
1733 * call is made from JavaScript's window.close function. The default
1734 * signal handler does not do anything. It is the owner's responsibility
1735 * to hide or delete the web view, if necessary.
1737 * Return value: %TRUE to stop handlers from being invoked for the event or
1738 * %FALSE to propagate the event furter
1742 webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view",
1743 G_TYPE_FROM_CLASS(webViewClass),
1744 (GSignalFlags)G_SIGNAL_RUN_LAST,
1745 G_STRUCT_OFFSET (WebKitWebViewClass, close_web_view),
1746 g_signal_accumulator_true_handled,
1748 webkit_marshal_BOOLEAN__VOID,
1752 * WebKitWebView::navigation-requested:
1753 * @web_view: the object on which the signal is emitted
1754 * @frame: the #WebKitWebFrame that required the navigation
1755 * @request: a #WebKitNetworkRequest
1757 * Emitted when @frame requests a navigation to another page.
1759 * Return value: a #WebKitNavigationResponse
1761 * Deprecated: Use WebKitWebView::navigation-policy-decision-requested
1764 webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
1765 G_TYPE_FROM_CLASS(webViewClass),
1766 (GSignalFlags)G_SIGNAL_RUN_LAST,
1767 G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested),
1768 webkit_navigation_request_handled,
1770 webkit_marshal_ENUM__OBJECT_OBJECT,
1771 WEBKIT_TYPE_NAVIGATION_RESPONSE, 2,
1772 WEBKIT_TYPE_WEB_FRAME,
1773 WEBKIT_TYPE_NETWORK_REQUEST);
1776 * WebKitWebView::new-window-policy-decision-requested:
1777 * @web_view: the object on which the signal is emitted
1778 * @frame: the #WebKitWebFrame that required the navigation
1779 * @request: a #WebKitNetworkRequest
1780 * @navigation_action: a #WebKitWebNavigationAction
1781 * @policy_decision: a #WebKitWebPolicyDecision
1783 * Emitted when @frame requests opening a new window. With this
1784 * signal the browser can use the context of the request to decide
1785 * about the new window. If the request is not handled the default
1786 * behavior is to allow opening the new window to load the URI,
1787 * which will cause a create-web-view signal emission where the
1788 * browser handles the new window action but without information
1789 * of the context that caused the navigation. The following
1790 * navigation-policy-decision-requested emissions will load the
1791 * page after the creation of the new window just with the
1792 * information of this new navigation context, without any
1793 * information about the action that made this new window to be
1796 * Notice that if you return TRUE, meaning that you handled the
1797 * signal, you are expected to have decided what to do, by calling
1798 * webkit_web_policy_decision_ignore(),
1799 * webkit_web_policy_decision_use(), or
1800 * webkit_web_policy_decision_download() on the @policy_decision
1803 * Return value: %TRUE if a decision was made, %FALSE to have the
1804 * default behavior apply
1808 webkit_web_view_signals[NEW_WINDOW_POLICY_DECISION_REQUESTED] =
1809 g_signal_new("new-window-policy-decision-requested",
1810 G_TYPE_FROM_CLASS(webViewClass),
1811 (GSignalFlags)G_SIGNAL_RUN_LAST,
1813 g_signal_accumulator_true_handled,
1815 webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1817 WEBKIT_TYPE_WEB_FRAME,
1818 WEBKIT_TYPE_NETWORK_REQUEST,
1819 WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1820 WEBKIT_TYPE_WEB_POLICY_DECISION);
1823 * WebKitWebView::navigation-policy-decision-requested:
1824 * @web_view: the object on which the signal is emitted
1825 * @frame: the #WebKitWebFrame that required the navigation
1826 * @request: a #WebKitNetworkRequest
1827 * @navigation_action: a #WebKitWebNavigationAction
1828 * @policy_decision: a #WebKitWebPolicyDecision
1830 * Emitted when @frame requests a navigation to another page.
1831 * If this signal is not handled, the default behavior is to allow the
1834 * Notice that if you return TRUE, meaning that you handled the
1835 * signal, you are expected to have decided what to do, by calling
1836 * webkit_web_policy_decision_ignore(),
1837 * webkit_web_policy_decision_use(), or
1838 * webkit_web_policy_decision_download() on the @policy_decision
1841 * Return value: %TRUE if a decision was made, %FALSE to have the
1842 * default behavior apply
1846 webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested",
1847 G_TYPE_FROM_CLASS(webViewClass),
1848 (GSignalFlags)G_SIGNAL_RUN_LAST,
1850 g_signal_accumulator_true_handled,
1852 webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1854 WEBKIT_TYPE_WEB_FRAME,
1855 WEBKIT_TYPE_NETWORK_REQUEST,
1856 WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1857 WEBKIT_TYPE_WEB_POLICY_DECISION);
1860 * WebKitWebView::mime-type-policy-decision-requested:
1861 * @web_view: the object on which the signal is emitted
1862 * @frame: the #WebKitWebFrame that required the policy decision
1863 * @request: a WebKitNetworkRequest
1864 * @mimetype: the MIME type attempted to load
1865 * @policy_decision: a #WebKitWebPolicyDecision
1867 * Decide whether or not to display the given MIME type. If this
1868 * signal is not handled, the default behavior is to show the
1869 * content of the requested URI if WebKit can show this MIME
1870 * type and the content disposition is not a download; if WebKit
1871 * is not able to show the MIME type nothing happens.
1873 * Notice that if you return TRUE, meaning that you handled the
1874 * signal, you are expected to be aware of the "Content-Disposition"
1875 * header. A value of "attachment" usually indicates a download
1876 * regardless of the MIME type, see also
1877 * soup_message_headers_get_content_disposition(). And you must call
1878 * webkit_web_policy_decision_ignore(),
1879 * webkit_web_policy_decision_use(), or
1880 * webkit_web_policy_decision_download() on the @policy_decision
1883 * Return value: %TRUE if a decision was made, %FALSE to have the
1884 * default behavior apply
1888 webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested",
1889 G_TYPE_FROM_CLASS(webViewClass),
1890 (GSignalFlags)G_SIGNAL_RUN_LAST,
1892 g_signal_accumulator_true_handled,
1894 webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT,
1896 WEBKIT_TYPE_WEB_FRAME,
1897 WEBKIT_TYPE_NETWORK_REQUEST,
1899 WEBKIT_TYPE_WEB_POLICY_DECISION);
1902 * WebKitWebView::window-object-cleared:
1903 * @web_view: the object on which the signal is emitted
1904 * @frame: the #WebKitWebFrame to which @window_object belongs
1905 * @context: the #JSGlobalContextRef holding the global object and other
1906 * execution state; equivalent to the return value of
1907 * webkit_web_frame_get_global_context(@frame)
1908 * @window_object: the #JSObjectRef representing the frame's JavaScript
1911 * Emitted when the JavaScript window object in a #WebKitWebFrame has been
1912 * cleared in preparation for a new load. This is the preferred place to
1913 * set custom properties on the window object using the JavaScriptCore API.
1915 webkit_web_view_signals[WINDOW_OBJECT_CLEARED] = g_signal_new("window-object-cleared",
1916 G_TYPE_FROM_CLASS(webViewClass),
1917 (GSignalFlags)G_SIGNAL_RUN_LAST,
1918 G_STRUCT_OFFSET (WebKitWebViewClass, window_object_cleared),
1921 webkit_marshal_VOID__OBJECT_POINTER_POINTER,
1923 WEBKIT_TYPE_WEB_FRAME,
1928 * WebKitWebView::download-requested:
1929 * @web_view: the object on which the signal is emitted
1930 * @download: a #WebKitDownload object that lets you control the
1933 * A new Download is being requested. By default, if the signal is
1934 * not handled, the download is cancelled. If you handle the download
1935 * and call webkit_download_set_destination_uri(), it will be
1936 * started for you. If you need to set the destination asynchronously
1937 * you are responsible for starting or cancelling it yourself.
1939 * If you intend to handle downloads yourself rather than using
1940 * the #WebKitDownload helper object you must handle this signal,
1941 * and return %FALSE.
1943 * Also, keep in mind that the default policy for WebKitGTK+ is to
1944 * ignore files with a MIME type that it does not know how to
1945 * handle, which means this signal won't be emitted in the default
1946 * setup. One way to trigger downloads is to connect to
1947 * WebKitWebView::mime-type-policy-decision-requested and call
1948 * webkit_web_policy_decision_download() on the
1949 * #WebKitWebPolicyDecision in the parameter list for the kind of
1950 * files you want your application to download (a common solution
1951 * is to download anything that WebKit can't handle, which you can
1952 * figure out by using webkit_web_view_can_show_mime_type()).
1954 * Return value: TRUE if the download should be performed, %FALSE to
1959 webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested",
1960 G_TYPE_FROM_CLASS(webViewClass),
1961 (GSignalFlags)G_SIGNAL_RUN_LAST,
1963 g_signal_accumulator_true_handled,
1965 webkit_marshal_BOOLEAN__OBJECT,
1970 * WebKitWebView::load-started:
1971 * @web_view: the object on which the signal is emitted
1972 * @frame: the frame going to do the load
1974 * When a #WebKitWebFrame begins to load this signal is emitted.
1976 * Deprecated: Use the "load-status" property instead.
1978 webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
1979 G_TYPE_FROM_CLASS(webViewClass),
1980 (GSignalFlags)G_SIGNAL_RUN_LAST,
1984 g_cclosure_marshal_VOID__OBJECT,
1986 WEBKIT_TYPE_WEB_FRAME);
1989 * WebKitWebView::load-committed:
1990 * @web_view: the object on which the signal is emitted
1991 * @frame: the main frame that received the first data
1993 * When a #WebKitWebFrame loaded the first data this signal is emitted.
1995 * Deprecated: Use the "load-status" property instead.
1997 webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
1998 G_TYPE_FROM_CLASS(webViewClass),
1999 (GSignalFlags)G_SIGNAL_RUN_LAST,
2003 g_cclosure_marshal_VOID__OBJECT,
2005 WEBKIT_TYPE_WEB_FRAME);
2009 * WebKitWebView::load-progress-changed:
2010 * @web_view: the #WebKitWebView
2011 * @progress: the global progress
2013 * Deprecated: Use the "progress" property instead.
2015 webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
2016 G_TYPE_FROM_CLASS(webViewClass),
2017 (GSignalFlags)G_SIGNAL_RUN_LAST,
2021 g_cclosure_marshal_VOID__INT,
2026 * WebKitWebView::load-error
2027 * @web_view: the object on which the signal is emitted
2028 * @web_frame: the #WebKitWebFrame
2029 * @uri: the URI that triggered the error
2030 * @web_error: the #GError that was triggered
2032 * An error occurred while loading. By default, if the signal is not
2033 * handled, the @web_view will display a stock error page. You need to
2034 * handle the signal if you want to provide your own error page.
2038 * Return value: %TRUE to stop other handlers from being invoked for the
2039 * event. %FALSE to propagate the event further.
2041 webkit_web_view_signals[LOAD_ERROR] = g_signal_new("load-error",
2042 G_TYPE_FROM_CLASS(webViewClass),
2043 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2045 g_signal_accumulator_true_handled,
2047 webkit_marshal_BOOLEAN__OBJECT_STRING_BOXED,
2049 WEBKIT_TYPE_WEB_FRAME,
2054 * WebKitWebView::load-finished:
2055 * @web_view: the #WebKitWebView
2056 * @frame: the #WebKitWebFrame
2058 * Deprecated: Use the "load-status" property instead.
2060 webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
2061 G_TYPE_FROM_CLASS(webViewClass),
2062 (GSignalFlags)G_SIGNAL_RUN_LAST,
2066 g_cclosure_marshal_VOID__OBJECT,
2068 WEBKIT_TYPE_WEB_FRAME);
2071 * WebKitWebView::onload-event:
2072 * @web_view: the object on which the signal is emitted
2075 * When a #WebKitWebFrame receives an onload event this signal is emitted.
2077 webkit_web_view_signals[ONLOAD_EVENT] = g_signal_new("onload-event",
2078 G_TYPE_FROM_CLASS(webViewClass),
2079 (GSignalFlags)G_SIGNAL_RUN_LAST,
2083 g_cclosure_marshal_VOID__OBJECT,
2085 WEBKIT_TYPE_WEB_FRAME);
2088 * WebKitWebView::title-changed:
2089 * @web_view: the object on which the signal is emitted
2090 * @frame: the main frame
2091 * @title: the new title
2093 * When a #WebKitWebFrame changes the document title this signal is emitted.
2095 * Deprecated: 1.1.4: Use "notify::title" instead.
2097 webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed",
2098 G_TYPE_FROM_CLASS(webViewClass),
2099 (GSignalFlags)G_SIGNAL_RUN_LAST,
2103 webkit_marshal_VOID__OBJECT_STRING,
2105 WEBKIT_TYPE_WEB_FRAME,
2109 * WebKitWebView::hovering-over-link:
2110 * @web_view: the object on which the signal is emitted
2111 * @title: the link's title
2112 * @uri: the URI the link points to
2114 * When the cursor is over a link, this signal is emitted.
2116 webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
2117 G_TYPE_FROM_CLASS(webViewClass),
2118 (GSignalFlags)G_SIGNAL_RUN_LAST,
2122 webkit_marshal_VOID__STRING_STRING,
2128 * WebKitWebView::populate-popup:
2129 * @web_view: the object on which the signal is emitted
2130 * @menu: the context menu
2132 * When a context menu is about to be displayed this signal is emitted.
2134 * Add menu items to #menu to extend the context menu.
2136 * Deprecated: 1.10: Use #WebKitWebView::context-menu signal instead.
2138 webkit_web_view_signals[POPULATE_POPUP] = g_signal_new("populate-popup",
2139 G_TYPE_FROM_CLASS(webViewClass),
2140 (GSignalFlags)G_SIGNAL_RUN_LAST,
2144 g_cclosure_marshal_VOID__OBJECT,
2149 * WebKitWebView::print-requested
2150 * @web_view: the object in which the signal is emitted
2151 * @web_frame: the frame that is requesting to be printed
2153 * Emitted when printing is requested by the frame, usually
2154 * because of a javascript call. When handling this signal you
2155 * should call webkit_web_frame_print_full() or
2156 * webkit_web_frame_print() to do the actual printing.
2158 * The default handler will present a print dialog and carry a
2159 * print operation. Notice that this means that if you intend to
2160 * ignore a print request you must connect to this signal, and
2163 * Return value: %TRUE if the print request has been handled, %FALSE if
2164 * the default handler should run
2168 webkit_web_view_signals[PRINT_REQUESTED] = g_signal_new("print-requested",
2169 G_TYPE_FROM_CLASS(webViewClass),
2170 (GSignalFlags)G_SIGNAL_RUN_LAST,
2172 g_signal_accumulator_true_handled,
2174 webkit_marshal_BOOLEAN__OBJECT,
2176 WEBKIT_TYPE_WEB_FRAME);
2178 webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed",
2179 G_TYPE_FROM_CLASS(webViewClass),
2180 (GSignalFlags)G_SIGNAL_RUN_LAST,
2184 g_cclosure_marshal_VOID__STRING,
2189 * WebKitWebView::icon-loaded:
2190 * @web_view: the object on which the signal is emitted
2191 * @icon_uri: the URI for the icon
2193 * This signal is emitted when the main frame has got a favicon.
2194 * See WebKitIconDatabase::icon-loaded if you want to keep track of
2195 * icons for child frames.
2199 webkit_web_view_signals[ICON_LOADED] = g_signal_new("icon-loaded",
2200 G_TYPE_FROM_CLASS(webViewClass),
2201 (GSignalFlags)G_SIGNAL_RUN_LAST,
2205 g_cclosure_marshal_VOID__STRING,
2210 * WebKitWebView::console-message:
2211 * @web_view: the object on which the signal is emitted
2212 * @message: the message text
2213 * @line: the line where the error occured
2214 * @source_id: the source id
2216 * A JavaScript console message was created.
2218 * Return value: %TRUE to stop other handlers from being invoked for the
2219 * event. %FALSE to propagate the event further.
2221 webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message",
2222 G_TYPE_FROM_CLASS(webViewClass),
2223 (GSignalFlags)G_SIGNAL_RUN_LAST,
2224 G_STRUCT_OFFSET(WebKitWebViewClass, console_message),
2225 g_signal_accumulator_true_handled,
2227 webkit_marshal_BOOLEAN__STRING_INT_STRING,
2229 G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
2232 * WebKitWebView::script-alert:
2233 * @web_view: the object on which the signal is emitted
2234 * @frame: the relevant frame
2235 * @message: the message text
2237 * A JavaScript alert dialog was created.
2239 * Return value: %TRUE to stop other handlers from being invoked for the
2240 * event. %FALSE to propagate the event further.
2242 webkit_web_view_signals[SCRIPT_ALERT] = g_signal_new("script-alert",
2243 G_TYPE_FROM_CLASS(webViewClass),
2244 (GSignalFlags)G_SIGNAL_RUN_LAST,
2245 G_STRUCT_OFFSET(WebKitWebViewClass, script_alert),
2246 g_signal_accumulator_true_handled,
2248 webkit_marshal_BOOLEAN__OBJECT_STRING,
2250 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING);
2253 * WebKitWebView::script-confirm:
2254 * @web_view: the object on which the signal is emitted
2255 * @frame: the relevant frame
2256 * @message: the message text
2257 * @confirmed: whether the dialog has been confirmed
2259 * A JavaScript confirm dialog was created, providing Yes and No buttons.
2261 * Return value: %TRUE to stop other handlers from being invoked for the
2262 * event. %FALSE to propagate the event further.
2264 webkit_web_view_signals[SCRIPT_CONFIRM] = g_signal_new("script-confirm",
2265 G_TYPE_FROM_CLASS(webViewClass),
2266 (GSignalFlags)G_SIGNAL_RUN_LAST,
2267 G_STRUCT_OFFSET(WebKitWebViewClass, script_confirm),
2268 g_signal_accumulator_true_handled,
2270 webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER,
2272 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_POINTER);
2275 * WebKitWebView::script-prompt:
2276 * @web_view: the object on which the signal is emitted
2277 * @frame: the relevant frame
2278 * @message: the message text
2279 * @default: the default value
2280 * @text: To be filled with the return value or NULL if the dialog was cancelled.
2282 * A JavaScript prompt dialog was created, providing an entry to input text.
2284 * Return value: %TRUE to stop other handlers from being invoked for the
2285 * event. %FALSE to propagate the event further.
2287 webkit_web_view_signals[SCRIPT_PROMPT] = g_signal_new("script-prompt",
2288 G_TYPE_FROM_CLASS(webViewClass),
2289 (GSignalFlags)G_SIGNAL_RUN_LAST,
2290 G_STRUCT_OFFSET(WebKitWebViewClass, script_prompt),
2291 g_signal_accumulator_true_handled,
2293 webkit_marshal_BOOLEAN__OBJECT_STRING_STRING_STRING,
2295 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
2298 * WebKitWebView::select-all:
2299 * @web_view: the object which received the signal
2301 * The #WebKitWebView::select-all signal is a keybinding signal which gets emitted to
2302 * select the complete contents of the text view.
2304 * The default bindings for this signal is Ctrl-a.
2306 webkit_web_view_signals[SELECT_ALL] = g_signal_new("select-all",
2307 G_TYPE_FROM_CLASS(webViewClass),
2308 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2309 G_STRUCT_OFFSET(WebKitWebViewClass, select_all),
2311 g_cclosure_marshal_VOID__VOID,
2315 * WebKitWebView::cut-clipboard:
2316 * @web_view: the object which received the signal
2318 * The #WebKitWebView::cut-clipboard signal is a keybinding signal which gets emitted to
2319 * cut the selection to the clipboard.
2321 * The default bindings for this signal are Ctrl-x and Shift-Delete.
2323 webkit_web_view_signals[CUT_CLIPBOARD] = g_signal_new("cut-clipboard",
2324 G_TYPE_FROM_CLASS(webViewClass),
2325 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2326 G_STRUCT_OFFSET(WebKitWebViewClass, cut_clipboard),
2328 g_cclosure_marshal_VOID__VOID,
2332 * WebKitWebView::copy-clipboard:
2333 * @web_view: the object which received the signal
2335 * The #WebKitWebView::copy-clipboard signal is a keybinding signal which gets emitted to
2336 * copy the selection to the clipboard.
2338 * The default bindings for this signal are Ctrl-c and Ctrl-Insert.
2340 webkit_web_view_signals[COPY_CLIPBOARD] = g_signal_new("copy-clipboard",
2341 G_TYPE_FROM_CLASS(webViewClass),
2342 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2343 G_STRUCT_OFFSET(WebKitWebViewClass, copy_clipboard),
2345 g_cclosure_marshal_VOID__VOID,
2349 * WebKitWebView::paste-clipboard:
2350 * @web_view: the object which received the signal
2352 * The #WebKitWebView::paste-clipboard signal is a keybinding signal which gets emitted to
2353 * paste the contents of the clipboard into the Web view.
2355 * The default bindings for this signal are Ctrl-v and Shift-Insert.
2357 webkit_web_view_signals[PASTE_CLIPBOARD] = g_signal_new("paste-clipboard",
2358 G_TYPE_FROM_CLASS(webViewClass),
2359 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2360 G_STRUCT_OFFSET(WebKitWebViewClass, paste_clipboard),
2362 g_cclosure_marshal_VOID__VOID,
2366 * WebKitWebView::undo
2367 * @web_view: the object which received the signal
2369 * The #WebKitWebView::undo signal is a keybinding signal which gets emitted to
2370 * undo the last editing command.
2372 * The default binding for this signal is Ctrl-z
2376 webkit_web_view_signals[UNDO] = g_signal_new("undo",
2377 G_TYPE_FROM_CLASS(webViewClass),
2378 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2379 G_STRUCT_OFFSET(WebKitWebViewClass, undo),
2381 g_cclosure_marshal_VOID__VOID,
2385 * WebKitWebView::redo
2386 * @web_view: the object which received the signal
2388 * The #WebKitWebView::redo signal is a keybinding signal which gets emitted to
2389 * redo the last editing command.
2391 * The default binding for this signal is Ctrl-Shift-z
2395 webkit_web_view_signals[REDO] = g_signal_new("redo",
2396 G_TYPE_FROM_CLASS(webViewClass),
2397 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2398 G_STRUCT_OFFSET(WebKitWebViewClass, redo),
2400 g_cclosure_marshal_VOID__VOID,
2404 * WebKitWebView::move-cursor:
2405 * @web_view: the object which received the signal
2406 * @step: the type of movement, one of #GtkMovementStep
2407 * @count: an integer indicating the subtype of movement. Currently
2408 * the permitted values are '1' = forward, '-1' = backwards.
2410 * The #WebKitWebView::move-cursor will be emitted to apply the
2411 * cursor movement described by its parameters to the @view.
2413 * Return value: %TRUE or %FALSE
2417 webkit_web_view_signals[MOVE_CURSOR] = g_signal_new("move-cursor",
2418 G_TYPE_FROM_CLASS(webViewClass),
2419 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2420 G_STRUCT_OFFSET(WebKitWebViewClass, move_cursor),
2422 webkit_marshal_BOOLEAN__ENUM_INT,
2424 GTK_TYPE_MOVEMENT_STEP,
2428 * WebKitWebView::create-plugin-widget:
2429 * @web_view: the object which received the signal
2430 * @mime_type: the mimetype of the requested object
2431 * @uri: the URI to load
2432 * @param: a #GHashTable with additional attributes (strings)
2434 * The #WebKitWebView::create-plugin-widget signal will be emitted to
2435 * create a plugin widget for embed or object HTML tags. This
2436 * allows to embed a GtkWidget as a plugin into HTML content. In
2437 * case of a textual selection of the GtkWidget WebCore will attempt
2438 * to set the property value of "webkit-widget-is-selected". This can
2439 * be used to draw a visual indicator of the selection.
2441 * Return value: (transfer full): a new #GtkWidget, or %NULL
2445 webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("create-plugin-widget",
2446 G_TYPE_FROM_CLASS(webViewClass),
2447 (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2449 webkit_signal_accumulator_object_handled,
2451 webkit_marshal_OBJECT__STRING_STRING_POINTER,
2453 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_HASH_TABLE);
2456 * WebKitWebView::database-quota-exceeded
2457 * @web_view: the object which received the signal
2458 * @frame: the relevant frame
2459 * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin
2461 * The #WebKitWebView::database-quota-exceeded signal will be emitted when
2462 * a Web Database exceeds the quota of its security origin. This signal
2463 * may be used to increase the size of the quota before the originating
2468 webkit_web_view_signals[DATABASE_QUOTA_EXCEEDED] = g_signal_new("database-quota-exceeded",
2469 G_TYPE_FROM_CLASS(webViewClass),
2470 (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2473 webkit_marshal_VOID__OBJECT_OBJECT,
2475 G_TYPE_OBJECT, G_TYPE_OBJECT);
2478 * WebKitWebView::resource-request-starting:
2479 * @web_view: the object which received the signal
2480 * @web_frame: the #WebKitWebFrame whose load dispatched this request
2481 * @web_resource: an empty #WebKitWebResource object
2482 * @request: the #WebKitNetworkRequest that will be dispatched
2483 * @response: the #WebKitNetworkResponse representing the redirect
2486 * Emitted when a request is about to be sent. You can modify the
2487 * request while handling this signal. You can set the URI in the
2488 * #WebKitNetworkRequest object itself, and add/remove/replace
2489 * headers using the #SoupMessage object it carries, if it is
2490 * present. See webkit_network_request_get_message(). Setting the
2491 * request URI to "about:blank" will effectively cause the request
2492 * to load nothing, and can be used to disable the loading of
2493 * specific resources.
2495 * Notice that information about an eventual redirect is available
2496 * in @response's #SoupMessage, not in the #SoupMessage carried by
2497 * the @request. If @response is %NULL, then this is not a
2498 * redirected request.
2500 * The #WebKitWebResource object will be the same throughout all
2501 * the lifetime of the resource, but the contents may change from
2502 * inbetween signal emissions.
2506 webkit_web_view_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting",
2507 G_TYPE_FROM_CLASS(webViewClass),
2508 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2511 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT_OBJECT,
2513 WEBKIT_TYPE_WEB_FRAME,
2514 WEBKIT_TYPE_WEB_RESOURCE,
2515 WEBKIT_TYPE_NETWORK_REQUEST,
2516 WEBKIT_TYPE_NETWORK_RESPONSE);
2519 * WebKitWebView::geolocation-policy-decision-requested:
2520 * @web_view: the object on which the signal is emitted
2521 * @frame: the frame that requests permission
2522 * @policy_decision: a WebKitGeolocationPolicyDecision
2524 * This signal is emitted when a @frame wants to obtain the user's
2525 * location. The decision can be made asynchronously, but you must
2526 * call g_object_ref() the @policy_decision, and return %TRUE if
2527 * you are going to handle the request. To actually make the
2528 * decision you need to call webkit_geolocation_policy_allow() or
2529 * webkit_geolocation_policy_deny() on @policy_decision.
2533 webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-requested",
2534 G_TYPE_FROM_CLASS(webViewClass),
2535 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2538 webkit_marshal_BOOLEAN__OBJECT_OBJECT,
2540 WEBKIT_TYPE_WEB_FRAME,
2541 WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION);
2544 * WebKitWebView::geolocation-policy-decision-cancelled:
2545 * @web_view: the object on which the signal is emitted
2546 * @frame: the frame that cancels geolocation request.
2548 * When a @frame wants to cancel geolocation permission it had requested
2553 webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_CANCELLED] = g_signal_new("geolocation-policy-decision-cancelled",
2554 G_TYPE_FROM_CLASS(webViewClass),
2555 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2558 g_cclosure_marshal_VOID__OBJECT,
2560 WEBKIT_TYPE_WEB_FRAME);
2563 * DOM-related signals. These signals are experimental, for now,
2564 * and may change API and ABI. Their comments lack one * on
2565 * purpose, to make them not be catched by gtk-doc.
2569 * WebKitWebView::document-load-finished:
2570 * @web_view: the object which received the signal
2571 * @web_frame: the #WebKitWebFrame whose load dispatched this request
2573 * Emitted when the DOM document object load is finished for the
2576 webkit_web_view_signals[DOCUMENT_LOAD_FINISHED] = g_signal_new("document-load-finished",
2577 G_TYPE_FROM_CLASS(webViewClass),
2578 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2581 g_cclosure_marshal_VOID__OBJECT,
2583 WEBKIT_TYPE_WEB_FRAME);
2586 * WebKitWebView::frame-created:
2587 * @web_view: the object which received the signal
2588 * @web_frame: the #WebKitWebFrame which was just created.
2590 * Emitted when a WebKitWebView has created a new frame. This signal will
2591 * be emitted for all sub-frames created during page load. It will not be
2592 * emitted for the main frame, which originates in the WebKitWebView constructor
2593 * and may be accessed at any time using webkit_web_view_get_main_frame.
2597 webkit_web_view_signals[FRAME_CREATED] = g_signal_new("frame-created",
2598 G_TYPE_FROM_CLASS(webViewClass),
2599 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2602 g_cclosure_marshal_VOID__OBJECT,
2604 WEBKIT_TYPE_WEB_FRAME);
2606 webkit_web_view_signals[SHOULD_BEGIN_EDITING] = g_signal_new("should-begin-editing",
2607 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2608 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2609 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2611 webkit_web_view_signals[SHOULD_END_EDITING] = g_signal_new("should-end-editing", G_TYPE_FROM_CLASS(webViewClass),
2612 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2613 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2614 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2616 webkit_web_view_signals[SHOULD_INSERT_NODE] = g_signal_new("should-insert-node", G_TYPE_FROM_CLASS(webViewClass),
2617 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2618 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2619 webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM, G_TYPE_BOOLEAN,
2620 3, WEBKIT_TYPE_DOM_NODE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2622 webkit_web_view_signals[SHOULD_INSERT_TEXT] = g_signal_new("should-insert-text", G_TYPE_FROM_CLASS(webViewClass),
2623 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2624 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2625 webkit_marshal_BOOLEAN__STRING_OBJECT_ENUM, G_TYPE_BOOLEAN,
2626 3, G_TYPE_STRING, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2628 webkit_web_view_signals[SHOULD_DELETE_RANGE] = g_signal_new("should-delete-range", G_TYPE_FROM_CLASS(webViewClass),
2629 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2630 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2631 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2633 webkit_web_view_signals[SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT] = g_signal_new("should-show-delete-interface-for-element",
2634 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2635 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2636 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2638 webkit_web_view_signals[SHOULD_CHANGE_SELECTED_RANGE] = g_signal_new("should-change-selected-range",
2639 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2640 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2641 webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM_BOOLEAN, G_TYPE_BOOLEAN,
2642 4, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_SELECTION_AFFINITY, G_TYPE_BOOLEAN);
2644 webkit_web_view_signals[SHOULD_APPLY_STYLE] = g_signal_new("should-apply-style",
2645 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2646 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2647 webkit_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN,
2648 2, WEBKIT_TYPE_DOM_CSS_STYLE_DECLARATION, WEBKIT_TYPE_DOM_RANGE);
2650 webkit_web_view_signals[EDITING_BEGAN] = g_signal_new("editing-began",
2651 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2652 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2654 webkit_web_view_signals[USER_CHANGED_CONTENTS] = g_signal_new("user-changed-contents",
2655 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2656 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2658 webkit_web_view_signals[EDITING_ENDED] = g_signal_new("editing-ended",
2659 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2660 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2662 webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed",
2663 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2664 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2667 * WebKitWebView::viewport-attributes-recompute-requested
2668 * @web_view: the object which received the signal
2669 * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2671 * The #WebKitWebView::viewport-attributes-recompute-requested
2672 * signal will be emitted when a page with a viewport meta tag
2673 * loads and when webkit_viewport_attributes_recompute is called.
2675 * The #WebKitViewportAttributes will have device size, available size,
2676 * desktop width, and device DPI pre-filled by values that make sense
2677 * for the current screen and widget, but you can override those values
2678 * if you have special requirements (for instance, if you made your
2679 * widget bigger than the available visible area, you should override
2680 * the available-width and available-height properties to the actual
2685 webkit_web_view_signals[VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED] = g_signal_new("viewport-attributes-recompute-requested",
2686 G_TYPE_FROM_CLASS(webViewClass),
2687 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2690 g_cclosure_marshal_VOID__OBJECT,
2692 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2695 * WebKitWebView::viewport-attributes-changed
2696 * @web_view: the object which received the signal
2697 * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2699 * The #WebKitWebView::viewport-attributes-changed signal will be emitted
2700 * after the emission of #WebKitWebView::viewport-attributes-recompute-requested
2701 * and the subsequent viewport attribute recomputation. At this point,
2702 * if the #WebKitViewportAttributes are valid, the viewport attributes are available.
2706 webkit_web_view_signals[VIEWPORT_ATTRIBUTES_CHANGED] = g_signal_new("viewport-attributes-changed",
2707 G_TYPE_FROM_CLASS(webViewClass),
2708 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2711 g_cclosure_marshal_VOID__OBJECT,
2713 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2716 * WebKitWebView::entering-fullscreen:
2717 * @web_view: the #WebKitWebView on which the signal is emitted.
2718 * @element: the #WebKitDOMHTMLElement which has requested full screen display.
2720 * Emitted when JavaScript code calls
2721 * <function>element.webkitRequestFullScreen</function>. If the
2722 * signal is not handled the WebView will proceed to full screen
2723 * its top level window. This signal can be used by client code to
2724 * request permission to the user prior doing the full screen
2725 * transition and eventually prepare the top-level window
2726 * (e.g. hide some widgets that would otherwise be part of the
2727 * full screen window).
2729 * Returns: %TRUE to stop other handlers from being invoked for the event.
2730 * %FALSE to continue emission of the event.
2734 webkit_web_view_signals[ENTERING_FULLSCREEN] =
2735 g_signal_new("entering-fullscreen",
2736 G_TYPE_FROM_CLASS(webViewClass),
2738 G_STRUCT_OFFSET(WebKitWebViewClass, entering_fullscreen),
2739 g_signal_accumulator_true_handled, 0,
2740 webkit_marshal_BOOLEAN__OBJECT,
2741 G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2745 * WebKitWebView::leaving-fullscreen:
2746 * @web_view: the #WebKitWebView on which the signal is emitted.
2747 * @element: the #WebKitDOMHTMLElement which is currently displayed full screen.
2749 * Emitted when the WebView is about to restore its top level
2750 * window out of its full screen state. This signal can be used by
2751 * client code to restore widgets hidden during the
2752 * entering-fullscreen stage for instance.
2754 * Returns: %TRUE to stop other handlers from being invoked for the event.
2755 * %FALSE to continue emission of the event.
2759 webkit_web_view_signals[LEAVING_FULLSCREEN] =
2760 g_signal_new("leaving-fullscreen",
2761 G_TYPE_FROM_CLASS(webViewClass),
2763 G_STRUCT_OFFSET(WebKitWebViewClass, leaving_fullscreen),
2764 g_signal_accumulator_true_handled, 0,
2765 webkit_marshal_BOOLEAN__OBJECT,
2766 G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2769 * WebKitWebView::resource-response-received:
2770 * @web_view: the object which received the signal
2771 * @web_frame: the #WebKitWebFrame the response was received for
2772 * @web_resource: the #WebKitWebResource being loaded
2773 * @response: the #WebKitNetworkResponse that was received
2775 * Emitted when the first byte of data arrives
2779 webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received",
2780 G_TYPE_FROM_CLASS(webViewClass),
2784 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT,
2786 WEBKIT_TYPE_WEB_FRAME,
2787 WEBKIT_TYPE_WEB_RESOURCE,
2788 WEBKIT_TYPE_NETWORK_RESPONSE);
2791 * WebKitWebView::resource-load-finished:
2792 * @web_view: the object which received the signal
2793 * @web_frame: the #WebKitWebFrame the response was received for
2794 * @web_resource: the #WebKitWebResource that was loaded
2796 * Emitted when all the data for the resource was loaded
2800 webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished",
2801 G_TYPE_FROM_CLASS(webViewClass),
2805 webkit_marshal_VOID__OBJECT_OBJECT,
2807 WEBKIT_TYPE_WEB_FRAME,
2808 WEBKIT_TYPE_WEB_RESOURCE);
2811 * WebKitWebView::resource-content-length-received:
2812 * @web_view: the object which received the signal
2813 * @web_frame: the #WebKitWebFrame the response was received for
2814 * @web_resource: the #WebKitWebResource that was loaded
2815 * @length_received: the amount of data received since the last signal emission
2817 * Emitted when new resource data has been received. The
2818 * @length_received variable stores the amount of bytes received
2819 * since the last time this signal was emitted. This is useful to
2820 * provide progress information about the resource load operation.
2824 webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received",
2825 G_TYPE_FROM_CLASS(webViewClass),
2829 webkit_marshal_VOID__OBJECT_OBJECT_INT,
2831 WEBKIT_TYPE_WEB_FRAME,
2832 WEBKIT_TYPE_WEB_RESOURCE,
2836 * WebKitWebView::resource-load-failed:
2837 * @web_view: the object which received the signal
2838 * @web_frame: the #WebKitWebFrame the response was received for
2839 * @web_resource: the #WebKitWebResource that was loaded
2840 * @error: the #GError that was triggered
2842 * Invoked when a resource failed to load
2846 webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed",
2847 G_TYPE_FROM_CLASS(webViewClass),
2851 webkit_marshal_VOID__OBJECT_OBJECT_BOXED,
2853 WEBKIT_TYPE_WEB_FRAME,
2854 WEBKIT_TYPE_WEB_RESOURCE,
2858 * WebKitWebView::context-menu:
2859 * @web_view: the object which received the signal
2860 * @default_menu: the default context menu
2861 * @hit_test_result: a #WebKitHitTestResult with the context of the current position.
2862 * @triggered_with_keyboard: %TRUE if the context menu was triggered using the keyboard
2864 * Emmited when a context menu is about to be displayed to give the application
2865 * a chance to create and handle its own context menu. If you only want to add custom
2866 * options to the default context menu you can simply modify the given @default_menu.
2868 * When @triggered_with_keyboard is %TRUE the coordinates of the given @hit_test_result should be
2869 * used to position the popup menu. When the context menu has been triggered by a
2870 * mouse event you could either use the @hit_test_result coordinates or pass %NULL
2871 * to the #GtkMenuPositionFunc parameter of gtk_menu_popup() function.
2872 * Note that coordinates of @hit_test_result are relative to @web_view window.
2874 * If your application will create and display its own popup menu, %TRUE should be returned.
2875 * Note that when the context menu is handled by the application, the #WebKitWebSettings:enable-default-context-menu
2876 * setting will be ignored and the #WebKitWebView::populate-popup signal won't be emitted.
2877 * If you don't want any context menu to be shown, you can simply connect to this signal
2878 * and return %TRUE without doing anything else.
2882 webkit_web_view_signals[CONTEXT_MENU] = g_signal_new("context-menu",
2883 G_TYPE_FROM_CLASS(webViewClass),
2886 webkit_marshal_BOOLEAN__OBJECT_OBJECT_BOOLEAN,
2889 WEBKIT_TYPE_HIT_TEST_RESULT,
2893 * implementations of virtual methods
2895 webViewClass->create_web_view = webkit_web_view_real_create_web_view;
2896 webViewClass->web_view_ready = webkit_web_view_real_web_view_ready;
2897 webViewClass->close_web_view = webkit_web_view_real_close_web_view;
2898 webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
2899 webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
2900 webViewClass->choose_file = webkit_web_view_real_choose_file;
2901 webViewClass->script_alert = webkit_web_view_real_script_alert;
2902 webViewClass->script_confirm = webkit_web_view_real_script_confirm;
2903 webViewClass->script_prompt = webkit_web_view_real_script_prompt;
2904 webViewClass->console_message = webkit_web_view_real_console_message;
2905 webViewClass->select_all = webkit_web_view_real_select_all;
2906 webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard;
2907 webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard;
2908 webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
2909 webViewClass->undo = webkit_web_view_real_undo;
2910 webViewClass->redo = webkit_web_view_real_redo;
2911 webViewClass->move_cursor = webkit_web_view_real_move_cursor;
2912 webViewClass->should_allow_editing_action = webkit_web_view_real_should_allow_editing_action;
2913 webViewClass->entering_fullscreen = webkit_web_view_real_entering_fullscreen;
2914 webViewClass->leaving_fullscreen = webkit_web_view_real_leaving_fullscreen;
2916 GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
2917 objectClass->dispose = webkit_web_view_dispose;
2918 objectClass->finalize = webkit_web_view_finalize;
2919 objectClass->get_property = webkit_web_view_get_property;
2920 objectClass->set_property = webkit_web_view_set_property;
2922 GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass);
2923 widgetClass->realize = webkit_web_view_realize;
2924 #ifdef GTK_API_VERSION_2
2925 widgetClass->expose_event = webkit_web_view_expose_event;
2927 widgetClass->draw = webkit_web_view_draw;
2929 widgetClass->key_press_event = webkit_web_view_key_press_event;
2930 widgetClass->key_release_event = webkit_web_view_key_release_event;
2931 widgetClass->button_press_event = webkit_web_view_button_press_event;
2932 widgetClass->button_release_event = webkit_web_view_button_release_event;
2933 widgetClass->motion_notify_event = webkit_web_view_motion_event;
2934 widgetClass->scroll_event = webkit_web_view_scroll_event;
2935 widgetClass->size_allocate = webkit_web_view_size_allocate;
2936 #ifdef GTK_API_VERSION_2
2937 widgetClass->size_request = webkit_web_view_size_request;
2939 widgetClass->get_preferred_width = webkit_web_view_get_preferred_width;
2940 widgetClass->get_preferred_height = webkit_web_view_get_preferred_height;
2942 #if ENABLE(CONTEXT_MENUS)
2943 widgetClass->popup_menu = webkit_web_view_popup_menu_handler;
2945 widgetClass->popup_menu = NULL;
2947 widgetClass->grab_focus = webkit_web_view_grab_focus;
2948 widgetClass->focus_in_event = webkit_web_view_focus_in_event;
2949 widgetClass->focus_out_event = webkit_web_view_focus_out_event;
2950 widgetClass->get_accessible = webkit_web_view_get_accessible;
2951 widgetClass->screen_changed = webkit_web_view_screen_changed;
2952 widgetClass->drag_end = webkit_web_view_drag_end;
2953 widgetClass->drag_data_get = webkit_web_view_drag_data_get;
2954 widgetClass->drag_motion = webkit_web_view_drag_motion;
2955 widgetClass->drag_leave = webkit_web_view_drag_leave;
2956 widgetClass->drag_drop = webkit_web_view_drag_drop;
2957 widgetClass->drag_data_received = webkit_web_view_drag_data_received;
2958 #if GTK_CHECK_VERSION(2, 12, 0)
2959 widgetClass->query_tooltip = webkit_web_view_query_tooltip;
2960 widgetClass->show_help = webkit_web_view_show_help;
2962 widgetClass->map = webkitWebViewMap;
2964 GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass);
2965 containerClass->add = webkit_web_view_container_add;
2966 containerClass->remove = webkit_web_view_container_remove;
2967 containerClass->forall = webkit_web_view_container_forall;
2970 * make us scrollable (e.g. addable to a GtkScrolledWindow)
2972 #ifdef GTK_API_VERSION_2
2973 webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
2974 GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
2975 G_TYPE_FROM_CLASS(webViewClass),
2976 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2977 G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments),
2979 webkit_marshal_VOID__OBJECT_OBJECT,
2981 GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
2983 g_object_class_override_property(objectClass, PROP_HADJUSTMENT, "hadjustment");
2984 g_object_class_override_property(objectClass, PROP_VADJUSTMENT, "vadjustment");
2985 g_object_class_override_property(objectClass, PROP_HSCROLL_POLICY, "hscroll-policy");
2986 g_object_class_override_property(objectClass, PROP_VSCROLL_POLICY, "vscroll-policy");
2993 binding_set = gtk_binding_set_by_class(webViewClass);
2995 gtk_binding_entry_add_signal(binding_set, GDK_a, GDK_CONTROL_MASK,
2998 /* Cut/copy/paste */
3000 gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK,
3001 "cut_clipboard", 0);
3002 gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK,
3003 "copy_clipboard", 0);
3004 gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK,
3005 "paste_clipboard", 0);
3006 gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK,
3008 gtk_binding_entry_add_signal(binding_set, GDK_z, static_cast<GdkModifierType>(GDK_CONTROL_MASK | GDK_SHIFT_MASK),
3011 gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK,
3012 "cut_clipboard", 0);
3013 gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK,
3014 "copy_clipboard", 0);
3015 gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK,
3016 "paste_clipboard", 0);
3020 gtk_binding_entry_add_signal(binding_set, GDK_Down, static_cast<GdkModifierType>(0),
3022 G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
3024 gtk_binding_entry_add_signal(binding_set, GDK_Up, static_cast<GdkModifierType>(0),
3026 G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
3028 gtk_binding_entry_add_signal(binding_set, GDK_Right, static_cast<GdkModifierType>(0),
3030 G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
3032 gtk_binding_entry_add_signal(binding_set, GDK_Left, static_cast<GdkModifierType>(0),
3034 G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
3036 gtk_binding_entry_add_signal(binding_set, GDK_space, static_cast<GdkModifierType>(0),
3038 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3040 gtk_binding_entry_add_signal(binding_set, GDK_space, GDK_SHIFT_MASK,
3042 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3044 gtk_binding_entry_add_signal(binding_set, GDK_Page_Down, static_cast<GdkModifierType>(0),
3046 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3048 gtk_binding_entry_add_signal(binding_set, GDK_Page_Up, static_cast<GdkModifierType>(0),
3050 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
3052 gtk_binding_entry_add_signal(binding_set, GDK_End, static_cast<GdkModifierType>(0),
3054 G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
3056 gtk_binding_entry_add_signal(binding_set, GDK_Home, static_cast<GdkModifierType>(0),
3058 G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
3066 * WebKitWebView:title:
3068 * Returns: the @web_view's document title.
3072 g_object_class_install_property(objectClass, PROP_TITLE,
3073 g_param_spec_string("title",
3075 _("Returns the @web_view's document title"),
3077 WEBKIT_PARAM_READABLE));
3080 * WebKitWebView:uri:
3082 * Returns: the current URI of the contents displayed by the @web_view.
3086 g_object_class_install_property(objectClass, PROP_URI,
3087 g_param_spec_string("uri",
3089 _("Returns the current URI of the contents displayed by the @web_view"),
3091 WEBKIT_PARAM_READABLE));
3094 * WebKitWebView:copy-target-list:
3096 * The list of targets this web view supports for clipboard copying.
3100 g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST,
3101 g_param_spec_boxed("copy-target-list",
3102 _("Copy target list"),
3103 _("The list of targets this web view supports for clipboard copying"),
3104 GTK_TYPE_TARGET_LIST,
3105 WEBKIT_PARAM_READABLE));
3108 * WebKitWebView:paste-target-list:
3110 * The list of targets this web view supports for clipboard pasting.
3114 g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST,
3115 g_param_spec_boxed("paste-target-list",
3116 _("Paste target list"),
3117 _("The list of targets this web view supports for clipboard pasting"),
3118 GTK_TYPE_TARGET_LIST,
3119 WEBKIT_PARAM_READABLE));
3121 g_object_class_install_property(objectClass, PROP_SETTINGS,
3122 g_param_spec_object("settings",
3124 _("An associated WebKitWebSettings instance"),
3125 WEBKIT_TYPE_WEB_SETTINGS,
3126 WEBKIT_PARAM_READWRITE));
3129 * WebKitWebView:web-inspector:
3131 * The associated WebKitWebInspector instance.
3135 g_object_class_install_property(objectClass, PROP_WEB_INSPECTOR,
3136 g_param_spec_object("web-inspector",
3138 _("The associated WebKitWebInspector instance"),
3139 WEBKIT_TYPE_WEB_INSPECTOR,
3140 WEBKIT_PARAM_READABLE));
3143 * WebKitWebView:viewport-attributes:
3145 * The associated #WebKitViewportAttributes instance.
3149 g_object_class_install_property(objectClass, PROP_VIEWPORT_ATTRIBUTES,
3150 g_param_spec_object("viewport-attributes",
3151 _("Viewport Attributes"),
3152 _("The associated WebKitViewportAttributes instance"),
3153 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES,
3154 WEBKIT_PARAM_READABLE));
3157 * WebKitWebView:window-features:
3159 * An associated WebKitWebWindowFeatures instance.
3163 g_object_class_install_property(objectClass, PROP_WINDOW_FEATURES,
3164 g_param_spec_object("window-features",
3166 "An associated WebKitWebWindowFeatures instance",
3167 WEBKIT_TYPE_WEB_WINDOW_FEATURES,
3168 WEBKIT_PARAM_READWRITE));
3170 g_object_class_install_property(objectClass, PROP_EDITABLE,
3171 g_param_spec_boolean("editable",
3173 _("Whether content can be modified by the user"),
3175 WEBKIT_PARAM_READWRITE));
3177 g_object_class_install_property(objectClass, PROP_TRANSPARENT,
3178 g_param_spec_boolean("transparent",
3180 _("Whether content has a transparent background"),
3182 WEBKIT_PARAM_READWRITE));
3185 * WebKitWebView:zoom-level:
3187 * The level of zoom of the content.
3191 g_object_class_install_property(objectClass, PROP_ZOOM_LEVEL,
3192 g_param_spec_float("zoom-level",
3194 _("The level of zoom of the content"),
3198 WEBKIT_PARAM_READWRITE));
3201 * WebKitWebView:full-content-zoom:
3203 * Whether the full content is scaled when zooming.
3207 g_object_class_install_property(objectClass, PROP_FULL_CONTENT_ZOOM,
3208 g_param_spec_boolean("full-content-zoom",
3209 _("Full content zoom"),
3210 _("Whether the full content is scaled when zooming"),
3212 WEBKIT_PARAM_READWRITE));
3215 * WebKitWebView:encoding:
3217 * The default encoding of the web view.
3221 g_object_class_install_property(objectClass, PROP_ENCODING,
3222 g_param_spec_string("encoding",
3224 _("The default encoding of the web view"),
3226 WEBKIT_PARAM_READABLE));
3229 * WebKitWebView:custom-encoding:
3231 * The custom encoding of the web view.
3235 g_object_class_install_property(objectClass, PROP_CUSTOM_ENCODING,
3236 g_param_spec_string("custom-encoding",
3237 _("Custom Encoding"),
3238 _("The custom encoding of the web view"),
3240 WEBKIT_PARAM_READWRITE));
3243 * WebKitWebView:load-status:
3245 * Determines the current status of the load.
3247 * Connect to "notify::load-status" to monitor loading.
3249 * Some versions of WebKitGTK+ emitted this signal for the default
3250 * error page, while loading it. This behavior was considered bad,
3251 * because it was essentially exposing an implementation
3252 * detail. From 1.1.19 onwards this signal is no longer emitted for
3253 * the default error pages, but keep in mind that if you override
3254 * the error pages by using webkit_web_frame_load_alternate_string()
3255 * the signals will be emitted.
3259 g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
3260 g_param_spec_enum("load-status",
3262 "Determines the current status of the load",
3263 WEBKIT_TYPE_LOAD_STATUS,
3264 WEBKIT_LOAD_FINISHED,
3265 WEBKIT_PARAM_READABLE));
3268 * WebKitWebView:progress:
3270 * Determines the current progress of the load.
3274 g_object_class_install_property(objectClass, PROP_PROGRESS,
3275 g_param_spec_double("progress",
3277 "Determines the current progress of the load",
3279 WEBKIT_PARAM_READABLE));
3282 * WebKitWebView:icon-uri:
3284 * The URI for the favicon for the #WebKitWebView.
3288 g_object_class_install_property(objectClass, PROP_ICON_URI,
3289 g_param_spec_string("icon-uri",
3291 _("The URI for the favicon for the #WebKitWebView."),