2008-11-28 Gustavo Noronha Silva <gns@gnome.org>
authorzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Nov 2008 00:20:56 +0000 (00:20 +0000)
committerzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 29 Nov 2008 00:20:56 +0000 (00:20 +0000)
        Reviewed and slightly modified by Holger Freyther.

        https://bugs.webkit.org/show_bug.cgi?id=19130

        ChromeClient::createWindow and friends need to be implemented

        Code from Gustavo Noronha and Marco Barisione
        <marco.barisione@collabora.co.uk> in this change set.

        Implemented all the ChromeClient interfaces needed to have new
        window creation functioning and exposed to client code. We
        implemented a mirror GObject to the WindowFeatures object provided
        by WebCore.

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::windowRect):
        (WebKit::ChromeClient::setWindowRect):
        (WebKit::ChromeClient::unfocus):
        (WebKit::ChromeClient::createWindow):
        (WebKit::ChromeClient::show):
        (WebKit::ChromeClient::setToolbarsVisible):
        (WebKit::ChromeClient::toolbarsVisible):
        (WebKit::ChromeClient::setStatusbarVisible):
        (WebKit::ChromeClient::statusbarVisible):
        (WebKit::ChromeClient::setScrollbarsVisible):
        (WebKit::ChromeClient::scrollbarsVisible):
        (WebKit::ChromeClient::setMenubarVisible):
        (WebKit::ChromeClient::menubarVisible):
        (WebKit::ChromeClient::setResizable):
        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
        (WebKit::FrameLoaderClient::dispatchShow):
        (WebKit::FrameLoaderClient::dispatchCreatePage):
        * webkit/webkit.h:
        * webkit/webkitdefines.h:
        * webkit/webkitprivate.h:
        * webkit/webkitwebview.cpp:
        * webkit/webkitwebview.h:
        * webkit/webkitwebwindowfeatures.cpp: Added.
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_class_init):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_init):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_finalize):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_set_property):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_get_property):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_new):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_new_from_core_features):
        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_equal):
        * webkit/webkitwebwindowfeatures.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@38834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
ChangeLog
GNUmakefile.am
WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
WebKit/gtk/docs/webkitgtk-docs.sgml
WebKit/gtk/docs/webkitgtk-sections.txt
WebKit/gtk/docs/webkitgtk.types
WebKit/gtk/webkit/webkit.h
WebKit/gtk/webkit/webkitdefines.h
WebKit/gtk/webkit/webkitprivate.h
WebKit/gtk/webkit/webkitwebview.cpp
WebKit/gtk/webkit/webkitwebview.h
WebKit/gtk/webkit/webkitwebwindowfeatures.cpp [new file with mode: 0644]
WebKit/gtk/webkit/webkitwebwindowfeatures.h [new file with mode: 0644]

index 34b71a3..ff55c54 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-11-28  Gustavo Noronha Silva  <gns@gnome.org>
+
+        Reviewed and slightly modified by Holger Freyther.
+
+        https://bugs.webkit.org/show_bug.cgi?id=19130
+
+        Added the new WebKitGtk files to be built:
+        WebKit/gtk/webkit/webkitwebwindowfeatures.{cpp,h}
+
+        * GNUmakefile.am:
+
 2008-11-26  Kalle Vahlman  <kalle.vahlman@movial.com>
 
         Reviewed by Darin Adler. Landed by Jan Alonzo.
index 69b8c70..4d44069 100644 (file)
@@ -309,6 +309,7 @@ webkitgtk_h_api += \
        WebKit/gtk/webkit/webkitwebhistoryitem.h \
        WebKit/gtk/webkit/webkitwebinspector.h \
        WebKit/gtk/webkit/webkitwebsettings.h \
+       WebKit/gtk/webkit/webkitwebwindowfeatures.h \
        WebKit/gtk/webkit/webkitwebview.h
 
 webkitgtk_built_sources += \
@@ -341,7 +342,8 @@ webkitgtk_sources += \
        WebKit/gtk/webkit/webkitwebhistoryitem.cpp \
        WebKit/gtk/webkit/webkitwebinspector.cpp \
        WebKit/gtk/webkit/webkitwebsettings.cpp \
-       WebKit/gtk/webkit/webkitwebview.cpp
+       WebKit/gtk/webkit/webkitwebview.cpp \
+       WebKit/gtk/webkit/webkitwebwindowfeatures.cpp
 
 webkitgtk_cppflags += \
        -DBUILDING_WEBKIT \
index 4fa26de..806b42c 100644 (file)
@@ -1,3 +1,54 @@
+2008-11-28  Gustavo Noronha Silva  <gns@gnome.org>
+
+        Reviewed and slightly modified by Holger Freyther.
+
+        https://bugs.webkit.org/show_bug.cgi?id=19130
+
+        ChromeClient::createWindow and friends need to be implemented
+
+        Code from Gustavo Noronha and Marco Barisione
+        <marco.barisione@collabora.co.uk> in this change set.
+
+        Implemented all the ChromeClient interfaces needed to have new
+        window creation functioning and exposed to client code. We
+        implemented a mirror GObject to the WindowFeatures object provided
+        by WebCore.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::windowRect):
+        (WebKit::ChromeClient::setWindowRect):
+        (WebKit::ChromeClient::unfocus):
+        (WebKit::ChromeClient::createWindow):
+        (WebKit::ChromeClient::show):
+        (WebKit::ChromeClient::setToolbarsVisible):
+        (WebKit::ChromeClient::toolbarsVisible):
+        (WebKit::ChromeClient::setStatusbarVisible):
+        (WebKit::ChromeClient::statusbarVisible):
+        (WebKit::ChromeClient::setScrollbarsVisible):
+        (WebKit::ChromeClient::scrollbarsVisible):
+        (WebKit::ChromeClient::setMenubarVisible):
+        (WebKit::ChromeClient::menubarVisible):
+        (WebKit::ChromeClient::setResizable):
+        * WebCoreSupport/FrameLoaderClientGtk.cpp:
+        (WebKit::FrameLoaderClient::dispatchDecidePolicyForNewWindowAction):
+        (WebKit::FrameLoaderClient::dispatchShow):
+        (WebKit::FrameLoaderClient::dispatchCreatePage):
+        * webkit/webkit.h:
+        * webkit/webkitdefines.h:
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebview.cpp:
+        * webkit/webkitwebview.h:
+        * webkit/webkitwebwindowfeatures.cpp: Added.
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_class_init):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_init):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_finalize):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_set_property):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_get_property):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_new):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_new_from_core_features):
+        (_WebKitWebWindowFeaturesPrivate::webkit_web_window_features_equal):
+        * webkit/webkitwebwindowfeatures.h: Added.
+
 2008-11-24  Darin Fisher  <darin@chromium.org>
 
         Fix bustage.
index c58d999..741cf71 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2007, 2008 Christian Dywan <christian@imendio.com>
  * Copyright (C) 2008 Nuanti Ltd.
  * Copyright (C) 2008 Alp Toker <alp@atoker.com>
+ * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
 #include "FileSystem.h"
 #include "FileChooser.h"
 #include "FloatRect.h"
+#include "FrameLoadRequest.h"
 #include "IntRect.h"
 #include "PlatformString.h"
 #include "CString.h"
 #include "HitTestResult.h"
 #include "KURL.h"
 #include "webkitwebview.h"
+#include "webkitnetworkrequest.h"
 #include "webkitprivate.h"
 #include "NotImplemented.h"
 #include "WindowFeatures.h"
@@ -61,7 +64,7 @@ FloatRect ChromeClient::windowRect()
     if (!m_webView)
         return FloatRect();
     GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
-    if (window) {
+    if (GTK_WIDGET_TOPLEVEL(window)) {
         gint left, top, width, height;
         gtk_window_get_position(GTK_WINDOW(window), &left, &top);
         gtk_window_get_size(GTK_WINDOW(window), &width, &height);
@@ -70,9 +73,20 @@ FloatRect ChromeClient::windowRect()
     return FloatRect();
 }
 
-void ChromeClient::setWindowRect(const FloatRect& r)
+void ChromeClient::setWindowRect(const FloatRect& rect)
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    IntRect intrect = IntRect(rect);
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+
+    g_object_set(G_OBJECT(webWindowFeatures),
+                 "x", intrect.x(),
+                 "y", intrect.y(),
+                 "width", intrect.width(),
+                 "height", intrect.height(),
+                 NULL);
 }
 
 FloatRect ChromeClient::pageRect()
@@ -101,29 +115,35 @@ void ChromeClient::unfocus()
     if (!m_webView)
         return;
     GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
-    if (window)
+    if (GTK_WIDGET_TOPLEVEL(window))
         gtk_window_set_focus(GTK_WINDOW(window), NULL);
 }
 
-Page* ChromeClient::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features)
+Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& coreFeatures)
 {
-    if (features.dialog) {
-        notImplemented();
+    WebKitWebView* webView = 0;
+
+    g_signal_emit_by_name(m_webView, "create-web-view", kit(frame), &webView);
+
+    if (!webView)
         return 0;
-    } else {
-        /* TODO: FrameLoadRequest is not used */
-        WebKitWebView* webView = WEBKIT_WEB_VIEW_GET_CLASS(m_webView)->create_web_view(m_webView);
-        if (!webView)
-            return 0;
-
-        WebKitWebViewPrivate* privateData = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
-        return privateData->corePage;
-    }
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_window_features_new_from_core_features(coreFeatures);
+    webkit_web_view_set_window_features(webView, webWindowFeatures);
+    g_object_unref(G_OBJECT(webWindowFeatures));
+
+    if (!frameLoadRequest.isEmpty())
+        webkit_web_view_open(webView, frameLoadRequest.resourceRequest().url().string().utf8().data());
+
+    return core(webView);
 }
 
 void ChromeClient::show()
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    webkit_web_view_notify_ready(m_webView);
 }
 
 bool ChromeClient::canRunModal()
@@ -137,52 +157,96 @@ void ChromeClient::runModal()
     notImplemented();
 }
 
-void ChromeClient::setToolbarsVisible(bool)
+void ChromeClient::setToolbarsVisible(bool visible)
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+
+    g_object_set(G_OBJECT(webWindowFeatures), "toolbar-visible", visible, NULL);
 }
 
 bool ChromeClient::toolbarsVisible()
 {
-    notImplemented();
-    return false;
+    if (!m_webView)
+        return false;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+    gboolean visible;
+
+    g_object_get(G_OBJECT(webWindowFeatures), "toolbar-visible", &visible, NULL);
+    return visible;
 }
 
-void ChromeClient::setStatusbarVisible(bool)
+void ChromeClient::setStatusbarVisible(bool visible)
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+
+    g_object_set(G_OBJECT(webWindowFeatures), "statusbar-visible", visible, NULL);
 }
 
 bool ChromeClient::statusbarVisible()
 {
-    notImplemented();
-    return false;
+    if (!m_webView)
+        return false;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+    gboolean visible;
+
+    g_object_get(G_OBJECT(webWindowFeatures), "statusbar-visible", &visible, NULL);
+    return visible;
 }
 
-void ChromeClient::setScrollbarsVisible(bool)
+void ChromeClient::setScrollbarsVisible(bool visible)
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+
+    g_object_set(G_OBJECT(webWindowFeatures), "scrollbar-visible", visible, NULL);
 }
 
 bool ChromeClient::scrollbarsVisible() {
-    notImplemented();
-    return false;
+    if (!m_webView)
+        return false;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+    gboolean visible;
+
+    g_object_get(G_OBJECT(webWindowFeatures), "scrollbar-visible", &visible, NULL);
+    return visible;
 }
 
-void ChromeClient::setMenubarVisible(bool)
+void ChromeClient::setMenubarVisible(bool visible)
 {
-    notImplemented();
+    if (!m_webView)
+        return;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+
+    g_object_set(G_OBJECT(webWindowFeatures), "menubar-visible", visible, NULL);
 }
 
 bool ChromeClient::menubarVisible()
 {
-    notImplemented();
-    return false;
+    if (!m_webView)
+        return false;
+
+    WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
+    gboolean visible;
+
+    g_object_get(G_OBJECT(webWindowFeatures), "menubar-visible", &visible, NULL);
+    return visible;
 }
 
 void ChromeClient::setResizable(bool)
 {
-    notImplemented();
+    // Ignored for now
 }
 
 void ChromeClient::closeWindowSoon()
index f94f396..4c59d01 100644 (file)
@@ -44,6 +44,7 @@
 #include "JSDOMBinding.h"
 #include "ScriptController.h"
 #include "webkitwebview.h"
+#include "webkitnetworkrequest.h"
 #include "webkitwebframe.h"
 #include "webkitprivate.h"
 
@@ -258,7 +259,7 @@ void FrameLoaderClient::dispatchDecidePolicyForNewWindowAction(FramePolicyFuncti
         return;
     // FIXME: I think Qt version marshals this to another thread so when we
     // have multi-threaded download, we might need to do the same
-    (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
+    (core(m_frame)->loader()->*policyFunction)(PolicyUse);
 }
 
 void FrameLoaderClient::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction& action, const ResourceRequest& resourceRequest, PassRefPtr<FormState>)
@@ -543,7 +544,8 @@ void FrameLoaderClient::dispatchDidFirstLayout()
 
 void FrameLoaderClient::dispatchShow()
 {
-    notImplemented();
+    WebKitWebView* webView = getViewFromFrame(m_frame);
+    webkit_web_view_notify_ready(webView);
 }
 
 void FrameLoaderClient::cancelPolicyCheck()
@@ -716,8 +718,16 @@ bool FrameLoaderClient::canCachePage() const
 
 Frame* FrameLoaderClient::dispatchCreatePage()
 {
-    notImplemented();
-    return 0;
+    WebKitWebView* webView = getViewFromFrame(m_frame);
+    WebKitWebView* newWebView = 0;
+
+    g_signal_emit_by_name(webView, "create-web-view", m_frame, &newWebView);
+
+    if (!newWebView)
+        return 0;
+
+    WebKitWebViewPrivate* privateData = WEBKIT_WEB_VIEW_GET_PRIVATE(newWebView);
+    return core(privateData->mainFrame);
 }
 
 void FrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
index 9b41ed6..655a991 100644 (file)
@@ -20,6 +20,7 @@
     <xi:include href="xml/webkitwebhistoryitem.xml"/>
     <xi:include href="xml/webkitnetworkrequest.xml"/>
     <xi:include href="xml/webkitwebinspector.xml"/>
+    <xi:include href="xml/webkitwebwindowfeatures.xml"/>
   </chapter>
 
   <index id="index-all">
index fd200fa..2f9cc59 100644 (file)
@@ -201,6 +201,8 @@ webkit_web_view_target_info_get_type
 webkit_web_view_unmark_text_matches
 webkit_web_view_zoom_in
 webkit_web_view_zoom_out
+webkit_web_view_get_window_features
+webkit_web_view_set_window_features
 <SUBSECTION Standard>
 WEBKIT_WEB_VIEW
 WEBKIT_IS_WEB_VIEW
@@ -217,6 +219,26 @@ WEBKIT_WEB_VIEW_GET_PRIVATE
 </SECTION>
 
 <SECTION>
+<FILE>webkitwebwindowfeatures</FILE>
+<TITLE>WebKitWebWindowFeatures</TITLE>
+WebKitWebWindowFeatures
+webkit_web_window_features_equal
+webkit_web_window_features_new
+<SUBSECTION Standard>
+WEBKIT_IS_WEB_WINDOW_FEATURES
+WEBKIT_IS_WEB_WINDOW_FEATURES_CLASS
+WEBKIT_TYPE_WEB_WINDOW_FEATURES
+WEBKIT_WEB_WINDOW_FEATURES
+WEBKIT_WEB_WINDOW_FEATURES_CLASS
+WEBKIT_WEB_WINDOW_FEATURES_GET_CLASS
+<SUBSECTION Private>
+webkit_web_window_features_get_type
+WebKitWebWindowFeatures
+WebKitWebWindowFeaturesClass
+WebKitWebWindowFeaturesPrivate
+</SECTION>
+
+<SECTION>
 <FILE>webkit</FILE>
 webkit_init
 </SECTION>
index 90377c1..b8ed5be 100644 (file)
@@ -8,4 +8,5 @@ webkit_web_settings_get_type
 webkit_web_view_get_type
 webkit_navigation_response_get_type
 webkit_web_view_target_info_get_type
+webkit_web_window_features_get_type
 
index e19cbc7..8621e46 100644 (file)
@@ -26,6 +26,7 @@
 #include <webkit/webkitwebframe.h>
 #include <webkit/webkitwebsettings.h>
 #include <webkit/webkitwebinspector.h>
+#include <webkit/webkitwebwindowfeatures.h>
 #include <webkit/webkitwebview.h>
 #include <webkit/webkitwebbackforwardlist.h>
 #include <webkit/webkitwebhistoryitem.h>
index 0c080f4..b674e9f 100644 (file)
@@ -58,6 +58,9 @@ typedef struct _WebKitWebSettingsClass WebKitWebSettingsClass;
 typedef struct _WebKitWebInspector WebKitWebInspector;
 typedef struct _WebKitWebInspectorClass WebKitWebInspectorClass;
 
+typedef struct _WebKitWebWindowFeatures WebKitWebWindowFeatures;
+typedef struct _WebKitWebWindowFeaturesClass WebKitWebWindowFeaturesClass;
+
 typedef struct _WebKitWebView WebKitWebView;
 typedef struct _WebKitWebViewClass WebKitWebViewClass;
 
index ec24796..d513758 100644 (file)
@@ -30,6 +30,7 @@
 #include <webkit/webkitwebview.h>
 #include <webkit/webkitwebframe.h>
 #include <webkit/webkitwebsettings.h>
+#include <webkit/webkitwebwindowfeatures.h>
 #include <webkit/webkitwebbackforwardlist.h>
 
 #include "BackForwardList.h"
@@ -39,6 +40,7 @@
 #include "Frame.h"
 #include "InspectorClientGtk.h"
 #include "FrameLoaderClient.h"
+#include "WindowFeatures.h"
 
 #include <glib.h>
 
@@ -69,6 +71,7 @@ extern "C" {
         WebCore::Page* corePage;
         WebKitWebSettings* webSettings;
         WebKitWebInspector* webInspector;
+        WebKitWebWindowFeatures* webWindowFeatures;
 
         WebKitWebFrame* mainFrame;
         WebCore::String applicationNameForUserAgent;
@@ -121,6 +124,12 @@ extern "C" {
     void
     webkit_web_inspector_set_inspected_uri(WebKitWebInspector* web_inspector, const gchar* inspected_uri);
 
+    WebKitWebWindowFeatures*
+    webkit_web_window_features_new_from_core_features (const WebCore::WindowFeatures& features);
+
+    void
+    webkit_web_view_notify_ready (WebKitWebView* web_view);
+
     // FIXME: Move these to webkitwebframe.h once their API has been discussed.
 
     WEBKIT_API GSList*
index ee4d841..dacbc2e 100644 (file)
@@ -4,6 +4,7 @@
  *  Copyright (C) 2007 Xan Lopez <xan@gnome.org>
  *  Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com>
  *  Copyright (C) 2008 Jan Alonzo <jmalonzo@unpluggable.com>
+ *  Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
  *  Copyright (C) 2008 Nuanti Ltd.
  *  Copyright (C) 2008 Collabora Ltd.
  *
@@ -74,6 +75,8 @@ extern "C" {
 enum {
     /* normal signals */
     NAVIGATION_REQUESTED,
+    CREATE_WEB_VIEW,
+    WEB_VIEW_READY,
     WINDOW_OBJECT_CLEARED,
     LOAD_STARTED,
     LOAD_COMMITTED,
@@ -104,6 +107,7 @@ enum {
     PROP_EDITABLE,
     PROP_SETTINGS,
     PROP_WEB_INSPECTOR,
+    PROP_WINDOW_FEATURES,
     PROP_TRANSPARENT,
     PROP_ZOOM_LEVEL,
     PROP_FULL_CONTENT_ZOOM
@@ -246,6 +250,9 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue*
     case PROP_WEB_INSPECTOR:
         g_value_set_object(value, webkit_web_view_get_inspector(webView));
         break;
+    case PROP_WINDOW_FEATURES:
+        g_value_set_object(value, webkit_web_view_get_window_features(webView));
+        break;
     case PROP_TRANSPARENT:
         g_value_set_boolean(value, webkit_web_view_get_transparent(webView));
         break;
@@ -271,6 +278,9 @@ static void webkit_web_view_set_property(GObject* object, guint prop_id, const G
     case PROP_SETTINGS:
         webkit_web_view_set_settings(webView, WEBKIT_WEB_SETTINGS(g_value_get_object(value)));
         break;
+    case PROP_WINDOW_FEATURES:
+        webkit_web_view_set_window_features(webView, WEBKIT_WEB_WINDOW_FEATURES(g_value_get_object(value)));
+        break;
     case PROP_TRANSPARENT:
         webkit_web_view_set_transparent(webView, g_value_get_boolean(value));
         break;
@@ -605,12 +615,16 @@ static void webkit_web_view_container_forall(GtkContainer* container, gboolean,
         (*callback)(*current, callbackData);
 }
 
-static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*)
+static WebKitWebView* webkit_web_view_real_create_web_view(WebKitWebView*, WebKitWebFrame*)
 {
-    notImplemented();
     return 0;
 }
 
+static gboolean webkit_web_view_real_web_view_ready(WebKitWebView*)
+{
+    return FALSE;
+}
+
 static WebKitNavigationResponse webkit_web_view_real_navigation_requested(WebKitWebView*, WebKitWebFrame* frame, WebKitNetworkRequest*)
 {
     notImplemented();
@@ -770,6 +784,7 @@ static void webkit_web_view_finalize(GObject* object)
     g_signal_handlers_disconnect_by_func(priv->webSettings, (gpointer)webkit_web_view_settings_notify, webView);
     g_object_unref(priv->webSettings);
     g_object_unref(priv->webInspector);
+    g_object_unref(priv->webWindowFeatures);
     g_object_unref(priv->mainFrame);
     g_object_unref(priv->imContext);
     gtk_target_list_unref(priv->copy_target_list);
@@ -779,6 +794,18 @@ static void webkit_web_view_finalize(GObject* object)
     G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
 }
 
+static gboolean webkit_create_web_view_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
+{
+  gboolean continueEmission = TRUE;
+  gpointer newWebView = g_value_get_object(handlerReturn);
+  g_value_set_object(returnAccu, newWebView);
+
+  if (newWebView)
+      continueEmission = FALSE;
+
+  return continueEmission;
+}
+
 static gboolean webkit_navigation_request_handled(GSignalInvocationHint* ihint, GValue* returnAccu, const GValue* handlerReturn, gpointer dummy)
 {
   gboolean continueEmission = TRUE;
@@ -821,6 +848,63 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
      * Signals
      */
 
+    /**
+     * WebKitWebView::create-web-view:
+     * @web_view: the object on which the signal is emitted
+     * @frame: the #WebKitWebFrame
+     * @return: a newly allocated #WebKitWebView or %NULL
+     *
+     * Emitted when the creation of a new window is requested.
+     * If this signal is handled the signal handler should return the
+     * newly created #WebKitWebView.
+     *
+     * The new #WebKitWebView should not be displayed to the user
+     * until the #WebKitWebView::web-view-ready signal is emitted.
+     *
+     * The signal handlers should not try to deal with the reference
+     * count for the new #WebKitWebView. The widget to which the
+     * widget is added will handle that.
+     *
+     * Since 1.0.3
+     */
+    webkit_web_view_signals[CREATE_WEB_VIEW] = g_signal_new("create-web-view",
+            G_TYPE_FROM_CLASS(webViewClass),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            G_STRUCT_OFFSET (WebKitWebViewClass, create_web_view),
+            webkit_create_web_view_request_handled,
+            NULL,
+            webkit_marshal_OBJECT__OBJECT,
+            WEBKIT_TYPE_WEB_VIEW , 1,
+            WEBKIT_TYPE_WEB_FRAME);
+
+    /**
+     * WebKitWebView::web-view-ready:
+     * @web_view: the object on which the signal is emitted
+     * @return: %TRUE to stop other handlers from being invoked for
+     * the event, %FALSE to propagate the event further
+     *
+     * Emitted after #WebKitWebView::create-web-view when the new #WebKitWebView
+     * should be displayed to the user. When this signal is emitted
+     * all the information about how the window should look, including
+     * size, position, whether the location, status and scroll bars
+     * should be displayed, is already set on the
+     * #WebKitWebWindowFeatures object contained by the #WebKitWebView.
+     *
+     * Notice that some of that information may change during the life
+     * time of the window, so you may want to connect to the ::notify
+     * signal of the #WebKitWebWindowFeatures object to handle those.
+     *
+     * Since 1.0.3
+     */
+    webkit_web_view_signals[WEB_VIEW_READY] = g_signal_new("web-view-ready",
+            G_TYPE_FROM_CLASS(webViewClass),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST),
+            G_STRUCT_OFFSET (WebKitWebViewClass, web_view_ready),
+            g_signal_accumulator_true_handled,
+            NULL,
+            webkit_marshal_BOOLEAN__VOID,
+            G_TYPE_BOOLEAN, 0);
+
     webkit_web_view_signals[NAVIGATION_REQUESTED] = g_signal_new("navigation-requested",
             G_TYPE_FROM_CLASS(webViewClass),
             (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
@@ -1156,6 +1240,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
      * implementations of virtual methods
      */
     webViewClass->create_web_view = webkit_web_view_real_create_web_view;
+    webViewClass->web_view_ready = webkit_web_view_real_web_view_ready;
     webViewClass->navigation_requested = webkit_web_view_real_navigation_requested;
     webViewClass->window_object_cleared = webkit_web_view_real_window_object_cleared;
     webViewClass->choose_file = webkit_web_view_real_choose_file;
@@ -1286,6 +1371,20 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
                                                         WEBKIT_TYPE_WEB_INSPECTOR,
                                                         WEBKIT_PARAM_READABLE));
 
+    /**
+    * WebKitWebView:window-features:
+    *
+    * An associated WebKitWebWindowFeatures instance.
+    *
+    * Since: 1.0.3
+    */
+    g_object_class_install_property(objectClass, PROP_WINDOW_FEATURES,
+                                    g_param_spec_object("window-features",
+                                                        "Window Features",
+                                                        "An associated WebKitWebWindowFeatures instance",
+                                                        WEBKIT_TYPE_WEB_WINDOW_FEATURES,
+                                                        WEBKIT_PARAM_READWRITE));
+
     g_object_class_install_property(objectClass, PROP_EDITABLE,
                                     g_param_spec_boolean("editable",
                                                          "Editable",
@@ -1540,6 +1639,8 @@ static void webkit_web_view_init(WebKitWebView* webView)
     webkit_web_view_update_settings(webView);
     g_signal_connect(webView, "screen-changed", G_CALLBACK(webkit_web_view_screen_changed), NULL);
     g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView);
+
+    priv->webWindowFeatures = webkit_web_window_features_new();
 }
 
 GtkWidget* webkit_web_view_new(void)
@@ -1549,6 +1650,16 @@ GtkWidget* webkit_web_view_new(void)
     return GTK_WIDGET(webView);
 }
 
+// for internal use only
+void webkit_web_view_notify_ready(WebKitWebView* webView)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+
+    gboolean isHandled = FALSE;
+    g_signal_emit(webView, webkit_web_view_signals[WEB_VIEW_READY], 0, &isHandled);
+}
+
+
 void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* webSettings)
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
@@ -1597,6 +1708,52 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView)
 }
 
 /**
+ * webkit_web_view_set_window_features
+ * @web_view: a #WebKitWebView
+ * @window_features: a #WebKitWebWindowFeatures
+ *
+ * This will set how the window containing the #WebKitWebView should
+ * look and behave. Applications may want to monitor this property and
+ * apply the settings it carries to the window holding the relevant
+ * #WebKitWebView.
+ *
+ * Since: 1.0.3
+ */
+void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+    g_return_if_fail(WEBKIT_IS_WEB_WINDOW_FEATURES(webWindowFeatures));
+
+    WebKitWebViewPrivate* priv = webView->priv;
+
+    if(webkit_web_window_features_equal(priv->webWindowFeatures, webWindowFeatures))
+      return;
+
+    g_object_unref(priv->webWindowFeatures);
+    g_object_ref(webWindowFeatures);
+    priv->webWindowFeatures = webWindowFeatures;
+}
+
+/**
+ * webkit_web_view_get_window_features
+ * @web_view: a #WebKitWebView
+ *
+ * Returns the instance of #WebKitWebWindowFeatures held by the given
+ * #WebKitWebView.
+ *
+ * Return value: the #WebKitWebWindowFeatures
+ *
+ * Since: 1.0.3
+ */
+WebKitWebWindowFeatures* webkit_web_view_get_window_features(WebKitWebView* webView)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
+
+    WebKitWebViewPrivate* priv = webView->priv;
+    return priv->webWindowFeatures;
+}
+
+/**
  * webkit_web_view_set_maintains_back_forward_list:
  * @web_view: a #WebKitWebView
  * @flag: to tell the view to maintain a back or forward list
index c7ad590..218bf78 100644 (file)
@@ -65,11 +65,11 @@ struct _WebKitWebViewClass {
     /*< public >*/
     /*
      * default handler/virtual methods
-     * DISCUSS: create_web_view needs a request and should we make this a signal with default handler? this would
-     * require someone doing a g_signal_stop_emission_by_name
-     * WebUIDelegate has nothing for create_frame, WebPolicyDelegate as well...
      */
-    WebKitWebView            * (* create_web_view)        (WebKitWebView* web_view);
+    WebKitWebView            * (* create_web_view)        (WebKitWebView        *web_view,
+                                                           WebKitWebFrame       *web_frame);
+
+    gboolean                   (* web_view_ready)          (WebKitWebView* web_view);
 
     /*
      * TODO: FIXME: Create something like WebPolicyDecisionListener_Protocol instead
@@ -252,6 +252,13 @@ webkit_web_view_get_settings                    (WebKitWebView        *web_view)
 WEBKIT_API WebKitWebInspector *
 webkit_web_view_get_inspector                   (WebKitWebView        *web_view);
 
+WEBKIT_API void
+webkit_web_view_set_window_features             (WebKitWebView        *web_view,
+                                                 WebKitWebWindowFeatures *window_features);
+
+WEBKIT_API WebKitWebWindowFeatures*
+webkit_web_view_get_window_features             (WebKitWebView        *web_view);
+
 WEBKIT_API gboolean
 webkit_web_view_get_transparent                 (WebKitWebView        *web_view);
 
diff --git a/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp b/WebKit/gtk/webkit/webkitwebwindowfeatures.cpp
new file mode 100644 (file)
index 0000000..4a7a8c1
--- /dev/null
@@ -0,0 +1,412 @@
+/*
+ * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include "WindowFeatures.h"
+#include "webkitwebwindowfeatures.h"
+#include "webkitprivate.h"
+
+extern "C" {
+
+enum {
+    PROP_0,
+
+    PROP_X,
+    PROP_Y,
+    PROP_WIDTH,
+    PROP_HEIGHT,
+    PROP_TOOLBAR_VISIBLE,
+    PROP_STATUSBAR_VISIBLE,
+    PROP_SCROLLBAR_VISIBLE,
+    PROP_MENUBAR_VISIBLE,
+    PROP_LOCATIONBAR_VISIBLE,
+    PROP_FULLSCREEN,
+};
+
+G_DEFINE_TYPE(WebKitWebWindowFeatures, webkit_web_window_features, G_TYPE_OBJECT)
+
+struct _WebKitWebWindowFeaturesPrivate {
+    gint x;
+    gint y;
+    gint width;
+    gint height;
+
+    gboolean toolbar_visible;
+    gboolean statusbar_visible;
+    gboolean scrollbar_visible;
+    gboolean menubar_visible;
+    gboolean locationbar_visible;
+
+    gboolean fullscreen;
+};
+
+#define WEBKIT_WEB_WINDOW_FEATURES_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_WINDOW_FEATURES, WebKitWebWindowFeaturesPrivate))
+
+static void webkit_web_window_features_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
+
+static void webkit_web_window_features_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);
+
+static void webkit_web_window_features_class_init(WebKitWebWindowFeaturesClass* klass)
+{
+    GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
+    gobject_class->set_property = webkit_web_window_features_set_property;
+    gobject_class->get_property = webkit_web_window_features_get_property;
+
+    GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);
+
+    /**
+     * WebKitWebWindowFeatures:x:
+     *
+     * The starting x position of the window on the screen.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_X,
+                                    g_param_spec_int(
+                                    "x",
+                                    "x",
+                                    "The starting x position of the window on the screen.",
+                                    -1,
+                                    G_MAXINT,
+                                    -1,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:y:
+     *
+     * The starting y position of the window on the screen.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_Y,
+                                    g_param_spec_int(
+                                    "y",
+                                    "y",
+                                    "The starting y position of the window on the screen.",
+                                    -1,
+                                    G_MAXINT,
+                                    -1,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:width:
+     *
+     * The width of the window on the screen.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_WIDTH,
+                                    g_param_spec_int(
+                                    "width",
+                                    "Width",
+                                    "The width of the window on the screen.",
+                                    -1,
+                                    G_MAXINT,
+                                    -1,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:height:
+     *
+     * The height of the window on the screen.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_HEIGHT,
+                                    g_param_spec_int(
+                                    "height",
+                                    "Height",
+                                    "The height of the window on the screen.",
+                                    -1,
+                                    G_MAXINT,
+                                    -1,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:toolbar-visible:
+     *
+     * Controls whether the toolbar should be visible for the window.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_TOOLBAR_VISIBLE,
+                                    g_param_spec_boolean(
+                                    "toolbar-visible",
+                                    "Toolbar Visible",
+                                    "Controls whether the toolbar should be visible for the window.",
+                                    TRUE,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:statusbar-visible:
+     *
+     * Controls whether the statusbar should be visible for the window.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_STATUSBAR_VISIBLE,
+                                    g_param_spec_boolean(
+                                    "statusbar-visible",
+                                    "Statusbar Visible",
+                                    "Controls whether the statusbar should be visible for the window.",
+                                    TRUE,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:scrollbar-visible:
+     *
+     * Controls whether the scrollbars should be visible for the window.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_SCROLLBAR_VISIBLE,
+                                    g_param_spec_boolean(
+                                    "scrollbar-visible",
+                                    "Scrollbar Visible",
+                                    "Controls whether the scrollbars should be visible for the window.",
+                                    TRUE,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:menubar-visible:
+     *
+     * Controls whether the menubar should be visible for the window.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_MENUBAR_VISIBLE,
+                                    g_param_spec_boolean(
+                                    "menubar-visible",
+                                    "Menubar Visible",
+                                    "Controls whether the menubar should be visible for the window.",
+                                    TRUE,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:locationbar-visible:
+     *
+     * Controls whether the locationbar should be visible for the window.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_LOCATIONBAR_VISIBLE,
+                                    g_param_spec_boolean(
+                                    "locationbar-visible",
+                                    "Locationbar Visible",
+                                    "Controls whether the locationbar should be visible for the window.",
+                                    TRUE,
+                                    flags));
+
+    /**
+     * WebKitWebWindowFeatures:fullscreen:
+     *
+     * Controls whether window will be displayed fullscreen.
+     *
+     * Since: 1.0.3
+     */
+    g_object_class_install_property(gobject_class,
+                                    PROP_FULLSCREEN,
+                                    g_param_spec_boolean(
+                                    "fullscreen",
+                                    "Fullscreen",
+                                    "Controls whether window will be displayed fullscreen.",
+                                    FALSE,
+                                    flags));
+
+
+    g_type_class_add_private(klass, sizeof(WebKitWebWindowFeaturesPrivate));
+}
+
+static void webkit_web_window_features_init(WebKitWebWindowFeatures* web_window_features)
+{
+    web_window_features->priv = WEBKIT_WEB_WINDOW_FEATURES_GET_PRIVATE(web_window_features);
+}
+
+static void webkit_web_window_features_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
+{
+    WebKitWebWindowFeatures* web_window_features = WEBKIT_WEB_WINDOW_FEATURES(object);
+    WebKitWebWindowFeaturesPrivate* priv = web_window_features->priv;
+
+    switch(prop_id) {
+    case PROP_X:
+        priv->x = g_value_get_int(value);
+        break;
+    case PROP_Y:
+        priv->y = g_value_get_int(value);
+        break;
+    case PROP_WIDTH:
+        priv->width = g_value_get_int(value);
+        break;
+    case PROP_HEIGHT:
+        priv->height = g_value_get_int(value);
+        break;
+    case PROP_TOOLBAR_VISIBLE:
+        priv->toolbar_visible = g_value_get_boolean(value);
+        break;
+    case PROP_STATUSBAR_VISIBLE:
+        priv->statusbar_visible = g_value_get_boolean(value);
+        break;
+    case PROP_SCROLLBAR_VISIBLE:
+        priv->scrollbar_visible = g_value_get_boolean(value);
+        break;
+    case PROP_MENUBAR_VISIBLE:
+        priv->menubar_visible = g_value_get_boolean(value);
+        break;
+    case PROP_LOCATIONBAR_VISIBLE:
+        priv->locationbar_visible = g_value_get_boolean(value);
+        break;
+    case PROP_FULLSCREEN:
+        priv->fullscreen = g_value_get_boolean(value);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
+    }
+}
+
+static void webkit_web_window_features_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
+{
+    WebKitWebWindowFeatures* web_window_features = WEBKIT_WEB_WINDOW_FEATURES(object);
+    WebKitWebWindowFeaturesPrivate* priv = web_window_features->priv;
+
+    switch (prop_id) {
+    case PROP_X:
+        g_value_set_int(value, priv->x);
+        break;
+    case PROP_Y:
+        g_value_set_int(value, priv->y);
+        break;
+    case PROP_WIDTH:
+        g_value_set_int(value, priv->width);
+        break;
+    case PROP_HEIGHT:
+        g_value_set_int(value, priv->height);
+        break;
+    case PROP_TOOLBAR_VISIBLE:
+        g_value_set_boolean(value, priv->toolbar_visible);
+        break;
+    case PROP_STATUSBAR_VISIBLE:
+        g_value_set_boolean(value, priv->statusbar_visible);
+        break;
+    case PROP_SCROLLBAR_VISIBLE:
+        g_value_set_boolean(value, priv->scrollbar_visible);
+        break;
+    case PROP_MENUBAR_VISIBLE:
+        g_value_set_boolean(value, priv->menubar_visible);
+        break;
+    case PROP_LOCATIONBAR_VISIBLE:
+        g_value_set_boolean(value, priv->locationbar_visible);
+        break;
+    case PROP_FULLSCREEN:
+        g_value_set_boolean(value, priv->fullscreen);
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+        break;
+    }
+}
+
+/**
+ * webkit_web_window_features_new:
+ *
+ * Creates a new #WebKitWebWindowFeatures instance with default values. It must
+ * be manually attached to a WebView.
+ *
+ * Returns: a new #WebKitWebWindowFeatures instance
+ *
+ * Since 1.0.3
+ */
+WebKitWebWindowFeatures* webkit_web_window_features_new()
+{
+    return WEBKIT_WEB_WINDOW_FEATURES(g_object_new(WEBKIT_TYPE_WEB_WINDOW_FEATURES, NULL));
+}
+
+// for internal use only
+WebKitWebWindowFeatures* webkit_web_window_features_new_from_core_features(const WebCore::WindowFeatures& features)
+{
+    WebKitWebWindowFeatures *webWindowFeatures = webkit_web_window_features_new();
+
+    if(features.xSet)
+        g_object_set(G_OBJECT(webWindowFeatures), "x", static_cast<int>(features.x), NULL);
+
+    if(features.ySet)
+        g_object_set(G_OBJECT(webWindowFeatures), "y", static_cast<int>(features.y), NULL);
+
+    if(features.widthSet)
+        g_object_set(G_OBJECT(webWindowFeatures), "width", static_cast<int>(features.width), NULL);
+
+    if(features.heightSet)
+        g_object_set(G_OBJECT(webWindowFeatures), "height", static_cast<int>(features.height), NULL);
+
+    g_object_set(G_OBJECT(webWindowFeatures),
+                 "toolbar-visible", features.toolBarVisible,
+                 "statusbar-visible", features.statusBarVisible,
+                 "scrollbar-visible", features.scrollbarsVisible,
+                 "menubar-visible", features.menuBarVisible,
+                 "locationbar-visible", features.locationBarVisible,
+                 "fullscreen", features.fullscreen,
+                 NULL);
+
+    return webWindowFeatures;
+}
+
+/**
+ * webkit_web_window_features_equal:
+ * @features1: a #WebKitWebWindowFeatures instance
+ * @features2: another #WebKitWebWindowFeatures instance
+ *
+ * Decides if a #WebKitWebWindowFeatures instance equals another, as
+ * in has the same values.
+ *
+ * Returns: %TRUE if the instances have the same values, %FALSE
+ * otherwise
+ *
+ * Since 1.0.3
+ */
+gboolean webkit_web_window_features_equal(WebKitWebWindowFeatures* features1, WebKitWebWindowFeatures* features2)
+{
+    WebKitWebWindowFeaturesPrivate* priv1 = features1->priv;
+    WebKitWebWindowFeaturesPrivate* priv2 = features2->priv;
+
+    if((priv1->x == priv2->x) &&
+       (priv1->y == priv2->y) &&
+       (priv1->width == priv2->width) &&
+       (priv1->height == priv2->height) &&
+       (priv1->toolbar_visible == priv2->toolbar_visible) &&
+       (priv1->statusbar_visible == priv2->statusbar_visible) &&
+       (priv1->scrollbar_visible == priv2->scrollbar_visible) &&
+       (priv1->menubar_visible == priv2->menubar_visible) &&
+       (priv1->locationbar_visible == priv2->locationbar_visible) &&
+       (priv1->fullscreen == priv2->fullscreen))
+        return TRUE;
+    return FALSE;
+}
+
+
+}
diff --git a/WebKit/gtk/webkit/webkitwebwindowfeatures.h b/WebKit/gtk/webkit/webkitwebwindowfeatures.h
new file mode 100644 (file)
index 0000000..cd28988
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WEBKIT_WEB_WINDOW_FEATURES_H
+#define WEBKIT_WEB_WINDOW_FEATURES_H
+
+#include <glib-object.h>
+
+#include <webkit/webkitdefines.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_WEB_WINDOW_FEATURES            (webkit_web_window_features_get_type())
+#define WEBKIT_WEB_WINDOW_FEATURES(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_WINDOW_FEATURES, WebKitWebWindowFeatures))
+#define WEBKIT_WEB_WINDOW_FEATURES_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_TYPE_WEB_WINDOW_FEATURES, WebKitWebWindowFeaturesClass))
+#define WEBKIT_IS_WEB_WINDOW_FEATURES(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_WINDOW_FEATURES))
+#define WEBKIT_IS_WEB_WINDOW_FEATURES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_TYPE_WEB_WINDOW_FEATURES))
+#define WEBKIT_WEB_WINDOW_FEATURES_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_TYPE_WEB_WINDOW_FEATURES, WebKitWebWindowFeaturesClass))
+
+typedef struct _WebKitWebWindowFeaturesPrivate WebKitWebWindowFeaturesPrivate;
+
+struct _WebKitWebWindowFeatures {
+    GObject parent_instance;
+
+    /*< private >*/
+    WebKitWebWindowFeaturesPrivate* priv;
+};
+
+struct _WebKitWebWindowFeaturesClass {
+    GObjectClass parent_class;
+
+    /*< private >*/
+    /* Padding for future expansion */
+    void (*_webkit_reserved1) (void);
+    void (*_webkit_reserved2) (void);
+    void (*_webkit_reserved3) (void);
+    void (*_webkit_reserved4) (void);
+};
+
+WEBKIT_API GType
+webkit_web_window_features_get_type            (void);
+
+WEBKIT_API WebKitWebWindowFeatures*
+webkit_web_window_features_new                 (void);
+
+WEBKIT_API gboolean
+webkit_web_window_features_equal               (WebKitWebWindowFeatures* features1,
+                                                WebKitWebWindowFeatures* features2);
+
+G_END_DECLS
+
+#endif /* WEBKIT_WEB_WINDOW_FEATURES_H */