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>
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2 of the License, or (at your option) any later version.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
31 #include "webkitwebview.h"
33 #include "AXObjectCache.h"
34 #include "AbstractDatabase.h"
35 #include "BackForwardListImpl.h"
36 #include "CairoUtilities.h"
38 #include "ChromeClientGtk.h"
39 #include "ClipboardUtilitiesGtk.h"
40 #include "ContextMenu.h"
41 #include "ContextMenuClientGtk.h"
42 #include "ContextMenuController.h"
45 #include "DocumentLoader.h"
46 #include "DragActions.h"
47 #include "DragClientGtk.h"
48 #include "DragController.h"
50 #include "DragSession.h"
51 #include "DumpRenderTreeSupportGtk.h"
53 #include "EditorClientGtk.h"
54 #include "EventHandler.h"
55 #include "FloatQuad.h"
56 #include "FocusController.h"
57 #include "FrameLoader.h"
58 #include "FrameLoaderClient.h"
59 #include "FrameLoaderTypes.h"
60 #include "FrameView.h"
61 #include "GeolocationClientGtk.h"
62 #include "GeolocationClientMock.h"
63 #include "GOwnPtrGtk.h"
64 #include "GraphicsContext.h"
65 #include "GtkUtilities.h"
66 #include "GtkVersioning.h"
67 #include "HTMLNames.h"
68 #include "HitTestRequest.h"
69 #include "HitTestResult.h"
70 #include "IconDatabase.h"
71 #include "InspectorClientGtk.h"
72 #include "MemoryCache.h"
73 #include "MouseEventWithHitTestResults.h"
74 #include "NotImplemented.h"
75 #include "PageCache.h"
76 #include "Pasteboard.h"
77 #include "PasteboardHelper.h"
78 #include "PlatformKeyboardEvent.h"
79 #include "PlatformWheelEvent.h"
80 #include "ProgressTracker.h"
81 #include "RenderView.h"
82 #include "ResourceHandle.h"
83 #include "ScriptValue.h"
85 #include "webkit/WebKitDOMDocumentPrivate.h"
86 #include "webkitdownload.h"
87 #include "webkitdownloadprivate.h"
88 #include "webkitenumtypes.h"
89 #include "webkitgeolocationpolicydecision.h"
90 #include "webkitglobalsprivate.h"
91 #include "webkithittestresultprivate.h"
92 #include "webkiticondatabase.h"
93 #include "webkitmarshal.h"
94 #include "webkitnetworkrequest.h"
95 #include "webkitnetworkresponse.h"
96 #include "webkitviewportattributes.h"
97 #include "webkitviewportattributesprivate.h"
98 #include "webkitwebbackforwardlist.h"
99 #include "webkitwebframeprivate.h"
100 #include "webkitwebhistoryitem.h"
101 #include "webkitwebhistoryitemprivate.h"
102 #include "webkitwebinspector.h"
103 #include "webkitwebinspectorprivate.h"
104 #include "webkitwebpolicydecision.h"
105 #include "webkitwebresource.h"
106 #include "webkitwebsettingsprivate.h"
107 #include "webkitwebplugindatabaseprivate.h"
108 #include "webkitwebwindowfeatures.h"
109 #include "webkitwebviewprivate.h"
110 #include <gdk/gdkkeysyms.h>
111 #include <glib/gi18n-lib.h>
112 #include <wtf/gobject/GOwnPtr.h>
113 #include <wtf/text/CString.h>
115 #if ENABLE(DEVICE_ORIENTATION)
116 #include "DeviceMotionClientGtk.h"
117 #include "DeviceOrientationClientGtk.h"
121 * SECTION:webkitwebview
122 * @short_description: The central class of the WebKitGTK+ API
123 * @see_also: #WebKitWebSettings, #WebKitWebFrame
125 * #WebKitWebView is the central class of the WebKitGTK+ API. It is a
126 * #GtkWidget implementing the scrolling interface which means you can
127 * embed in a #GtkScrolledWindow. It is responsible for managing the
128 * drawing of the content, forwarding of events. You can load any URI
129 * into the #WebKitWebView or any kind of data string. With #WebKitWebSettings
130 * you can control various aspects of the rendering and loading of the content.
131 * Each #WebKitWebView has exactly one #WebKitWebFrame as main frame. A
132 * #WebKitWebFrame can have n children.
135 * /<!-- -->* Create the widgets *<!-- -->/
136 * GtkWidget *main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
137 * GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
138 * GtkWidget *web_view = webkit_web_view_new ();
140 * /<!-- -->* Place the WebKitWebView in the GtkScrolledWindow *<!-- -->/
141 * gtk_container_add (GTK_CONTAINER (scrolled_window), web_view);
142 * gtk_container_add (GTK_CONTAINER (main_window), scrolled_window);
144 * /<!-- -->* Open a webpage *<!-- -->/
145 * webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), "http://www.gnome.org");
147 * /<!-- -->* Show the result *<!-- -->/
148 * gtk_window_set_default_size (GTK_WINDOW (main_window), 800, 600);
149 * gtk_widget_show_all (main_window);
153 using namespace WebKit;
154 using namespace WebCore;
158 NAVIGATION_REQUESTED,
159 NEW_WINDOW_POLICY_DECISION_REQUESTED,
160 NAVIGATION_POLICY_DECISION_REQUESTED,
161 MIME_TYPE_POLICY_DECISION_REQUESTED,
164 WINDOW_OBJECT_CLEARED,
167 LOAD_PROGRESS_CHANGED,
173 STATUS_BAR_TEXT_CHANGED,
191 DATABASE_QUOTA_EXCEEDED,
192 RESOURCE_REQUEST_STARTING,
193 DOCUMENT_LOAD_FINISHED,
194 GEOLOCATION_POLICY_DECISION_REQUESTED,
195 GEOLOCATION_POLICY_DECISION_CANCELLED,
198 SHOULD_BEGIN_EDITING,
203 SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT,
204 SHOULD_CHANGE_SELECTED_RANGE,
207 USER_CHANGED_CONTENTS,
209 VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED,
210 VIEWPORT_ATTRIBUTES_CHANGED,
211 RESOURCE_RESPONSE_RECEIVED,
212 RESOURCE_LOAD_FINISHED,
213 RESOURCE_CONTENT_LENGTH_RECEIVED,
214 RESOURCE_LOAD_FAILED,
226 PROP_COPY_TARGET_LIST,
227 PROP_PASTE_TARGET_LIST,
231 PROP_VIEWPORT_ATTRIBUTES,
232 PROP_WINDOW_FEATURES,
235 PROP_FULL_CONTENT_ZOOM,
239 PROP_CUSTOM_ENCODING,
242 #ifdef GTK_API_VERSION_2
252 // Undocumented. Leave these properties at the end of the list
253 // so that we can remove them without breaking ABI compatibility.
257 static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
259 #ifdef GTK_API_VERSION_2
260 G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
262 G_DEFINE_TYPE_WITH_CODE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER,
263 G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, 0))
266 static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
267 static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
269 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView*);
271 static void PopupMenuPositionFunc(GtkMenu* menu, gint *x, gint *y, gboolean *pushIn, gpointer userData)
273 WebKitWebView* view = WEBKIT_WEB_VIEW(userData);
274 WebKitWebViewPrivate* priv = view->priv;
275 GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(view));
276 GtkRequisition menuSize;
278 #ifdef GTK_API_VERSION_2
279 gtk_widget_size_request(GTK_WIDGET(menu), &menuSize);
281 gtk_widget_get_preferred_size(GTK_WIDGET(menu), &menuSize, NULL);
284 *x = priv->lastPopupXPosition;
285 if ((*x + menuSize.width) >= gdk_screen_get_width(screen))
286 *x -= menuSize.width;
288 *y = priv->lastPopupYPosition;
289 if ((*y + menuSize.height) >= gdk_screen_get_height(screen))
290 *y -= menuSize.height;
295 static Node* getFocusedNode(Frame* frame)
297 if (Document* doc = frame->document())
298 return doc->focusedNode();
302 static void contextMenuItemActivated(GtkMenuItem* item, ContextMenuController* controller)
304 ContextMenuItem contextItem(item);
305 controller->contextMenuItemSelected(&contextItem);
308 static void contextMenuConnectActivate(GtkMenuItem* item, ContextMenuController* controller)
310 if (GTK_IS_SEPARATOR_MENU_ITEM(item))
313 if (GtkWidget* menu = gtk_menu_item_get_submenu(item)) {
314 gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback)contextMenuConnectActivate, controller);
318 g_signal_connect(item, "activate", G_CALLBACK(contextMenuItemActivated), controller);
321 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event)
323 Page* page = core(webView);
324 page->contextMenuController()->clearContextMenu();
326 Frame* mainFrame = page->mainFrame();
327 gboolean mousePressEventResult = FALSE;
329 if (!mainFrame->view())
332 mainFrame->view()->setCursor(pointerCursor());
333 if (page->frameCount()) {
334 HitTestRequest request(HitTestRequest::Active);
335 IntPoint point = mainFrame->view()->windowToContents(event.position());
336 MouseEventWithHitTestResults mev = mainFrame->document()->prepareMouseEvent(request, point, event);
338 Frame* targetFrame = EventHandler::subframeForHitTestResult(mev);
340 targetFrame = mainFrame;
342 focusedFrame = page->focusController()->focusedOrMainFrame();
343 if (targetFrame != focusedFrame) {
344 page->focusController()->setFocusedFrame(targetFrame);
345 focusedFrame = targetFrame;
348 focusedFrame = mainFrame;
350 if (focusedFrame->view() && focusedFrame->eventHandler()->handleMousePressEvent(event))
351 mousePressEventResult = TRUE;
354 bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(event);
358 // If coreMenu is NULL, this means WebCore decided to not create
359 // the default context menu; this may happen when the page is
360 // handling the right-click for reasons other than the context menu.
361 ContextMenuController* controller = page->contextMenuController();
362 ContextMenu* coreMenu = controller->contextMenu();
364 return mousePressEventResult;
366 // If we reach here, it's because WebCore is going to show the
367 // default context menu. We check our setting to figure out
368 // whether we want it or not.
369 WebKitWebSettings* settings = webkit_web_view_get_settings(webView);
370 gboolean enableDefaultContextMenu;
371 g_object_get(settings, "enable-default-context-menu", &enableDefaultContextMenu, NULL);
373 if (!enableDefaultContextMenu)
376 GtkMenu* menu = GTK_MENU(coreMenu->platformDescription());
380 // We connect the "activate" signal here rather than in ContextMenuGtk to avoid
381 // a layering violation. ContextMenuGtk should not know about the ContextMenuController.
382 gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback)contextMenuConnectActivate, controller);
384 g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, menu);
386 // If the context menu is now empty, don't show it.
387 GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu)));
391 WebKitWebViewPrivate* priv = webView->priv;
392 priv->currentMenu = menu;
393 priv->lastPopupXPosition = event.globalPosition().x();
394 priv->lastPopupYPosition = event.globalPosition().y();
396 gtk_menu_popup(menu, 0, 0, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time());
400 static const int gContextMenuMargin = 1;
401 static IntPoint getLocationForKeyboardGeneratedContextMenu(Frame* frame)
403 FrameSelection* selection = frame->selection();
404 if (!selection->selection().isNonOrphanedCaretOrRange()
405 || (selection->selection().isCaret() && !selection->selection().isContentEditable())) {
406 if (Node* focusedNode = getFocusedNode(frame))
407 return focusedNode->getRect().location();
409 // There was no selection and no focused node, so just put the context
410 // menu into the corner of the view, offset slightly.
411 return IntPoint(gContextMenuMargin, gContextMenuMargin);
414 // selection->selection().firstRange can return 0 here, but if that was the case
415 // selection->selection().isNonOrphanedCaretOrRange() would have returned false
416 // above, so we do not have to check it.
417 IntRect firstRect = frame->editor()->firstRectForRange(selection->selection().firstRange().get());
418 return IntPoint(firstRect.x(), firstRect.maxY());
421 static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
423 Frame* frame = core(WEBKIT_WEB_VIEW(widget))->focusController()->focusedOrMainFrame();
424 IntPoint location = getLocationForKeyboardGeneratedContextMenu(frame);
426 FrameView* view = frame->view();
430 // Never let the context menu touch the very edge of the view.
431 location = view->contentsToWindow(location);
432 location.expandedTo(IntPoint(gContextMenuMargin, gContextMenuMargin));
433 location.shrunkTo(IntPoint(view->width() - gContextMenuMargin, view->height() - gContextMenuMargin));
435 IntPoint globalPoint(convertWidgetPointToScreenPoint(widget, location));
436 PlatformMouseEvent event(location, globalPoint, RightButton, PlatformEvent::MousePressed, 0, false, false, false, false, gtk_get_current_event_time());
437 return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
440 static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
442 // This may be called after the page has been destroyed, in which case we do nothing.
443 Page* page = core(webView);
445 static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setHorizontalAdjustment(adjustment);
448 static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
450 // This may be called after the page has been destroyed, in which case we do nothing.
451 Page* page = core(webView);
453 static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setVerticalAdjustment(adjustment);
456 #ifndef GTK_API_VERSION_2
457 static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
459 Page* page = core(webView);
461 return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->horizontalAdjustment();
465 static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView)
467 Page* page = core(webView);
469 return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->verticalAdjustment();
473 static void setHorizontalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
475 webView->priv->horizontalScrollingPolicy = policy;
476 gtk_widget_queue_resize(GTK_WIDGET(webView));
479 static void setVerticalScrollPolicy(WebKitWebView* webView, GtkScrollablePolicy policy)
481 webView->priv->verticalScrollingPolicy = policy;
482 gtk_widget_queue_resize(GTK_WIDGET(webView));
485 static GtkScrollablePolicy getHorizontalScrollPolicy(WebKitWebView* webView)
487 return webView->priv->horizontalScrollingPolicy;
490 static GtkScrollablePolicy getVerticalScrollPolicy(WebKitWebView* webView)
492 return webView->priv->verticalScrollingPolicy;
497 static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
499 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
503 g_value_set_string(value, webkit_web_view_get_title(webView));
506 g_value_set_string(value, webkit_web_view_get_uri(webView));
508 case PROP_COPY_TARGET_LIST:
509 g_value_set_boxed(value, webkit_web_view_get_copy_target_list(webView));
511 case PROP_PASTE_TARGET_LIST:
512 g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView));
515 g_value_set_boolean(value, webkit_web_view_get_editable(webView));
518 g_value_set_object(value, webkit_web_view_get_settings(webView));
520 case PROP_WEB_INSPECTOR:
521 g_value_set_object(value, webkit_web_view_get_inspector(webView));
523 case PROP_VIEWPORT_ATTRIBUTES:
524 g_value_set_object(value, webkit_web_view_get_viewport_attributes(webView));
526 case PROP_WINDOW_FEATURES:
527 g_value_set_object(value, webkit_web_view_get_window_features(webView));
529 case PROP_TRANSPARENT:
530 g_value_set_boolean(value, webkit_web_view_get_transparent(webView));
532 case PROP_ZOOM_LEVEL:
533 g_value_set_float(value, webkit_web_view_get_zoom_level(webView));
535 case PROP_FULL_CONTENT_ZOOM:
536 g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView));
539 g_value_set_string(value, webkit_web_view_get_encoding(webView));
541 case PROP_CUSTOM_ENCODING:
542 g_value_set_string(value, webkit_web_view_get_custom_encoding(webView));
544 case PROP_LOAD_STATUS:
545 g_value_set_enum(value, webkit_web_view_get_load_status(webView));
548 g_value_set_double(value, webkit_web_view_get_progress(webView));
551 g_value_set_string(value, webkit_web_view_get_icon_uri(webView));
553 case PROP_IM_CONTEXT:
554 g_value_set_object(value, webkit_web_view_get_im_context(webView));
557 g_value_set_enum(value, webkit_web_view_get_view_mode(webView));
559 #ifndef GTK_API_VERSION_2
560 case PROP_HADJUSTMENT:
561 g_value_set_object(value, getHorizontalAdjustment(webView));
563 case PROP_VADJUSTMENT:
564 g_value_set_object(value, getVerticalAdjustment(webView));
566 case PROP_HSCROLL_POLICY:
567 g_value_set_enum(value, getHorizontalScrollPolicy(webView));
569 case PROP_VSCROLL_POLICY:
570 g_value_set_enum(value, getVerticalScrollPolicy(webView));
573 case PROP_SELF_SCROLLING:
574 g_value_set_boolean(value, webView->priv->selfScrolling);
577 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
581 static void webkit_web_view_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec *pspec)
583 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
587 webkit_web_view_set_editable(webView, g_value_get_boolean(value));
590 webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value)));
592 case PROP_WINDOW_FEATURES:
593 webkit_web_view_set_window_features(webView, WEBKIT_WEB_WINDOW_FEATURES(g_value_get_object(value)));
595 case PROP_TRANSPARENT:
596 webkit_web_view_set_transparent(webView, g_value_get_boolean(value));
598 case PROP_ZOOM_LEVEL:
599 webkit_web_view_set_zoom_level(webView, g_value_get_float(value));
601 case PROP_FULL_CONTENT_ZOOM:
602 webkit_web_view_set_full_content_zoom(webView, g_value_get_boolean(value));
604 case PROP_CUSTOM_ENCODING:
605 webkit_web_view_set_custom_encoding(webView, g_value_get_string(value));
608 webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value)));
610 #ifndef GTK_API_VERSION_2
611 case PROP_HADJUSTMENT:
612 setHorizontalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
614 case PROP_VADJUSTMENT:
615 setVerticalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
617 case PROP_HSCROLL_POLICY:
618 setHorizontalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
620 case PROP_VSCROLL_POLICY:
621 setVerticalScrollPolicy(webView, static_cast<GtkScrollablePolicy>(g_value_get_enum(value)));
624 case PROP_SELF_SCROLLING:
625 webView->priv->selfScrolling = g_value_get_boolean(value);
628 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
632 #ifdef GTK_API_VERSION_2
633 static gboolean webkit_web_view_expose_event(GtkWidget* widget, GdkEventExpose* event)
636 GOwnPtr<GdkRectangle> rects;
637 gdk_region_get_rectangles(event->region, &rects.outPtr(), &rectCount);
639 RefPtr<cairo_t> cr = adoptRef(gdk_cairo_create(event->window));
640 for (int i = 0; i < rectCount; i++) {
641 copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(),
642 cr.get(), IntSize(), IntRect(rects.get()[i]));
645 // Chaining up to the parent forces child widgets to be drawn.
646 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->expose_event(widget, event);
650 static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr)
652 GdkRectangle clipRect;
653 if (!gdk_cairo_get_clip_rectangle(cr, &clipRect))
656 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
657 #if USE(TEXTURE_MAPPER_GL)
658 if (priv->acceleratedCompositingContext->renderLayersToWindow(clipRect))
662 cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr);
663 if (rectList->status || !rectList->num_rectangles) {
664 cairo_rectangle_list_destroy(rectList);
668 Vector<IntRect> rects;
669 for (int i = 0; i < rectList->num_rectangles; i++) {
670 copyRectFromCairoSurfaceToContext(priv->backingStore->cairoSurface(), cr, IntSize(),
671 enclosingIntRect(FloatRect(rectList->rectangles[i])));
673 cairo_rectangle_list_destroy(rectList);
675 // Chaining up to the parent forces child widgets to be drawn.
676 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->draw(widget, cr);
679 #endif // GTK_API_VERSION_2
681 static gboolean webkit_web_view_key_press_event(GtkWidget* widget, GdkEventKey* event)
683 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
685 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
686 PlatformKeyboardEvent keyboardEvent(event);
691 if (frame->eventHandler()->keyEvent(keyboardEvent))
694 /* Chain up to our parent class for binding activation */
695 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_press_event(widget, event);
698 static gboolean webkit_web_view_key_release_event(GtkWidget* widget, GdkEventKey* event)
700 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
702 // GTK+ IM contexts often require us to filter key release events, which
703 // WebCore does not do by default, so we filter the event here. We only block
704 // the event if we don't have a pending composition, because that means we
705 // are using a context like 'simple' which marks every keystroke as filtered.
706 WebKit::EditorClient* client = static_cast<WebKit::EditorClient*>(core(webView)->editorClient());
707 if (gtk_im_context_filter_keypress(webView->priv->imContext.get(), event) && !client->hasPendingComposition())
710 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
714 PlatformKeyboardEvent keyboardEvent(event);
715 if (frame->eventHandler()->keyEvent(keyboardEvent))
718 /* Chain up to our parent class for binding activation */
719 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->key_release_event(widget, event);
722 static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
724 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
725 WebKitWebViewPrivate* priv = webView->priv;
727 // FIXME: need to keep track of subframe focus for key events
728 gtk_widget_grab_focus(widget);
730 if (!priv->clickCounter.shouldProcessButtonEvent(event))
733 PlatformMouseEvent platformEvent(event);
734 int count = priv->clickCounter.clickCountForGdkButtonEvent(widget, event);
735 platformEvent.setClickCount(count);
737 if (event->button == 3)
738 return webkit_web_view_forward_context_menu_event(webView, PlatformMouseEvent(event));
740 Frame* frame = core(webView)->mainFrame();
744 gboolean result = frame->eventHandler()->handleMousePressEvent(platformEvent);
745 // Handle the IM context when a mouse press fires
746 static_cast<WebKit::EditorClient*>(core(webView)->editorClient())->handleInputMethodMousePress();
749 /* Copy selection to the X11 selection clipboard */
750 if (event->button == 2) {
751 PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
752 bool wasUsingPrimary = helper->usePrimarySelectionClipboard();
753 helper->setUsePrimarySelectionClipboard(true);
755 Editor* editor = webView->priv->corePage->focusController()->focusedOrMainFrame()->editor();
756 result = result || editor->canPaste() || editor->canDHTMLPaste();
759 helper->setUsePrimarySelectionClipboard(wasUsingPrimary);
766 static gboolean webkit_web_view_button_release_event(GtkWidget* widget, GdkEventButton* event)
768 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
770 Frame* focusedFrame = core(webView)->focusController()->focusedFrame();
772 if (focusedFrame && focusedFrame->editor()->canEdit()) {
774 WebKitWebViewPrivate* priv = webView->priv;
775 hildon_gtk_im_context_filter_event(priv->imContext.get(), (GdkEvent*)event);
779 Frame* mainFrame = core(webView)->mainFrame();
780 if (mainFrame->view())
781 mainFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
783 /* We always return FALSE here because WebKit can, for the same click, decide
784 * to not handle press-event but handle release-event, which can totally confuse
785 * some GTK+ containers when there are no other events in between. This way we
786 * guarantee that this case never happens, and that if press-event goes through
787 * release-event also goes through.
793 static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event)
795 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
797 Frame* frame = core(webView)->mainFrame();
801 return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event));
804 static gboolean webkit_web_view_scroll_event(GtkWidget* widget, GdkEventScroll* event)
806 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
808 Frame* frame = core(webView)->mainFrame();
812 PlatformWheelEvent wheelEvent(event);
813 return frame->eventHandler()->handleWheelEvent(wheelEvent);
816 #ifdef GTK_API_VERSION_2
817 static void webkit_web_view_size_request(GtkWidget* widget, GtkRequisition* requisition)
819 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
820 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
824 FrameView* view = coreFrame->view();
828 requisition->width = view->contentsWidth();
829 requisition->height = view->contentsHeight();
832 static void webkit_web_view_get_preferred_width(GtkWidget* widget, gint* minimum, gint* natural)
834 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
835 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
839 FrameView* view = coreFrame->view();
843 *minimum = *natural = view->contentsWidth();
846 static void webkit_web_view_get_preferred_height(GtkWidget* widget, gint* minimum, gint* natural)
848 WebKitWebView* web_view = WEBKIT_WEB_VIEW(widget);
849 Frame* coreFrame = core(webkit_web_view_get_main_frame(web_view));
853 FrameView* view = coreFrame->view();
857 *minimum = *natural = view->contentsHeight();
861 static void updateChildAllocationFromPendingAllocation(GtkWidget* child, void*)
863 if (!gtk_widget_get_visible(child))
866 GtkAllocation* allocation = static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(child), "delayed-allocation"));
870 g_object_set_data(G_OBJECT(child), "delayed-allocation", 0);
871 gtk_widget_size_allocate(child, allocation);
872 *allocation = IntRect();
875 static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* allocation)
877 Page* page = core(webView);
879 if (FrameView* frameView = page->mainFrame()->view()) {
880 oldSize = frameView->size();
881 frameView->resize(allocation->width, allocation->height);
884 gtk_container_forall(GTK_CONTAINER(webView), updateChildAllocationFromPendingAllocation, 0);
886 WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
887 chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height));
888 chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
890 #if USE(ACCELERATED_COMPOSITING)
891 webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height));
895 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
897 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
899 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
900 if (!gtk_widget_get_mapped(widget)) {
901 webView->priv->needsResizeOnMap = true;
904 resizeWebViewFromAllocation(webView, allocation);
907 static void webkitWebViewMap(GtkWidget* widget)
909 GTK_WIDGET_CLASS(webkit_web_view_parent_class)->map(widget);
911 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
912 if (!webView->priv->needsResizeOnMap)
915 GtkAllocation allocation;
916 gtk_widget_get_allocation(widget, &allocation);
917 resizeWebViewFromAllocation(webView, &allocation);
918 webView->priv->needsResizeOnMap = false;
921 static void webkit_web_view_grab_focus(GtkWidget* widget)
924 if (gtk_widget_is_sensitive(widget)) {
925 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
926 FocusController* focusController = core(webView)->focusController();
928 focusController->setActive(true);
930 if (focusController->focusedFrame())
931 focusController->setFocused(true);
933 focusController->setFocusedFrame(core(webView)->mainFrame());
936 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->grab_focus(widget);
939 static gboolean webkit_web_view_focus_in_event(GtkWidget* widget, GdkEventFocus* event)
941 // TODO: Improve focus handling as suggested in
942 // http://bugs.webkit.org/show_bug.cgi?id=16910
943 GtkWidget* toplevel = gtk_widget_get_toplevel(widget);
944 if (widgetIsOnscreenToplevelWindow(toplevel) && gtk_window_has_toplevel_focus(GTK_WINDOW(toplevel))) {
945 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
946 FocusController* focusController = core(webView)->focusController();
948 focusController->setActive(true);
950 if (focusController->focusedFrame())
951 focusController->setFocused(true);
953 focusController->setFocusedFrame(core(webView)->mainFrame());
955 if (focusController->focusedFrame()->editor()->canEdit())
956 gtk_im_context_focus_in(webView->priv->imContext.get());
958 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_in_event(widget, event);
961 static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus* event)
963 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
965 // We may hit this code while destroying the widget, and we might
966 // no longer have a page, then.
967 Page* page = core(webView);
969 page->focusController()->setActive(false);
970 page->focusController()->setFocused(false);
973 if (webView->priv->imContext)
974 gtk_im_context_focus_out(webView->priv->imContext.get());
976 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->focus_out_event(widget, event);
979 static void webkit_web_view_realize(GtkWidget* widget)
981 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
983 gtk_widget_set_realized(widget, TRUE);
985 GtkAllocation allocation;
986 #if GTK_CHECK_VERSION(2, 18, 0)
987 gtk_widget_get_allocation(widget, &allocation);
989 allocation = widget->allocation;
992 GdkWindowAttr attributes;
993 attributes.window_type = GDK_WINDOW_CHILD;
994 attributes.x = allocation.x;
995 attributes.y = allocation.y;
996 attributes.width = allocation.width;
997 attributes.height = allocation.height;
998 attributes.wclass = GDK_INPUT_OUTPUT;
999 attributes.visual = gtk_widget_get_visual(widget);
1000 #ifdef GTK_API_VERSION_2
1001 attributes.colormap = gtk_widget_get_colormap(widget);
1003 attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK
1005 | GDK_BUTTON_PRESS_MASK
1006 | GDK_BUTTON_RELEASE_MASK
1008 | GDK_POINTER_MOTION_MASK
1009 | GDK_KEY_PRESS_MASK
1010 | GDK_KEY_RELEASE_MASK
1011 | GDK_BUTTON_MOTION_MASK
1012 | GDK_BUTTON1_MOTION_MASK
1013 | GDK_BUTTON2_MOTION_MASK
1014 | GDK_BUTTON3_MOTION_MASK;
1016 gint attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
1017 #ifdef GTK_API_VERSION_2
1018 attributes_mask |= GDK_WA_COLORMAP;
1020 GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
1022 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL)
1023 priv->hasNativeWindow = gdk_window_ensure_native(window);
1025 gtk_widget_set_window(widget, window);
1026 gdk_window_set_user_data(window, widget);
1028 #ifdef GTK_API_VERSION_2
1029 #if GTK_CHECK_VERSION(2, 20, 0)
1030 gtk_widget_style_attach(widget);
1032 widget->style = gtk_style_attach(gtk_widget_get_style(widget), window);
1034 gtk_style_set_background(gtk_widget_get_style(widget), window, GTK_STATE_NORMAL);
1036 gtk_style_context_set_background(gtk_widget_get_style_context(widget), window);
1039 gtk_im_context_set_client_window(priv->imContext.get(), window);
1042 #ifdef GTK_API_VERSION_2
1043 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* horizontalAdjustment, GtkAdjustment* verticalAdjustment)
1045 setHorizontalAdjustment(webView, horizontalAdjustment);
1046 setVerticalAdjustment(webView, verticalAdjustment);
1050 static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget)
1052 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1053 WebKitWebViewPrivate* priv = webView->priv;
1055 priv->children.add(widget);
1056 gtk_widget_set_parent(widget, GTK_WIDGET(container));
1059 static void webkit_web_view_container_remove(GtkContainer* container, GtkWidget* widget)
1061 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1062 WebKitWebViewPrivate* priv = webView->priv;
1064 if (priv->children.contains(widget)) {
1065 gtk_widget_unparent(widget);
1066 priv->children.remove(widget);
1070 static void webkit_web_view_container_forall(GtkContainer* container, gboolean, GtkCallback callback, gpointer callbackData)
1072 WebKitWebView* webView = WEBKIT_WEB_VIEW(container);
1073 WebKitWebViewPrivate* priv = webView->priv;
1075 HashSet<GtkWidget*> children = priv->children;
1076 HashSet<GtkWidget*>::const_iterator end = children.end();
1077 for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current)
1078 (*callback)(*current, callbackData);
1081 static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*, WebKitWebFrame*)
1086 static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*)
1091 static gboolean webkit_web_view_real_close_web_view(WebKitWebView*)
1096 static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame*, WebKitNetworkRequest*)
1098 return WEBKIT_NAVIGATION_RESPONSE_ACCEPT;
1101 static void webkit_web_view_real_window_object_cleared(WebKitWebView*, WebKitWebFrame*, JSGlobalContextRef context, JSObjectRef window_object)
1106 static gchar* webkit_web_view_real_choose_file(WebKitWebView*, WebKitWebFrame*, const gchar* old_name)
1109 return g_strdup(old_name);
1113 WEBKIT_SCRIPT_DIALOG_ALERT,
1114 WEBKIT_SCRIPT_DIALOG_CONFIRM,
1115 WEBKIT_SCRIPT_DIALOG_PROMPT
1116 } WebKitScriptDialogType;
1118 static gboolean webkit_web_view_script_dialog(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, WebKitScriptDialogType type, const gchar* defaultValue, gchar** value)
1120 GtkMessageType messageType;
1121 GtkButtonsType buttons;
1122 gint defaultResponse;
1125 GtkWidget* entry = 0;
1126 gboolean didConfirm = FALSE;
1129 case WEBKIT_SCRIPT_DIALOG_ALERT:
1130 messageType = GTK_MESSAGE_WARNING;
1131 buttons = GTK_BUTTONS_CLOSE;
1132 defaultResponse = GTK_RESPONSE_CLOSE;
1134 case WEBKIT_SCRIPT_DIALOG_CONFIRM:
1135 messageType = GTK_MESSAGE_QUESTION;
1136 buttons = GTK_BUTTONS_OK_CANCEL;
1137 defaultResponse = GTK_RESPONSE_OK;
1139 case WEBKIT_SCRIPT_DIALOG_PROMPT:
1140 messageType = GTK_MESSAGE_QUESTION;
1141 buttons = GTK_BUTTONS_OK_CANCEL;
1142 defaultResponse = GTK_RESPONSE_OK;
1145 g_warning("Unknown value for WebKitScriptDialogType.");
1149 window = gtk_widget_get_toplevel(GTK_WIDGET(webView));
1150 dialog = gtk_message_dialog_new(widgetIsOnscreenToplevelWindow(window) ? GTK_WINDOW(window) : 0,
1151 GTK_DIALOG_DESTROY_WITH_PARENT,
1156 gchar* title = g_strconcat("JavaScript - ", webkit_web_frame_get_uri(frame), NULL);
1157 gtk_window_set_title(GTK_WINDOW(dialog), title);
1160 if (type == WEBKIT_SCRIPT_DIALOG_PROMPT) {
1161 entry = gtk_entry_new();
1162 gtk_entry_set_text(GTK_ENTRY(entry), defaultValue);
1163 gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry);
1164 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
1165 gtk_widget_show(entry);
1168 gtk_dialog_set_default_response(GTK_DIALOG(dialog), defaultResponse);
1169 gint response = gtk_dialog_run(GTK_DIALOG(dialog));
1172 case GTK_RESPONSE_OK:
1175 *value = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
1177 case GTK_RESPONSE_CANCEL:
1182 gtk_widget_destroy(GTK_WIDGET(dialog));
1186 static gboolean webkit_web_view_real_script_alert(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message)
1188 webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_ALERT, 0, 0);
1192 static gboolean webkit_web_view_real_script_confirm(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, gboolean* didConfirm)
1194 *didConfirm = webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_CONFIRM, 0, 0);
1198 static gboolean webkit_web_view_real_script_prompt(WebKitWebView* webView, WebKitWebFrame* frame, const gchar* message, const gchar* defaultValue, gchar** value)
1200 if (!webkit_web_view_script_dialog(webView, frame, message, WEBKIT_SCRIPT_DIALOG_PROMPT, defaultValue, value))
1205 static gboolean webkit_web_view_real_console_message(WebKitWebView* webView, const gchar* message, unsigned int line, const gchar* sourceId)
1207 g_message("console message: %s @%d: %s\n", sourceId, line, message);
1211 static void webkit_web_view_real_select_all(WebKitWebView* webView)
1213 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1214 frame->editor()->command("SelectAll").execute();
1217 static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView)
1219 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1220 frame->editor()->command("Cut").execute();
1223 static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView)
1225 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1226 frame->editor()->command("Copy").execute();
1229 static void webkit_web_view_real_undo(WebKitWebView* webView)
1231 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1232 frame->editor()->command("Undo").execute();
1235 static void webkit_web_view_real_redo(WebKitWebView* webView)
1237 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1238 frame->editor()->command("Redo").execute();
1241 static gboolean webkit_web_view_real_move_cursor (WebKitWebView* webView, GtkMovementStep step, gint count)
1243 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW (webView), FALSE);
1244 g_return_val_if_fail(step == GTK_MOVEMENT_VISUAL_POSITIONS ||
1245 step == GTK_MOVEMENT_DISPLAY_LINES ||
1246 step == GTK_MOVEMENT_PAGES ||
1247 step == GTK_MOVEMENT_BUFFER_ENDS, FALSE);
1248 g_return_val_if_fail(count == 1 || count == -1, FALSE);
1250 ScrollDirection direction;
1251 ScrollGranularity granularity;
1254 case GTK_MOVEMENT_DISPLAY_LINES:
1255 granularity = ScrollByLine;
1257 direction = ScrollDown;
1259 direction = ScrollUp;
1261 case GTK_MOVEMENT_VISUAL_POSITIONS:
1262 granularity = ScrollByLine;
1264 direction = ScrollRight;
1266 direction = ScrollLeft;
1268 case GTK_MOVEMENT_PAGES:
1269 granularity = ScrollByPage;
1271 direction = ScrollDown;
1273 direction = ScrollUp;
1275 case GTK_MOVEMENT_BUFFER_ENDS:
1276 granularity = ScrollByDocument;
1278 direction = ScrollDown;
1280 direction = ScrollUp;
1283 g_assert_not_reached();
1287 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1288 if (!frame->eventHandler()->scrollOverflow(direction, granularity))
1289 frame->view()->scroll(direction, granularity);
1294 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView)
1296 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1297 frame->editor()->command("Paste").execute();
1300 static gboolean webkit_web_view_real_should_allow_editing_action(WebKitWebView*)
1305 static gboolean webkit_web_view_real_entering_fullscreen(WebKitWebView* webView)
1310 static gboolean webkit_web_view_real_leaving_fullscreen(WebKitWebView* webView)
1315 static void webkit_web_view_dispose(GObject* object)
1317 WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
1318 WebKitWebViewPrivate* priv = webView->priv;
1320 priv->disposing = TRUE;
1322 // Make sure GtkAdjustmentWatcher won't be reacting to adjustment changes after the
1323 // WebView is destroyed.
1324 setHorizontalAdjustment(webView, 0);
1325 setVerticalAdjustment(webView, 0);
1327 // These smart pointers are cleared manually, because some cleanup operations are
1328 // very sensitive to their value. We may crash if these are done in the wrong order.
1329 priv->backForwardList.clear();
1331 if (priv->corePage) {
1332 webkit_web_view_stop_loading(WEBKIT_WEB_VIEW(object));
1333 core(priv->mainFrame)->loader()->detachFromParent();
1334 delete priv->corePage;
1338 if (priv->webSettings) {
1339 g_signal_handlers_disconnect_by_func(priv->webSettings.get(), reinterpret_cast<void*>(webkit_web_view_settings_notify), webView);
1340 priv->webSettings.clear();
1343 if (priv->currentMenu) {
1344 gtk_widget_destroy(GTK_WIDGET(priv->currentMenu));
1345 priv->currentMenu = 0;
1348 priv->webInspector.clear();
1349 priv->viewportAttributes.clear();
1350 priv->webWindowFeatures.clear();
1351 priv->mainResource.clear();
1352 priv->subResources.clear();
1354 G_OBJECT_CLASS(webkit_web_view_parent_class)->dispose(object);
1357 static void webkit_web_view_finalize(GObject* object)
1359 // We need to manually call the destructor here, since this object's memory is managed
1360 // by GLib. This calls all C++ members' destructors and prevents memory leaks.
1361 WEBKIT_WEB_VIEW(object)->priv->~WebKitWebViewPrivate();
1362 G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
1365 static gboolean webkit_signal_accumulator_object_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1367 gpointer newWebView = g_value_get_object(handlerReturn);
1368 g_value_set_object(returnAccu, newWebView);
1370 // Continue if we don't have a newWebView
1374 static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
1376 WebKitNavigationResponse navigationResponse = (WebKitNavigationResponse)g_value_get_enum(handlerReturn);
1377 g_value_set_enum(returnAccu, navigationResponse);
1379 if (navigationResponse != WEBKIT_NAVIGATION_RESPONSE_ACCEPT)
1385 static AtkObject* webkit_web_view_get_accessible(GtkWidget* widget)
1387 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1391 if (!AXObjectCache::accessibilityEnabled())
1392 AXObjectCache::enableAccessibility();
1394 Frame* coreFrame = core(webView)->mainFrame();
1398 Document* doc = coreFrame->document();
1402 AccessibilityObject* rootAccessible = doc->axObjectCache()->rootObject();
1403 if (!rootAccessible)
1406 AtkObject* axRoot = rootAccessible->wrapper();
1407 if (!axRoot || !ATK_IS_OBJECT(axRoot))
1410 // Ensure the parent is set to make top-down and bottom-up navigation work.
1411 GtkWidget* parentWidget = gtk_widget_get_parent(widget);
1412 AtkObject* axParent = parentWidget ? gtk_widget_get_accessible(parentWidget) : 0;
1414 atk_object_set_parent(axRoot, axParent);
1419 static gdouble webViewGetDPI(WebKitWebView* webView)
1421 if (webView->priv->webSettings->priv->enforce96DPI)
1424 static const double defaultDPI = 96;
1425 GdkScreen* screen = gtk_widget_has_screen(GTK_WIDGET(webView)) ? gtk_widget_get_screen(GTK_WIDGET(webView)) : gdk_screen_get_default();
1429 // gdk_screen_get_resolution() returns -1 when no DPI is set.
1430 gdouble DPI = gdk_screen_get_resolution(screen);
1431 return DPI != -1 ? DPI : defaultDPI;
1434 static void webkit_web_view_screen_changed(GtkWidget* widget, GdkScreen* previousScreen)
1436 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1437 WebKitWebViewPrivate* priv = webView->priv;
1439 if (priv->disposing)
1442 WebKitWebSettings* webSettings = priv->webSettings.get();
1443 Settings* settings = core(webView)->settings();
1444 gdouble DPI = webViewGetDPI(webView);
1446 guint defaultFontSize, defaultMonospaceFontSize, minimumFontSize, minimumLogicalFontSize;
1448 g_object_get(webSettings,
1449 "default-font-size", &defaultFontSize,
1450 "default-monospace-font-size", &defaultMonospaceFontSize,
1451 "minimum-font-size", &minimumFontSize,
1452 "minimum-logical-font-size", &minimumLogicalFontSize,
1455 settings->setDefaultFontSize(defaultFontSize / 72.0 * DPI);
1456 settings->setDefaultFixedFontSize(defaultMonospaceFontSize / 72.0 * DPI);
1457 settings->setMinimumFontSize(minimumFontSize / 72.0 * DPI);
1458 settings->setMinimumLogicalFontSize(minimumLogicalFontSize / 72.0 * DPI);
1461 static void webkit_web_view_drag_end(GtkWidget* widget, GdkDragContext* context)
1463 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1464 if (!webView->priv->dragAndDropHelper.handleDragEnd(context))
1467 Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
1471 // Synthesize a button release event to send with the drag end action.
1472 GOwnPtr<GdkEvent> event(gdk_event_new(GDK_BUTTON_RELEASE));
1473 int x, y, xRoot, yRoot;
1474 GdkModifierType modifiers = static_cast<GdkModifierType>(0);
1475 #ifdef GTK_API_VERSION_2
1476 GdkDisplay* display = gdk_display_get_default();
1477 gdk_display_get_pointer(display, 0, &xRoot, &yRoot, &modifiers);
1478 event->button.window = gdk_display_get_window_at_pointer(display, &x, &y);
1480 GdkDevice* device = gdk_drag_context_get_device(context);
1481 event->button.window = gdk_device_get_window_at_position(device, &x, &y);
1482 gdk_device_get_position(device, 0, &xRoot, &yRoot);
1485 if (event->button.window)
1486 g_object_ref(event->button.window);
1487 event->button.x = x;
1488 event->button.y = y;
1489 event->button.x_root = xRoot;
1490 event->button.y_root = yRoot;
1491 event->button.state = modifiers;
1493 PlatformMouseEvent platformEvent(&event->button);
1494 frame->eventHandler()->dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));
1497 static void webkit_web_view_drag_data_get(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selectionData, guint info, guint)
1499 WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleGetDragData(context, selectionData, info);
1502 static void dragExitedCallback(GtkWidget* widget, DragData* dragData, bool dropHappened)
1504 // Don't call dragExited if we have just received a drag-drop signal. This
1505 // happens in the case of a successful drop onto the view.
1507 core(WEBKIT_WEB_VIEW(widget))->dragController()->dragExited(dragData);
1508 core(WEBKIT_WEB_VIEW(widget))->dragController()->dragEnded();
1511 static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time)
1513 WEBKIT_WEB_VIEW(widget)->priv->dragAndDropHelper.handleDragLeave(context, dragExitedCallback);
1516 static gboolean webkit_web_view_drag_motion(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1518 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1519 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragMotion(context, IntPoint(x, y), time));
1523 DragOperation operation = core(webView)->dragController()->dragUpdated(dragData.get()).operation;
1524 gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1528 static void webkit_web_view_drag_data_received(GtkWidget* widget, GdkDragContext* context, gint x, gint y, GtkSelectionData* selectionData, guint info, guint time)
1530 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1531 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDataReceived(context, selectionData, info));
1535 DragOperation operation = core(webView)->dragController()->dragEntered(dragData.get()).operation;
1536 gdk_drag_status(context, dragOperationToSingleGdkDragAction(operation), time);
1539 static gboolean webkit_web_view_drag_drop(GtkWidget* widget, GdkDragContext* context, gint x, gint y, guint time)
1541 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1542 OwnPtr<DragData> dragData(webView->priv->dragAndDropHelper.handleDragDrop(context, IntPoint(x, y)));
1546 core(webView)->dragController()->performDrag(dragData.get());
1547 gtk_drag_finish(context, TRUE, FALSE, time);
1551 #if GTK_CHECK_VERSION(2, 12, 0)
1552 static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard_mode, GtkTooltip *tooltip)
1554 WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv;
1556 if (keyboard_mode) {
1557 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
1559 // Get the title of the current focused element.
1560 Frame* coreFrame = core(webView)->focusController()->focusedOrMainFrame();
1564 Node* node = getFocusedNode(coreFrame);
1568 for (Node* titleNode = node; titleNode; titleNode = titleNode->parentNode()) {
1569 if (titleNode->isElementNode()) {
1570 String title = static_cast<Element*>(titleNode)->title();
1571 if (!title.isEmpty()) {
1572 if (FrameView* view = coreFrame->view()) {
1573 GdkRectangle area = view->contentsToWindow(node->getRect());
1574 gtk_tooltip_set_tip_area(tooltip, &area);
1576 gtk_tooltip_set_text(tooltip, title.utf8().data());
1586 if (priv->tooltipText.length() > 0) {
1587 if (!keyboard_mode) {
1588 if (!priv->tooltipArea.isEmpty()) {
1589 GdkRectangle area = priv->tooltipArea;
1590 gtk_tooltip_set_tip_area(tooltip, &area);
1592 gtk_tooltip_set_tip_area(tooltip, 0);
1594 gtk_tooltip_set_text(tooltip, priv->tooltipText.data());
1601 static gboolean webkit_web_view_show_help(GtkWidget* widget, GtkWidgetHelpType help_type)
1603 if (help_type == GTK_WIDGET_HELP_TOOLTIP)
1604 gtk_widget_set_has_tooltip(widget, TRUE);
1606 return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->show_help(widget, help_type);
1610 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
1612 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
1613 return GTK_IM_CONTEXT(webView->priv->imContext.get());
1616 static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
1618 GtkBindingSet* binding_set;
1627 * WebKitWebView::create-web-view:
1628 * @web_view: the object on which the signal is emitted
1629 * @frame: the #WebKitWebFrame
1631 * Emitted when the creation of a new window is requested.
1632 * If this signal is handled the signal handler should return the
1633 * newly created #WebKitWebView.
1635 * The new #WebKitWebView should not be displayed to the user
1636 * until the #WebKitWebView::web-view-ready signal is emitted.
1638 * The signal handlers should not try to deal with the reference count for
1639 * the new #WebKitWebView. The widget to which the widget is added will
1642 * Return value: (transfer full): a newly allocated #WebKitWebView, or %NULL
1646 webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view",
1647 G_TYPE_FROM_CLASS(webViewClass),
1648 (GSignalFlags)G_SIGNAL_RUN_LAST,
1649 G_STRUCT_OFFSET (WebKitWebViewClass, create_web_view),
1650 webkit_signal_accumulator_object_handled,
1652 webkit_marshal_OBJECT__OBJECT,
1653 WEBKIT_TYPE_WEB_VIEW , 1,
1654 WEBKIT_TYPE_WEB_FRAME);
1657 * WebKitWebView::web-view-ready:
1658 * @web_view: the object on which the signal is emitted
1660 * Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView
1661 * should be displayed to the user. When this signal is emitted
1662 * all the information about how the window should look, including
1663 * size, position, whether the location, status and scroll bars
1664 * should be displayed, is already set on the
1665 * #WebKitWebWindowFeatures object contained by the #WebKitWebView.
1667 * Notice that some of that information may change during the life
1668 * time of the window, so you may want to connect to the ::notify
1669 * signal of the #WebKitWebWindowFeatures object to handle those.
1671 * Return value: %TRUE to stop handlers from being invoked for the event or
1672 * %FALSE to propagate the event furter
1676 webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready",
1677 G_TYPE_FROM_CLASS(webViewClass),
1678 (GSignalFlags)G_SIGNAL_RUN_LAST,
1679 G_STRUCT_OFFSET (WebKitWebViewClass, web_view_ready),
1680 g_signal_accumulator_true_handled,
1682 webkit_marshal_BOOLEAN__VOID,
1686 * WebKitWebView::close-web-view:
1687 * @web_view: the object on which the signal is emitted
1689 * Emitted when closing a #WebKitWebView is requested. This occurs when a
1690 * call is made from JavaScript's window.close function. The default
1691 * signal handler does not do anything. It is the owner's responsibility
1692 * to hide or delete the web view, if necessary.
1694 * Return value: %TRUE to stop handlers from being invoked for the event or
1695 * %FALSE to propagate the event furter
1699 webkit_web_view_signals[CLOSE_WEB_VIEW] = g_signal_new("close-web-view",
1700 G_TYPE_FROM_CLASS(webViewClass),
1701 (GSignalFlags)G_SIGNAL_RUN_LAST,
1702 G_STRUCT_OFFSET (WebKitWebViewClass, close_web_view),
1703 g_signal_accumulator_true_handled,
1705 webkit_marshal_BOOLEAN__VOID,
1709 * WebKitWebView::navigation-requested:
1710 * @web_view: the object on which the signal is emitted
1711 * @frame: the #WebKitWebFrame that required the navigation
1712 * @request: a #WebKitNetworkRequest
1714 * Emitted when @frame requests a navigation to another page.
1716 * Return value: a #WebKitNavigationResponse
1718 * Deprecated: Use WebKitWebView::navigation-policy-decision-requested
1721 webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
1722 G_TYPE_FROM_CLASS(webViewClass),
1723 (GSignalFlags)G_SIGNAL_RUN_LAST,
1724 G_STRUCT_OFFSET (WebKitWebViewClass, navigation_requested),
1725 webkit_navigation_request_handled,
1727 webkit_marshal_ENUM__OBJECT_OBJECT,
1728 WEBKIT_TYPE_NAVIGATION_RESPONSE, 2,
1729 WEBKIT_TYPE_WEB_FRAME,
1730 WEBKIT_TYPE_NETWORK_REQUEST);
1733 * WebKitWebView::new-window-policy-decision-requested:
1734 * @web_view: the object on which the signal is emitted
1735 * @frame: the #WebKitWebFrame that required the navigation
1736 * @request: a #WebKitNetworkRequest
1737 * @navigation_action: a #WebKitWebNavigationAction
1738 * @policy_decision: a #WebKitWebPolicyDecision
1740 * Emitted when @frame requests opening a new window. With this
1741 * signal the browser can use the context of the request to decide
1742 * about the new window. If the request is not handled the default
1743 * behavior is to allow opening the new window to load the URI,
1744 * which will cause a create-web-view signal emission where the
1745 * browser handles the new window action but without information
1746 * of the context that caused the navigation. The following
1747 * navigation-policy-decision-requested emissions will load the
1748 * page after the creation of the new window just with the
1749 * information of this new navigation context, without any
1750 * information about the action that made this new window to be
1753 * Notice that if you return TRUE, meaning that you handled the
1754 * signal, you are expected to have decided what to do, by calling
1755 * webkit_web_policy_decision_ignore(),
1756 * webkit_web_policy_decision_use(), or
1757 * webkit_web_policy_decision_download() on the @policy_decision
1760 * Return value: %TRUE if a decision was made, %FALSE to have the
1761 * default behavior apply
1765 webkit_web_view_signals[NEW_WINDOW_POLICY_DECISION_REQUESTED] =
1766 g_signal_new("new-window-policy-decision-requested",
1767 G_TYPE_FROM_CLASS(webViewClass),
1768 (GSignalFlags)G_SIGNAL_RUN_LAST,
1770 g_signal_accumulator_true_handled,
1772 webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1774 WEBKIT_TYPE_WEB_FRAME,
1775 WEBKIT_TYPE_NETWORK_REQUEST,
1776 WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1777 WEBKIT_TYPE_WEB_POLICY_DECISION);
1780 * WebKitWebView::navigation-policy-decision-requested:
1781 * @web_view: the object on which the signal is emitted
1782 * @frame: the #WebKitWebFrame that required the navigation
1783 * @request: a #WebKitNetworkRequest
1784 * @navigation_action: a #WebKitWebNavigationAction
1785 * @policy_decision: a #WebKitWebPolicyDecision
1787 * Emitted when @frame requests a navigation to another page.
1788 * If this signal is not handled, the default behavior is to allow the
1791 * Notice that if you return TRUE, meaning that you handled the
1792 * signal, you are expected to have decided what to do, by calling
1793 * webkit_web_policy_decision_ignore(),
1794 * webkit_web_policy_decision_use(), or
1795 * webkit_web_policy_decision_download() on the @policy_decision
1798 * Return value: %TRUE if a decision was made, %FALSE to have the
1799 * default behavior apply
1803 webkit_web_view_signals[NAVIGATION_POLICY_DECISION_REQUESTED] = g_signal_new("navigation-policy-decision-requested",
1804 G_TYPE_FROM_CLASS(webViewClass),
1805 (GSignalFlags)G_SIGNAL_RUN_LAST,
1807 g_signal_accumulator_true_handled,
1809 webkit_marshal_BOOLEAN__OBJECT_OBJECT_OBJECT_OBJECT,
1811 WEBKIT_TYPE_WEB_FRAME,
1812 WEBKIT_TYPE_NETWORK_REQUEST,
1813 WEBKIT_TYPE_WEB_NAVIGATION_ACTION,
1814 WEBKIT_TYPE_WEB_POLICY_DECISION);
1817 * WebKitWebView::mime-type-policy-decision-requested:
1818 * @web_view: the object on which the signal is emitted
1819 * @frame: the #WebKitWebFrame that required the policy decision
1820 * @request: a WebKitNetworkRequest
1821 * @mimetype: the MIME type attempted to load
1822 * @policy_decision: a #WebKitWebPolicyDecision
1824 * Decide whether or not to display the given MIME type. If this
1825 * signal is not handled, the default behavior is to show the
1826 * content of the requested URI if WebKit can show this MIME
1827 * type and the content disposition is not a download; if WebKit
1828 * is not able to show the MIME type nothing happens.
1830 * Notice that if you return TRUE, meaning that you handled the
1831 * signal, you are expected to be aware of the "Content-Disposition"
1832 * header. A value of "attachment" usually indicates a download
1833 * regardless of the MIME type, see also
1834 * soup_message_headers_get_content_disposition(). And you must call
1835 * webkit_web_policy_decision_ignore(),
1836 * webkit_web_policy_decision_use(), or
1837 * webkit_web_policy_decision_download() on the @policy_decision
1840 * Return value: %TRUE if a decision was made, %FALSE to have the
1841 * default behavior apply
1845 webkit_web_view_signals[MIME_TYPE_POLICY_DECISION_REQUESTED] = g_signal_new("mime-type-policy-decision-requested",
1846 G_TYPE_FROM_CLASS(webViewClass),
1847 (GSignalFlags)G_SIGNAL_RUN_LAST,
1849 g_signal_accumulator_true_handled,
1851 webkit_marshal_BOOLEAN__OBJECT_OBJECT_STRING_OBJECT,
1853 WEBKIT_TYPE_WEB_FRAME,
1854 WEBKIT_TYPE_NETWORK_REQUEST,
1856 WEBKIT_TYPE_WEB_POLICY_DECISION);
1859 * WebKitWebView::window-object-cleared:
1860 * @web_view: the object on which the signal is emitted
1861 * @frame: the #WebKitWebFrame to which @window_object belongs
1862 * @context: the #JSGlobalContextRef holding the global object and other
1863 * execution state; equivalent to the return value of
1864 * webkit_web_frame_get_global_context(@frame)
1865 * @window_object: the #JSObjectRef representing the frame's JavaScript
1868 * Emitted when the JavaScript window object in a #WebKitWebFrame has been
1869 * cleared in preparation for a new load. This is the preferred place to
1870 * set custom properties on the window object using the JavaScriptCore API.
1872 webkit_web_view_signals[WINDOW_OBJECT_CLEARED] = g_signal_new("window-object-cleared",
1873 G_TYPE_FROM_CLASS(webViewClass),
1874 (GSignalFlags)G_SIGNAL_RUN_LAST,
1875 G_STRUCT_OFFSET (WebKitWebViewClass, window_object_cleared),
1878 webkit_marshal_VOID__OBJECT_POINTER_POINTER,
1880 WEBKIT_TYPE_WEB_FRAME,
1885 * WebKitWebView::download-requested:
1886 * @web_view: the object on which the signal is emitted
1887 * @download: a #WebKitDownload object that lets you control the
1890 * A new Download is being requested. By default, if the signal is
1891 * not handled, the download is cancelled. If you handle the download
1892 * and call webkit_download_set_destination_uri(), it will be
1893 * started for you. If you need to set the destination asynchronously
1894 * you are responsible for starting or cancelling it yourself.
1896 * If you intend to handle downloads yourself rather than using
1897 * the #WebKitDownload helper object you must handle this signal,
1898 * and return %FALSE.
1900 * Also, keep in mind that the default policy for WebKitGTK+ is to
1901 * ignore files with a MIME type that it does not know how to
1902 * handle, which means this signal won't be emitted in the default
1903 * setup. One way to trigger downloads is to connect to
1904 * WebKitWebView::mime-type-policy-decision-requested and call
1905 * webkit_web_policy_decision_download() on the
1906 * #WebKitWebPolicyDecision in the parameter list for the kind of
1907 * files you want your application to download (a common solution
1908 * is to download anything that WebKit can't handle, which you can
1909 * figure out by using webkit_web_view_can_show_mime_type()).
1911 * Return value: TRUE if the download should be performed, %FALSE to
1916 webkit_web_view_signals[DOWNLOAD_REQUESTED] = g_signal_new("download-requested",
1917 G_TYPE_FROM_CLASS(webViewClass),
1918 (GSignalFlags)G_SIGNAL_RUN_LAST,
1920 g_signal_accumulator_true_handled,
1922 webkit_marshal_BOOLEAN__OBJECT,
1927 * WebKitWebView::load-started:
1928 * @web_view: the object on which the signal is emitted
1929 * @frame: the frame going to do the load
1931 * When a #WebKitWebFrame begins to load this signal is emitted.
1933 * Deprecated: Use the "load-status" property instead.
1935 webkit_web_view_signals[LOAD_STARTED] = g_signal_new("load-started",
1936 G_TYPE_FROM_CLASS(webViewClass),
1937 (GSignalFlags)G_SIGNAL_RUN_LAST,
1941 g_cclosure_marshal_VOID__OBJECT,
1943 WEBKIT_TYPE_WEB_FRAME);
1946 * WebKitWebView::load-committed:
1947 * @web_view: the object on which the signal is emitted
1948 * @frame: the main frame that received the first data
1950 * When a #WebKitWebFrame loaded the first data this signal is emitted.
1952 * Deprecated: Use the "load-status" property instead.
1954 webkit_web_view_signals[LOAD_COMMITTED] = g_signal_new("load-committed",
1955 G_TYPE_FROM_CLASS(webViewClass),
1956 (GSignalFlags)G_SIGNAL_RUN_LAST,
1960 g_cclosure_marshal_VOID__OBJECT,
1962 WEBKIT_TYPE_WEB_FRAME);
1966 * WebKitWebView::load-progress-changed:
1967 * @web_view: the #WebKitWebView
1968 * @progress: the global progress
1970 * Deprecated: Use the "progress" property instead.
1972 webkit_web_view_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load-progress-changed",
1973 G_TYPE_FROM_CLASS(webViewClass),
1974 (GSignalFlags)G_SIGNAL_RUN_LAST,
1978 g_cclosure_marshal_VOID__INT,
1983 * WebKitWebView::load-error
1984 * @web_view: the object on which the signal is emitted
1985 * @web_frame: the #WebKitWebFrame
1986 * @uri: the URI that triggered the error
1987 * @web_error: the #GError that was triggered
1989 * An error occurred while loading. By default, if the signal is not
1990 * handled, the @web_view will display a stock error page. You need to
1991 * handle the signal if you want to provide your own error page.
1995 * Return value: %TRUE to stop other handlers from being invoked for the
1996 * event. %FALSE to propagate the event further.
1998 webkit_web_view_signals[LOAD_ERROR] = g_signal_new("load-error",
1999 G_TYPE_FROM_CLASS(webViewClass),
2000 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2002 g_signal_accumulator_true_handled,
2004 webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER,
2006 WEBKIT_TYPE_WEB_FRAME,
2011 * WebKitWebView::load-finished:
2012 * @web_view: the #WebKitWebView
2013 * @frame: the #WebKitWebFrame
2015 * Deprecated: Use the "load-status" property instead.
2017 webkit_web_view_signals[LOAD_FINISHED] = g_signal_new("load-finished",
2018 G_TYPE_FROM_CLASS(webViewClass),
2019 (GSignalFlags)G_SIGNAL_RUN_LAST,
2023 g_cclosure_marshal_VOID__OBJECT,
2025 WEBKIT_TYPE_WEB_FRAME);
2028 * WebKitWebView::onload-event:
2029 * @web_view: the object on which the signal is emitted
2032 * When a #WebKitWebFrame receives an onload event this signal is emitted.
2034 webkit_web_view_signals[ONLOAD_EVENT] = g_signal_new("onload-event",
2035 G_TYPE_FROM_CLASS(webViewClass),
2036 (GSignalFlags)G_SIGNAL_RUN_LAST,
2040 g_cclosure_marshal_VOID__OBJECT,
2042 WEBKIT_TYPE_WEB_FRAME);
2045 * WebKitWebView::title-changed:
2046 * @web_view: the object on which the signal is emitted
2047 * @frame: the main frame
2048 * @title: the new title
2050 * When a #WebKitWebFrame changes the document title this signal is emitted.
2052 * Deprecated: 1.1.4: Use "notify::title" instead.
2054 webkit_web_view_signals[TITLE_CHANGED] = g_signal_new("title-changed",
2055 G_TYPE_FROM_CLASS(webViewClass),
2056 (GSignalFlags)G_SIGNAL_RUN_LAST,
2060 webkit_marshal_VOID__OBJECT_STRING,
2062 WEBKIT_TYPE_WEB_FRAME,
2066 * WebKitWebView::hovering-over-link:
2067 * @web_view: the object on which the signal is emitted
2068 * @title: the link's title
2069 * @uri: the URI the link points to
2071 * When the cursor is over a link, this signal is emitted.
2073 webkit_web_view_signals[HOVERING_OVER_LINK] = g_signal_new("hovering-over-link",
2074 G_TYPE_FROM_CLASS(webViewClass),
2075 (GSignalFlags)G_SIGNAL_RUN_LAST,
2079 webkit_marshal_VOID__STRING_STRING,
2085 * WebKitWebView::populate-popup:
2086 * @web_view: the object on which the signal is emitted
2087 * @menu: the context menu
2089 * When a context menu is about to be displayed this signal is emitted.
2091 * Add menu items to #menu to extend the context menu.
2093 webkit_web_view_signals[POPULATE_POPUP] = g_signal_new("populate-popup",
2094 G_TYPE_FROM_CLASS(webViewClass),
2095 (GSignalFlags)G_SIGNAL_RUN_LAST,
2099 g_cclosure_marshal_VOID__OBJECT,
2104 * WebKitWebView::print-requested
2105 * @web_view: the object in which the signal is emitted
2106 * @web_frame: the frame that is requesting to be printed
2108 * Emitted when printing is requested by the frame, usually
2109 * because of a javascript call. When handling this signal you
2110 * should call webkit_web_frame_print_full() or
2111 * webkit_web_frame_print() to do the actual printing.
2113 * The default handler will present a print dialog and carry a
2114 * print operation. Notice that this means that if you intend to
2115 * ignore a print request you must connect to this signal, and
2118 * Return value: %TRUE if the print request has been handled, %FALSE if
2119 * the default handler should run
2123 webkit_web_view_signals[PRINT_REQUESTED] = g_signal_new("print-requested",
2124 G_TYPE_FROM_CLASS(webViewClass),
2125 (GSignalFlags)G_SIGNAL_RUN_LAST,
2127 g_signal_accumulator_true_handled,
2129 webkit_marshal_BOOLEAN__OBJECT,
2131 WEBKIT_TYPE_WEB_FRAME);
2133 webkit_web_view_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status-bar-text-changed",
2134 G_TYPE_FROM_CLASS(webViewClass),
2135 (GSignalFlags)G_SIGNAL_RUN_LAST,
2139 g_cclosure_marshal_VOID__STRING,
2144 * WebKitWebView::icon-loaded:
2145 * @web_view: the object on which the signal is emitted
2146 * @icon_uri: the URI for the icon
2148 * This signal is emitted when the main frame has got a favicon.
2149 * See WebKitIconDatabase::icon-loaded if you want to keep track of
2150 * icons for child frames.
2154 webkit_web_view_signals[ICON_LOADED] = g_signal_new("icon-loaded",
2155 G_TYPE_FROM_CLASS(webViewClass),
2156 (GSignalFlags)G_SIGNAL_RUN_LAST,
2160 g_cclosure_marshal_VOID__STRING,
2165 * WebKitWebView::console-message:
2166 * @web_view: the object on which the signal is emitted
2167 * @message: the message text
2168 * @line: the line where the error occured
2169 * @source_id: the source id
2171 * A JavaScript console message was created.
2173 * Return value: %TRUE to stop other handlers from being invoked for the
2174 * event. %FALSE to propagate the event further.
2176 webkit_web_view_signals[CONSOLE_MESSAGE] = g_signal_new("console-message",
2177 G_TYPE_FROM_CLASS(webViewClass),
2178 (GSignalFlags)G_SIGNAL_RUN_LAST,
2179 G_STRUCT_OFFSET(WebKitWebViewClass, console_message),
2180 g_signal_accumulator_true_handled,
2182 webkit_marshal_BOOLEAN__STRING_INT_STRING,
2184 G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
2187 * WebKitWebView::script-alert:
2188 * @web_view: the object on which the signal is emitted
2189 * @frame: the relevant frame
2190 * @message: the message text
2192 * A JavaScript alert dialog was created.
2194 * Return value: %TRUE to stop other handlers from being invoked for the
2195 * event. %FALSE to propagate the event further.
2197 webkit_web_view_signals[SCRIPT_ALERT] = g_signal_new("script-alert",
2198 G_TYPE_FROM_CLASS(webViewClass),
2199 (GSignalFlags)G_SIGNAL_RUN_LAST,
2200 G_STRUCT_OFFSET(WebKitWebViewClass, script_alert),
2201 g_signal_accumulator_true_handled,
2203 webkit_marshal_BOOLEAN__OBJECT_STRING,
2205 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING);
2208 * WebKitWebView::script-confirm:
2209 * @web_view: the object on which the signal is emitted
2210 * @frame: the relevant frame
2211 * @message: the message text
2212 * @confirmed: whether the dialog has been confirmed
2214 * A JavaScript confirm dialog was created, providing Yes and No buttons.
2216 * Return value: %TRUE to stop other handlers from being invoked for the
2217 * event. %FALSE to propagate the event further.
2219 webkit_web_view_signals[SCRIPT_CONFIRM] = g_signal_new("script-confirm",
2220 G_TYPE_FROM_CLASS(webViewClass),
2221 (GSignalFlags)G_SIGNAL_RUN_LAST,
2222 G_STRUCT_OFFSET(WebKitWebViewClass, script_confirm),
2223 g_signal_accumulator_true_handled,
2225 webkit_marshal_BOOLEAN__OBJECT_STRING_POINTER,
2227 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_POINTER);
2230 * WebKitWebView::script-prompt:
2231 * @web_view: the object on which the signal is emitted
2232 * @frame: the relevant frame
2233 * @message: the message text
2234 * @default: the default value
2235 * @text: To be filled with the return value or NULL if the dialog was cancelled.
2237 * A JavaScript prompt dialog was created, providing an entry to input text.
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_PROMPT] = g_signal_new("script-prompt",
2243 G_TYPE_FROM_CLASS(webViewClass),
2244 (GSignalFlags)G_SIGNAL_RUN_LAST,
2245 G_STRUCT_OFFSET(WebKitWebViewClass, script_prompt),
2246 g_signal_accumulator_true_handled,
2248 webkit_marshal_BOOLEAN__OBJECT_STRING_STRING_STRING,
2250 WEBKIT_TYPE_WEB_FRAME, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
2253 * WebKitWebView::select-all:
2254 * @web_view: the object which received the signal
2256 * The #WebKitWebView::select-all signal is a keybinding signal which gets emitted to
2257 * select the complete contents of the text view.
2259 * The default bindings for this signal is Ctrl-a.
2261 webkit_web_view_signals[SELECT_ALL] = g_signal_new("select-all",
2262 G_TYPE_FROM_CLASS(webViewClass),
2263 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2264 G_STRUCT_OFFSET(WebKitWebViewClass, select_all),
2266 g_cclosure_marshal_VOID__VOID,
2270 * WebKitWebView::cut-clipboard:
2271 * @web_view: the object which received the signal
2273 * The #WebKitWebView::cut-clipboard signal is a keybinding signal which gets emitted to
2274 * cut the selection to the clipboard.
2276 * The default bindings for this signal are Ctrl-x and Shift-Delete.
2278 webkit_web_view_signals[CUT_CLIPBOARD] = g_signal_new("cut-clipboard",
2279 G_TYPE_FROM_CLASS(webViewClass),
2280 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2281 G_STRUCT_OFFSET(WebKitWebViewClass, cut_clipboard),
2283 g_cclosure_marshal_VOID__VOID,
2287 * WebKitWebView::copy-clipboard:
2288 * @web_view: the object which received the signal
2290 * The #WebKitWebView::copy-clipboard signal is a keybinding signal which gets emitted to
2291 * copy the selection to the clipboard.
2293 * The default bindings for this signal are Ctrl-c and Ctrl-Insert.
2295 webkit_web_view_signals[COPY_CLIPBOARD] = g_signal_new("copy-clipboard",
2296 G_TYPE_FROM_CLASS(webViewClass),
2297 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2298 G_STRUCT_OFFSET(WebKitWebViewClass, copy_clipboard),
2300 g_cclosure_marshal_VOID__VOID,
2304 * WebKitWebView::paste-clipboard:
2305 * @web_view: the object which received the signal
2307 * The #WebKitWebView::paste-clipboard signal is a keybinding signal which gets emitted to
2308 * paste the contents of the clipboard into the Web view.
2310 * The default bindings for this signal are Ctrl-v and Shift-Insert.
2312 webkit_web_view_signals[PASTE_CLIPBOARD] = g_signal_new("paste-clipboard",
2313 G_TYPE_FROM_CLASS(webViewClass),
2314 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2315 G_STRUCT_OFFSET(WebKitWebViewClass, paste_clipboard),
2317 g_cclosure_marshal_VOID__VOID,
2321 * WebKitWebView::undo
2322 * @web_view: the object which received the signal
2324 * The #WebKitWebView::undo signal is a keybinding signal which gets emitted to
2325 * undo the last editing command.
2327 * The default binding for this signal is Ctrl-z
2331 webkit_web_view_signals[UNDO] = g_signal_new("undo",
2332 G_TYPE_FROM_CLASS(webViewClass),
2333 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2334 G_STRUCT_OFFSET(WebKitWebViewClass, undo),
2336 g_cclosure_marshal_VOID__VOID,
2340 * WebKitWebView::redo
2341 * @web_view: the object which received the signal
2343 * The #WebKitWebView::redo signal is a keybinding signal which gets emitted to
2344 * redo the last editing command.
2346 * The default binding for this signal is Ctrl-Shift-z
2350 webkit_web_view_signals[REDO] = g_signal_new("redo",
2351 G_TYPE_FROM_CLASS(webViewClass),
2352 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2353 G_STRUCT_OFFSET(WebKitWebViewClass, redo),
2355 g_cclosure_marshal_VOID__VOID,
2359 * WebKitWebView::move-cursor:
2360 * @web_view: the object which received the signal
2361 * @step: the type of movement, one of #GtkMovementStep
2362 * @count: an integer indicating the subtype of movement. Currently
2363 * the permitted values are '1' = forward, '-1' = backwards.
2365 * The #WebKitWebView::move-cursor will be emitted to apply the
2366 * cursor movement described by its parameters to the @view.
2368 * Return value: %TRUE or %FALSE
2372 webkit_web_view_signals[MOVE_CURSOR] = g_signal_new("move-cursor",
2373 G_TYPE_FROM_CLASS(webViewClass),
2374 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2375 G_STRUCT_OFFSET(WebKitWebViewClass, move_cursor),
2377 webkit_marshal_BOOLEAN__ENUM_INT,
2379 GTK_TYPE_MOVEMENT_STEP,
2383 * WebKitWebView::create-plugin-widget:
2384 * @web_view: the object which received the signal
2385 * @mime_type: the mimetype of the requested object
2386 * @uri: the URI to load
2387 * @param: a #GHashTable with additional attributes (strings)
2389 * The #WebKitWebView::create-plugin-widget signal will be emitted to
2390 * create a plugin widget for embed or object HTML tags. This
2391 * allows to embed a GtkWidget as a plugin into HTML content. In
2392 * case of a textual selection of the GtkWidget WebCore will attempt
2393 * to set the property value of "webkit-widget-is-selected". This can
2394 * be used to draw a visual indicator of the selection.
2396 * Return value: (transfer full): a new #GtkWidget, or %NULL
2400 webkit_web_view_signals[PLUGIN_WIDGET] = g_signal_new("create-plugin-widget",
2401 G_TYPE_FROM_CLASS(webViewClass),
2402 (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2404 webkit_signal_accumulator_object_handled,
2406 webkit_marshal_OBJECT__STRING_STRING_POINTER,
2408 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_HASH_TABLE);
2411 * WebKitWebView::database-quota-exceeded
2412 * @web_view: the object which received the signal
2413 * @frame: the relevant frame
2414 * @database: the #WebKitWebDatabase which exceeded the quota of its #WebKitSecurityOrigin
2416 * The #WebKitWebView::database-quota-exceeded signal will be emitted when
2417 * a Web Database exceeds the quota of its security origin. This signal
2418 * may be used to increase the size of the quota before the originating
2423 webkit_web_view_signals[DATABASE_QUOTA_EXCEEDED] = g_signal_new("database-quota-exceeded",
2424 G_TYPE_FROM_CLASS(webViewClass),
2425 (GSignalFlags) (G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2428 webkit_marshal_VOID__OBJECT_OBJECT,
2430 G_TYPE_OBJECT, G_TYPE_OBJECT);
2433 * WebKitWebView::resource-request-starting:
2434 * @web_view: the object which received the signal
2435 * @web_frame: the #WebKitWebFrame whose load dispatched this request
2436 * @web_resource: an empty #WebKitWebResource object
2437 * @request: the #WebKitNetworkRequest that will be dispatched
2438 * @response: the #WebKitNetworkResponse representing the redirect
2441 * Emitted when a request is about to be sent. You can modify the
2442 * request while handling this signal. You can set the URI in the
2443 * #WebKitNetworkRequest object itself, and add/remove/replace
2444 * headers using the #SoupMessage object it carries, if it is
2445 * present. See webkit_network_request_get_message(). Setting the
2446 * request URI to "about:blank" will effectively cause the request
2447 * to load nothing, and can be used to disable the loading of
2448 * specific resources.
2450 * Notice that information about an eventual redirect is available
2451 * in @response's #SoupMessage, not in the #SoupMessage carried by
2452 * the @request. If @response is %NULL, then this is not a
2453 * redirected request.
2455 * The #WebKitWebResource object will be the same throughout all
2456 * the lifetime of the resource, but the contents may change from
2457 * inbetween signal emissions.
2461 webkit_web_view_signals[RESOURCE_REQUEST_STARTING] = g_signal_new("resource-request-starting",
2462 G_TYPE_FROM_CLASS(webViewClass),
2463 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2466 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT_OBJECT,
2468 WEBKIT_TYPE_WEB_FRAME,
2469 WEBKIT_TYPE_WEB_RESOURCE,
2470 WEBKIT_TYPE_NETWORK_REQUEST,
2471 WEBKIT_TYPE_NETWORK_RESPONSE);
2474 * WebKitWebView::geolocation-policy-decision-requested:
2475 * @web_view: the object on which the signal is emitted
2476 * @frame: the frame that requests permission
2477 * @policy_decision: a WebKitGeolocationPolicyDecision
2479 * This signal is emitted when a @frame wants to obtain the user's
2480 * location. The decision can be made asynchronously, but you must
2481 * call g_object_ref() the @policy_decision, and return %TRUE if
2482 * you are going to handle the request. To actually make the
2483 * decision you need to call webkit_geolocation_policy_allow() or
2484 * webkit_geolocation_policy_deny() on @policy_decision.
2488 webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_REQUESTED] = g_signal_new("geolocation-policy-decision-requested",
2489 G_TYPE_FROM_CLASS(webViewClass),
2490 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2493 webkit_marshal_BOOLEAN__OBJECT_OBJECT,
2495 WEBKIT_TYPE_WEB_FRAME,
2496 WEBKIT_TYPE_GEOLOCATION_POLICY_DECISION);
2499 * WebKitWebView::geolocation-policy-decision-cancelled:
2500 * @web_view: the object on which the signal is emitted
2501 * @frame: the frame that cancels geolocation request.
2503 * When a @frame wants to cancel geolocation permission it had requested
2508 webkit_web_view_signals[GEOLOCATION_POLICY_DECISION_CANCELLED] = g_signal_new("geolocation-policy-decision-cancelled",
2509 G_TYPE_FROM_CLASS(webViewClass),
2510 (GSignalFlags)(G_SIGNAL_RUN_LAST),
2513 g_cclosure_marshal_VOID__OBJECT,
2515 WEBKIT_TYPE_WEB_FRAME);
2518 * DOM-related signals. These signals are experimental, for now,
2519 * and may change API and ABI. Their comments lack one * on
2520 * purpose, to make them not be catched by gtk-doc.
2524 * WebKitWebView::document-load-finished
2525 * @web_view: the object which received the signal
2526 * @web_frame: the #WebKitWebFrame whose load dispatched this request
2528 * Emitted when the DOM document object load is finished for the
2531 webkit_web_view_signals[DOCUMENT_LOAD_FINISHED] = g_signal_new("document-load-finished",
2532 G_TYPE_FROM_CLASS(webViewClass),
2533 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2536 g_cclosure_marshal_VOID__OBJECT,
2538 WEBKIT_TYPE_WEB_FRAME);
2541 * WebKitWebView::frame-created
2542 * @web_view: the object which received the signal
2543 * @web_frame: the #WebKitWebFrame which was just created.
2545 * Emitted when a WebKitWebView has created a new frame. This signal will
2546 * be emitted for all sub-frames created during page load. It will not be
2547 * emitted for the main frame, which originates in the WebKitWebView constructor
2548 * and may be accessed at any time using webkit_web_view_get_main_frame.
2552 webkit_web_view_signals[FRAME_CREATED] = g_signal_new("frame-created",
2553 G_TYPE_FROM_CLASS(webViewClass),
2554 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2557 g_cclosure_marshal_VOID__OBJECT,
2559 WEBKIT_TYPE_WEB_FRAME);
2561 webkit_web_view_signals[SHOULD_BEGIN_EDITING] = g_signal_new("should-begin-editing",
2562 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2563 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2564 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2566 webkit_web_view_signals[SHOULD_END_EDITING] = g_signal_new("should-end-editing", G_TYPE_FROM_CLASS(webViewClass),
2567 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2568 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2569 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2571 webkit_web_view_signals[SHOULD_INSERT_NODE] = g_signal_new("should-insert-node", G_TYPE_FROM_CLASS(webViewClass),
2572 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2573 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2574 webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM, G_TYPE_BOOLEAN,
2575 3, WEBKIT_TYPE_DOM_NODE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2577 webkit_web_view_signals[SHOULD_INSERT_TEXT] = g_signal_new("should-insert-text", G_TYPE_FROM_CLASS(webViewClass),
2578 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2579 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2580 webkit_marshal_BOOLEAN__STRING_OBJECT_ENUM, G_TYPE_BOOLEAN,
2581 3, G_TYPE_STRING, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_INSERT_ACTION);
2583 webkit_web_view_signals[SHOULD_DELETE_RANGE] = g_signal_new("should-delete-range", G_TYPE_FROM_CLASS(webViewClass),
2584 static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2585 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2586 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_RANGE);
2588 webkit_web_view_signals[SHOULD_SHOW_DELETE_INTERFACE_FOR_ELEMENT] = g_signal_new("should-show-delete-interface-for-element",
2589 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2590 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2591 webkit_marshal_BOOLEAN__OBJECT, G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2593 webkit_web_view_signals[SHOULD_CHANGE_SELECTED_RANGE] = g_signal_new("should-change-selected-range",
2594 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2595 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2596 webkit_marshal_BOOLEAN__OBJECT_OBJECT_ENUM_BOOLEAN, G_TYPE_BOOLEAN,
2597 4, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_DOM_RANGE, WEBKIT_TYPE_SELECTION_AFFINITY, G_TYPE_BOOLEAN);
2599 webkit_web_view_signals[SHOULD_APPLY_STYLE] = g_signal_new("should-apply-style",
2600 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2601 G_STRUCT_OFFSET(WebKitWebViewClass, should_allow_editing_action), g_signal_accumulator_first_wins, 0,
2602 webkit_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN,
2603 2, WEBKIT_TYPE_DOM_CSS_STYLE_DECLARATION, WEBKIT_TYPE_DOM_RANGE);
2605 webkit_web_view_signals[EDITING_BEGAN] = g_signal_new("editing-began",
2606 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2607 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2609 webkit_web_view_signals[USER_CHANGED_CONTENTS] = g_signal_new("user-changed-contents",
2610 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2611 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2613 webkit_web_view_signals[EDITING_ENDED] = g_signal_new("editing-ended",
2614 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2615 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2617 webkit_web_view_signals[SELECTION_CHANGED] = g_signal_new("selection-changed",
2618 G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
2619 g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
2622 * WebKitWebView::viewport-attributes-recompute-requested
2623 * @web_view: the object which received the signal
2624 * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2626 * The #WebKitWebView::viewport-attributes-recompute-requested
2627 * signal will be emitted when a page with a viewport meta tag
2628 * loads and when webkit_viewport_attributes_recompute is called.
2630 * The #WebKitViewportAttributes will have device size, available size,
2631 * desktop width, and device DPI pre-filled by values that make sense
2632 * for the current screen and widget, but you can override those values
2633 * if you have special requirements (for instance, if you made your
2634 * widget bigger than the available visible area, you should override
2635 * the available-width and available-height properties to the actual
2640 webkit_web_view_signals[VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED] = g_signal_new("viewport-attributes-recompute-requested",
2641 G_TYPE_FROM_CLASS(webViewClass),
2642 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2645 g_cclosure_marshal_VOID__OBJECT,
2647 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2650 * WebKitWebView::viewport-attributes-changed
2651 * @web_view: the object which received the signal
2652 * @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
2654 * The #WebKitWebView::viewport-attributes-changed signal will be emitted
2655 * after the emission of #WebKitWebView::viewport-attributes-recompute-requested
2656 * and the subsequent viewport attribute recomputation. At this point,
2657 * if the #WebKitViewportAttributes are valid, the viewport attributes are available.
2661 webkit_web_view_signals[VIEWPORT_ATTRIBUTES_CHANGED] = g_signal_new("viewport-attributes-changed",
2662 G_TYPE_FROM_CLASS(webViewClass),
2663 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2666 g_cclosure_marshal_VOID__OBJECT,
2668 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
2671 * WebKitWebView::entering-fullscreen:
2672 * @web_view: the #WebKitWebView on which the signal is emitted.
2673 * @element: the #WebKitDOMHTMLElement which has requested full screen display.
2675 * Emitted when JavaScript code calls
2676 * <function>element.webkitRequestFullScreen</function>. If the
2677 * signal is not handled the WebView will proceed to full screen
2678 * its top level window. This signal can be used by client code to
2679 * request permission to the user prior doing the full screen
2680 * transition and eventually prepare the top-level window
2681 * (e.g. hide some widgets that would otherwise be part of the
2682 * full screen window).
2684 * Returns: %TRUE to stop other handlers from being invoked for the event.
2685 * %FALSE to continue emission of the event.
2689 webkit_web_view_signals[ENTERING_FULLSCREEN] =
2690 g_signal_new("entering-fullscreen",
2691 G_TYPE_FROM_CLASS(webViewClass),
2693 G_STRUCT_OFFSET(WebKitWebViewClass, entering_fullscreen),
2694 g_signal_accumulator_true_handled, 0,
2695 webkit_marshal_BOOLEAN__OBJECT,
2696 G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2700 * WebKitWebView::leaving-fullscreen:
2701 * @web_view: the #WebKitWebView on which the signal is emitted.
2702 * @element: the #WebKitDOMHTMLElement which is currently displayed full screen.
2704 * Emitted when the WebView is about to restore its top level
2705 * window out of its full screen state. This signal can be used by
2706 * client code to restore widgets hidden during the
2707 * entering-fullscreen stage for instance.
2709 * Returns: %TRUE to stop other handlers from being invoked for the event.
2710 * %FALSE to continue emission of the event.
2714 webkit_web_view_signals[LEAVING_FULLSCREEN] =
2715 g_signal_new("leaving-fullscreen",
2716 G_TYPE_FROM_CLASS(webViewClass),
2718 G_STRUCT_OFFSET(WebKitWebViewClass, leaving_fullscreen),
2719 g_signal_accumulator_true_handled, 0,
2720 webkit_marshal_BOOLEAN__OBJECT,
2721 G_TYPE_BOOLEAN, 1, WEBKIT_TYPE_DOM_HTML_ELEMENT);
2724 * WebKitWebView::resource-response-received
2725 * @webView: the object which received the signal
2726 * @webFrame: the #WebKitWebFrame the response was received for
2727 * @webResource: the #WebKitWebResource being loaded
2728 * @response: the #WebKitNetworkResponse that was received
2730 * Emitted when the first byte of data arrives
2734 webkit_web_view_signals[RESOURCE_RESPONSE_RECEIVED] = g_signal_new("resource-response-received",
2735 G_TYPE_FROM_CLASS(webViewClass),
2739 webkit_marshal_VOID__OBJECT_OBJECT_OBJECT,
2741 WEBKIT_TYPE_WEB_FRAME,
2742 WEBKIT_TYPE_WEB_RESOURCE,
2743 WEBKIT_TYPE_NETWORK_RESPONSE);
2746 * WebKitWebView::resource-load-finished
2747 * @webView: the object which received the signal
2748 * @webFrame: the #WebKitWebFrame the response was received for
2749 * @webResource: the #WebKitWebResource that was loaded
2751 * Emitted when all the data for the resource was loaded
2755 webkit_web_view_signals[RESOURCE_LOAD_FINISHED] = g_signal_new("resource-load-finished",
2756 G_TYPE_FROM_CLASS(webViewClass),
2760 webkit_marshal_VOID__OBJECT_OBJECT,
2762 WEBKIT_TYPE_WEB_FRAME,
2763 WEBKIT_TYPE_WEB_RESOURCE);
2766 * WebKitWebView::resource-content-length-received
2767 * @webView: the object which received the signal
2768 * @webFrame: the #WebKitWebFrame the response was received for
2769 * @webResource: the #WebKitWebResource that was loaded
2770 * @lengthReceived: the resource data length in bytes
2772 * Emitted when the HTTP Content-Length response header has been
2773 * received and parsed successfully.
2777 webkit_web_view_signals[RESOURCE_CONTENT_LENGTH_RECEIVED] = g_signal_new("resource-content-length-received",
2778 G_TYPE_FROM_CLASS(webViewClass),
2782 webkit_marshal_VOID__OBJECT_OBJECT_INT,
2784 WEBKIT_TYPE_WEB_FRAME,
2785 WEBKIT_TYPE_WEB_RESOURCE,
2789 * WebKitWebView::resource-load-failed
2790 * @webView: the object which received the signal
2791 * @webFrame: the #WebKitWebFrame the response was received for
2792 * @webResource: the #WebKitWebResource that was loaded
2793 * @webError: the #GError that was triggered
2795 * Invoked when a resource failed to load
2799 webkit_web_view_signals[RESOURCE_LOAD_FAILED] = g_signal_new("resource-load-failed",
2800 G_TYPE_FROM_CLASS(webViewClass),
2804 webkit_marshal_VOID__OBJECT_OBJECT_POINTER,
2806 WEBKIT_TYPE_WEB_FRAME,
2807 WEBKIT_TYPE_WEB_RESOURCE,
2811 * implementations of virtual methods
2813 webViewClass->create_web_view = webkit_web_view_real_create_web_view;
2814 webViewClass->web_view_ready = webkit_web_view_real_web_view_ready;
2815 webViewClass->close_web_view = webkit_web_view_real_close_web_view;
2816 webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
2817 webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
2818 webViewClass->choose_file = webkit_web_view_real_choose_file;
2819 webViewClass->script_alert = webkit_web_view_real_script_alert;
2820 webViewClass->script_confirm = webkit_web_view_real_script_confirm;
2821 webViewClass->script_prompt = webkit_web_view_real_script_prompt;
2822 webViewClass->console_message = webkit_web_view_real_console_message;
2823 webViewClass->select_all = webkit_web_view_real_select_all;
2824 webViewClass->cut_clipboard = webkit_web_view_real_cut_clipboard;
2825 webViewClass->copy_clipboard = webkit_web_view_real_copy_clipboard;
2826 webViewClass->paste_clipboard = webkit_web_view_real_paste_clipboard;
2827 webViewClass->undo = webkit_web_view_real_undo;
2828 webViewClass->redo = webkit_web_view_real_redo;
2829 webViewClass->move_cursor = webkit_web_view_real_move_cursor;
2830 webViewClass->should_allow_editing_action = webkit_web_view_real_should_allow_editing_action;
2831 webViewClass->entering_fullscreen = webkit_web_view_real_entering_fullscreen;
2832 webViewClass->leaving_fullscreen = webkit_web_view_real_leaving_fullscreen;
2834 GObjectClass* objectClass = G_OBJECT_CLASS(webViewClass);
2835 objectClass->dispose = webkit_web_view_dispose;
2836 objectClass->finalize = webkit_web_view_finalize;
2837 objectClass->get_property = webkit_web_view_get_property;
2838 objectClass->set_property = webkit_web_view_set_property;
2840 GtkWidgetClass* widgetClass = GTK_WIDGET_CLASS(webViewClass);
2841 widgetClass->realize = webkit_web_view_realize;
2842 #ifdef GTK_API_VERSION_2
2843 widgetClass->expose_event = webkit_web_view_expose_event;
2845 widgetClass->draw = webkit_web_view_draw;
2847 widgetClass->key_press_event = webkit_web_view_key_press_event;
2848 widgetClass->key_release_event = webkit_web_view_key_release_event;
2849 widgetClass->button_press_event = webkit_web_view_button_press_event;
2850 widgetClass->button_release_event = webkit_web_view_button_release_event;
2851 widgetClass->motion_notify_event = webkit_web_view_motion_event;
2852 widgetClass->scroll_event = webkit_web_view_scroll_event;
2853 widgetClass->size_allocate = webkit_web_view_size_allocate;
2854 #ifdef GTK_API_VERSION_2
2855 widgetClass->size_request = webkit_web_view_size_request;
2857 widgetClass->get_preferred_width = webkit_web_view_get_preferred_width;
2858 widgetClass->get_preferred_height = webkit_web_view_get_preferred_height;
2860 widgetClass->popup_menu = webkit_web_view_popup_menu_handler;
2861 widgetClass->grab_focus = webkit_web_view_grab_focus;
2862 widgetClass->focus_in_event = webkit_web_view_focus_in_event;
2863 widgetClass->focus_out_event = webkit_web_view_focus_out_event;
2864 widgetClass->get_accessible = webkit_web_view_get_accessible;
2865 widgetClass->screen_changed = webkit_web_view_screen_changed;
2866 widgetClass->drag_end = webkit_web_view_drag_end;
2867 widgetClass->drag_data_get = webkit_web_view_drag_data_get;
2868 widgetClass->drag_motion = webkit_web_view_drag_motion;
2869 widgetClass->drag_leave = webkit_web_view_drag_leave;
2870 widgetClass->drag_drop = webkit_web_view_drag_drop;
2871 widgetClass->drag_data_received = webkit_web_view_drag_data_received;
2872 #if GTK_CHECK_VERSION(2, 12, 0)
2873 widgetClass->query_tooltip = webkit_web_view_query_tooltip;
2874 widgetClass->show_help = webkit_web_view_show_help;
2876 widgetClass->map = webkitWebViewMap;
2878 GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass);
2879 containerClass->add = webkit_web_view_container_add;
2880 containerClass->remove = webkit_web_view_container_remove;
2881 containerClass->forall = webkit_web_view_container_forall;
2884 * make us scrollable (e.g. addable to a GtkScrolledWindow)
2886 #ifdef GTK_API_VERSION_2
2887 webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
2888 GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
2889 G_TYPE_FROM_CLASS(webViewClass),
2890 (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
2891 G_STRUCT_OFFSET(WebKitWebViewClass, set_scroll_adjustments),
2893 webkit_marshal_VOID__OBJECT_OBJECT,
2895 GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
2897 g_object_class_override_property(objectClass, PROP_HADJUSTMENT, "hadjustment");
2898 g_object_class_override_property(objectClass, PROP_VADJUSTMENT, "vadjustment");
2899 g_object_class_override_property(objectClass, PROP_HSCROLL_POLICY, "hscroll-policy");
2900 g_object_class_override_property(objectClass, PROP_VSCROLL_POLICY, "vscroll-policy");
2907 binding_set = gtk_binding_set_by_class(webViewClass);
2909 gtk_binding_entry_add_signal(binding_set, GDK_a, GDK_CONTROL_MASK,
2912 /* Cut/copy/paste */
2914 gtk_binding_entry_add_signal(binding_set, GDK_x, GDK_CONTROL_MASK,
2915 "cut_clipboard", 0);
2916 gtk_binding_entry_add_signal(binding_set, GDK_c, GDK_CONTROL_MASK,
2917 "copy_clipboard", 0);
2918 gtk_binding_entry_add_signal(binding_set, GDK_v, GDK_CONTROL_MASK,
2919 "paste_clipboard", 0);
2920 gtk_binding_entry_add_signal(binding_set, GDK_z, GDK_CONTROL_MASK,
2922 gtk_binding_entry_add_signal(binding_set, GDK_z, static_cast<GdkModifierType>(GDK_CONTROL_MASK | GDK_SHIFT_MASK),
2925 gtk_binding_entry_add_signal(binding_set, GDK_Delete, GDK_SHIFT_MASK,
2926 "cut_clipboard", 0);
2927 gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_CONTROL_MASK,
2928 "copy_clipboard", 0);
2929 gtk_binding_entry_add_signal(binding_set, GDK_Insert, GDK_SHIFT_MASK,
2930 "paste_clipboard", 0);
2934 gtk_binding_entry_add_signal(binding_set, GDK_Down, static_cast<GdkModifierType>(0),
2936 G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
2938 gtk_binding_entry_add_signal(binding_set, GDK_Up, static_cast<GdkModifierType>(0),
2940 G_TYPE_ENUM, GTK_MOVEMENT_DISPLAY_LINES,
2942 gtk_binding_entry_add_signal(binding_set, GDK_Right, static_cast<GdkModifierType>(0),
2944 G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
2946 gtk_binding_entry_add_signal(binding_set, GDK_Left, static_cast<GdkModifierType>(0),
2948 G_TYPE_ENUM, GTK_MOVEMENT_VISUAL_POSITIONS,
2950 gtk_binding_entry_add_signal(binding_set, GDK_space, static_cast<GdkModifierType>(0),
2952 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
2954 gtk_binding_entry_add_signal(binding_set, GDK_space, GDK_SHIFT_MASK,
2956 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
2958 gtk_binding_entry_add_signal(binding_set, GDK_Page_Down, static_cast<GdkModifierType>(0),
2960 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
2962 gtk_binding_entry_add_signal(binding_set, GDK_Page_Up, static_cast<GdkModifierType>(0),
2964 G_TYPE_ENUM, GTK_MOVEMENT_PAGES,
2966 gtk_binding_entry_add_signal(binding_set, GDK_End, static_cast<GdkModifierType>(0),
2968 G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
2970 gtk_binding_entry_add_signal(binding_set, GDK_Home, static_cast<GdkModifierType>(0),
2972 G_TYPE_ENUM, GTK_MOVEMENT_BUFFER_ENDS,
2980 * WebKitWebView:title:
2982 * Returns: the @web_view's document title.
2986 g_object_class_install_property(objectClass, PROP_TITLE,
2987 g_param_spec_string("title",
2989 _("Returns the @web_view's document title"),
2991 WEBKIT_PARAM_READABLE));
2994 * WebKitWebView:uri:
2996 * Returns: the current URI of the contents displayed by the @web_view.
3000 g_object_class_install_property(objectClass, PROP_URI,
3001 g_param_spec_string("uri",
3003 _("Returns the current URI of the contents displayed by the @web_view"),
3005 WEBKIT_PARAM_READABLE));
3008 * WebKitWebView:copy-target-list:
3010 * The list of targets this web view supports for clipboard copying.
3014 g_object_class_install_property(objectClass, PROP_COPY_TARGET_LIST,
3015 g_param_spec_boxed("copy-target-list",
3016 _("Copy target list"),
3017 _("The list of targets this web view supports for clipboard copying"),
3018 GTK_TYPE_TARGET_LIST,
3019 WEBKIT_PARAM_READABLE));
3022 * WebKitWebView:paste-target-list:
3024 * The list of targets this web view supports for clipboard pasting.
3028 g_object_class_install_property(objectClass, PROP_PASTE_TARGET_LIST,
3029 g_param_spec_boxed("paste-target-list",
3030 _("Paste target list"),
3031 _("The list of targets this web view supports for clipboard pasting"),
3032 GTK_TYPE_TARGET_LIST,
3033 WEBKIT_PARAM_READABLE));
3035 g_object_class_install_property(objectClass, PROP_SETTINGS,
3036 g_param_spec_object("settings",
3038 _("An associated WebKitWebSettings instance"),
3039 WEBKIT_TYPE_WEB_SETTINGS,
3040 WEBKIT_PARAM_READWRITE));
3043 * WebKitWebView:web-inspector:
3045 * The associated WebKitWebInspector instance.
3049 g_object_class_install_property(objectClass, PROP_WEB_INSPECTOR,
3050 g_param_spec_object("web-inspector",
3052 _("The associated WebKitWebInspector instance"),
3053 WEBKIT_TYPE_WEB_INSPECTOR,
3054 WEBKIT_PARAM_READABLE));
3057 * WebKitWebView:viewport-attributes:
3059 * The associated #WebKitViewportAttributes instance.
3063 g_object_class_install_property(objectClass, PROP_VIEWPORT_ATTRIBUTES,
3064 g_param_spec_object("viewport-attributes",
3065 _("Viewport Attributes"),
3066 _("The associated WebKitViewportAttributes instance"),
3067 WEBKIT_TYPE_VIEWPORT_ATTRIBUTES,
3068 WEBKIT_PARAM_READABLE));
3071 * WebKitWebView:window-features:
3073 * An associated WebKitWebWindowFeatures instance.
3077 g_object_class_install_property(objectClass, PROP_WINDOW_FEATURES,
3078 g_param_spec_object("window-features",
3080 "An associated WebKitWebWindowFeatures instance",
3081 WEBKIT_TYPE_WEB_WINDOW_FEATURES,
3082 WEBKIT_PARAM_READWRITE));
3084 g_object_class_install_property(objectClass, PROP_EDITABLE,
3085 g_param_spec_boolean("editable",
3087 _("Whether content can be modified by the user"),
3089 WEBKIT_PARAM_READWRITE));
3091 g_object_class_install_property(objectClass, PROP_TRANSPARENT,
3092 g_param_spec_boolean("transparent",
3094 _("Whether content has a transparent background"),
3096 WEBKIT_PARAM_READWRITE));
3099 * WebKitWebView:zoom-level:
3101 * The level of zoom of the content.
3105 g_object_class_install_property(objectClass, PROP_ZOOM_LEVEL,
3106 g_param_spec_float("zoom-level",
3108 _("The level of zoom of the content"),
3112 WEBKIT_PARAM_READWRITE));
3115 * WebKitWebView:full-content-zoom:
3117 * Whether the full content is scaled when zooming.
3121 g_object_class_install_property(objectClass, PROP_FULL_CONTENT_ZOOM,
3122 g_param_spec_boolean("full-content-zoom",
3123 _("Full content zoom"),
3124 _("Whether the full content is scaled when zooming"),
3126 WEBKIT_PARAM_READWRITE));
3129 * WebKitWebView:encoding:
3131 * The default encoding of the web view.
3135 g_object_class_install_property(objectClass, PROP_ENCODING,
3136 g_param_spec_string("encoding",
3138 _("The default encoding of the web view"),
3140 WEBKIT_PARAM_READABLE));
3143 * WebKitWebView:custom-encoding:
3145 * The custom encoding of the web view.
3149 g_object_class_install_property(objectClass, PROP_CUSTOM_ENCODING,
3150 g_param_spec_string("custom-encoding",
3151 _("Custom Encoding"),
3152 _("The custom encoding of the web view"),
3154 WEBKIT_PARAM_READWRITE));
3157 * WebKitWebView:load-status:
3159 * Determines the current status of the load.
3161 * Connect to "notify::load-status" to monitor loading.
3163 * Some versions of WebKitGTK+ emitted this signal for the default
3164 * error page, while loading it. This behavior was considered bad,
3165 * because it was essentially exposing an implementation
3166 * detail. From 1.1.19 onwards this signal is no longer emitted for
3167 * the default error pages, but keep in mind that if you override
3168 * the error pages by using webkit_web_frame_load_alternate_string()
3169 * the signals will be emitted.
3173 g_object_class_install_property(objectClass, PROP_LOAD_STATUS,
3174 g_param_spec_enum("load-status",
3176 "Determines the current status of the load",
3177 WEBKIT_TYPE_LOAD_STATUS,
3178 WEBKIT_LOAD_FINISHED,
3179 WEBKIT_PARAM_READABLE));
3182 * WebKitWebView:progress:
3184 * Determines the current progress of the load.
3188 g_object_class_install_property(objectClass, PROP_PROGRESS,
3189 g_param_spec_double("progress",
3191 "Determines the current progress of the load",
3193 WEBKIT_PARAM_READABLE));
3196 * WebKitWebView:icon-uri:
3198 * The URI for the favicon for the #WebKitWebView.
3202 g_object_class_install_property(objectClass, PROP_ICON_URI,
3203 g_param_spec_string("icon-uri",
3205 _("The URI for the favicon for the #WebKitWebView."),
3207 WEBKIT_PARAM_READABLE));
3209 * WebKitWebView:im-context:
3211 * The GtkIMMulticontext for the #WebKitWebView.
3213 * This is the input method context used for all text entry widgets inside
3214 * the #WebKitWebView. It can be used to generate context menu items for
3215 * controlling the active input method.
3219 g_object_class_install_property(objectClass, PROP_IM_CONTEXT,
3220 g_param_spec_object("im-context",
3222 "The GtkIMMultiContext for the #WebKitWebView.",
3223 GTK_TYPE_IM_CONTEXT,
3224 WEBKIT_PARAM_READABLE));
3227 * WebKitWebView:view-mode:
3229 * The "view-mode" media feature for the #WebKitWebView.
3231 * The "view-mode" media feature is additional information for web
3232 * applications about how the application is running, when it comes
3233 * to user experience. Whether the application is running inside a
3234 * regular browser window, in a dedicated window, fullscreen, for
3237 * This property stores a %WebKitWebViewViewMode value that matches
3238 * the "view-mode" media feature the web application will see.
3240 * See http://www.w3.org/TR/view-mode/ for more information.
3244 g_object_class_install_property(objectClass, PROP_VIEW_MODE,
3245 g_param_spec_enum("view-mode",
3247 "The view-mode media feature for the #WebKitWebView.",
3248 WEBKIT_TYPE_WEB_VIEW_VIEW_MODE,
3249 WEBKIT_WEB_VIEW_VIEW_MODE_WINDOWED,
3250 WEBKIT_PARAM_READWRITE));
3252 // This property should be undocumented for now. It's only used by DRT.
3253 g_object_class_install_property(objectClass, PROP_SELF_SCROLLING,
3254 g_param_spec_boolean("self-scrolling", "Self-scrolling",
3255 "Whether or not this WebView draws its own scrollbars.",
3257 static_cast<GParamFlags>(G_PARAM_CONSTRUCT_ONLY | WEBKIT_PARAM_READWRITE)));
3259 g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate));
3262 static void webkit_web_view_update_settings(WebKitWebView* webView)
3264 WebKitWebSettingsPrivate* settingsPrivate = webView->priv->webSettings->priv;
3265 Settings* coreSettings = core(webView)->settings();
3267 coreSettings->setDefaultTextEncodingName(settingsPrivate->defaultEncoding.data());
3268 coreSettings->setCursiveFontFamily(settingsPrivate->cursiveFontFamily.data());
3269 coreSettings->setStandardFontFamily(settingsPrivate->defaultFontFamily.data());
3270 coreSettings->setFantasyFontFamily(settingsPrivate->fantasyFontFamily.data());
3271 coreSettings->setFixedFontFamily(settingsPrivate->monospaceFontFamily.data());
3272 coreSettings->setSansSerifFontFamily(settingsPrivate->sansSerifFontFamily.data());
3273 coreSettings->setSerifFontFamily(settingsPrivate->serifFontFamily.data());
3274 coreSettings->setLoadsImagesAutomatically(settingsPrivate->autoLoadImages);
3275 coreSettings->setShrinksStandaloneImagesToFit(settingsPrivate->autoShrinkImages);
3276 coreSettings->setShouldPrintBackgrounds(settingsPrivate->printBackgrounds);
3277 coreSettings->setScriptEnabled(settingsPrivate->enableScripts);
3278 coreSettings->setPluginsEnabled(settingsPrivate->enablePlugins);
3279 coreSettings->setTextAreasAreResizable(settingsPrivate->