2007-07-22 Holger Hans Peter Freyther <zecke@selfish.org>
authorzecke <zecke@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jul 2007 18:16:02 +0000 (18:16 +0000)
committerzecke <zecke@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jul 2007 18:16:02 +0000 (18:16 +0000)
        Reviewed by Adam.

        Add WebKit/gtk/Api and WebCoreSupport API to the INCLUDEPATH to allow GdkLauncher to be
        build against it.

        * WebKit.pri:

WebCore:
2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>

        Reviewed by Adam.

        WARNING: NO TEST CASES ADDED OR CHANGED

        Add the WebKit/Gtk API to the buildsystem, ask qmake to create a
        pkg-config file and install headers and libraries.

        Start to emit signals from FrameLoaderClientGdk, hide the kit Frame
        inside the the FrameLoaderClientGdk.

        Move ChromeClientGdk to WebKit/gtk/WebCoreSupport

        * WebCore.pro:
        * loader/gdk/FrameLoaderClientGdk.cpp:
        * loader/gdk/FrameLoaderClientGdk.h:
        * platform/gdk/ChromeClientGdk.h: Removed.
        * platform/gdk/FrameGdk.cpp: Remove code not belonging here
        * platform/gdk/FrameGdk.h:
        * platform/gdk/ScrollViewGdk.cpp: The gdkDrawable won't exist at that time and it is fine
        * platform/gdk/TemporaryLinkStubs.cpp: Removed ChromeClientGdk stubs

WebKit:
2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>

        Reviewed by Adam.

        Add the first API and partial implementation of the WebKit/Gtk port as
        of http://bugs.webkit.org/show_bug.cgi?id=14678.

        The delegates of WebView will be modeled as signals. Delegates like the
        WebPolicyDelegate will be implemented as signals with default handlers.

        Start moving files to WebKit/gtk/WebCoreSupport.

        * gtk: Added.
        * gtk/Api: Added.
        * gtk/Api/headers.pri: Added.
        * gtk/Api/webkitgtk-marshal.list: Added.
        * gtk/Api/webkitgtkdefines.h: Added.
        * gtk/Api/webkitgtkframe.cpp: Added.
        * gtk/Api/webkitgtkframe.h: Added.
        * gtk/Api/webkitgtkframedata.cpp: Added.
        * gtk/Api/webkitgtkframedata.h: Added.
        * gtk/Api/webkitgtkglobal.cpp: Added.
        * gtk/Api/webkitgtkglobal.h: Added.
        * gtk/Api/webkitgtknetworkrequest.cpp: Added.
        * gtk/Api/webkitgtknetworkrequest.h: Added.
        * gtk/Api/webkitgtkpage.cpp: Added.
        * gtk/Api/webkitgtkpage.h: Added.
        * gtk/Api/webkitgtkprivate.cpp: Added.
        * gtk/Api/webkitgtkprivate.h: Added.
        * gtk/Api/webkitgtksettings.cpp: Added.
        * gtk/Api/webkitgtksettings.h: Added.
        * gtk/WebCoreSupport: Added.
        * gtk/WebCoreSupport/ChromeClientGdk.cpp: Added.
        (WebCore::ChromeClientGdk::ChromeClientGdk):
        (WebCore::ChromeClientGdk::chromeDestroyed):
        (WebCore::ChromeClientGdk::windowRect):
        (WebCore::ChromeClientGdk::setWindowRect):
        (WebCore::ChromeClientGdk::pageRect):
        (WebCore::ChromeClientGdk::scaleFactor):
        (WebCore::ChromeClientGdk::focus):
        (WebCore::ChromeClientGdk::unfocus):
        (WebCore::ChromeClientGdk::createWindow):
        (WebCore::ChromeClientGdk::createModalDialog):
        (WebCore::ChromeClientGdk::show):
        (WebCore::ChromeClientGdk::canRunModal):
        (WebCore::ChromeClientGdk::runModal):
        (WebCore::ChromeClientGdk::setToolbarsVisible):
        (WebCore::ChromeClientGdk::toolbarsVisible):
        (WebCore::ChromeClientGdk::setStatusbarVisible):
        (WebCore::ChromeClientGdk::statusbarVisible):
        (WebCore::ChromeClientGdk::setScrollbarsVisible):
        (WebCore::ChromeClientGdk::scrollbarsVisible):
        (WebCore::ChromeClientGdk::setMenubarVisible):
        (WebCore::ChromeClientGdk::menubarVisible):
        (WebCore::ChromeClientGdk::setResizable):
        (WebCore::ChromeClientGdk::closeWindowSoon):
        (WebCore::ChromeClientGdk::canTakeFocus):
        (WebCore::ChromeClientGdk::takeFocus):
        (WebCore::ChromeClientGdk::canRunBeforeUnloadConfirmPanel):
        (WebCore::ChromeClientGdk::runBeforeUnloadConfirmPanel):
        (WebCore::ChromeClientGdk::addMessageToConsole):
        (WebCore::ChromeClientGdk::runJavaScriptAlert):
        (WebCore::ChromeClientGdk::runJavaScriptConfirm):
        (WebCore::ChromeClientGdk::runJavaScriptPrompt):
        (WebCore::ChromeClientGdk::setStatusbarText):
        (WebCore::ChromeClientGdk::shouldInterruptJavaScript):
        (WebCore::ChromeClientGdk::tabsToLinks):
        (WebCore::ChromeClientGdk::windowResizerRect):
        (WebCore::ChromeClientGdk::addToDirtyRegion):
        (WebCore::ChromeClientGdk::scrollBackingStore):
        (WebCore::ChromeClientGdk::updateBackingStore):
        (WebCore::ChromeClientGdk::mouseDidMoveOverElement):
        (WebCore::ChromeClientGdk::setToolTip):
        (WebCore::ChromeClientGdk::print):
        * gtk/WebCoreSupport/ChromeClientGdk.h: Added.

WebKitTools:
2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>

        Reviewed by Adam.

        Make the GdkLauncher use the new WebKit/Gtk API. Change webkitdirs.pm to
        honor --qmakearg for the Gdk/Gtk build as well.

        * GdkLauncher/main.cpp: Switch to the new API
        * Scripts/webkitdirs.pm: Allow to specify --qmakearg, e.g. to control the WEBKIT_{INC,LIB}_DIR

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

36 files changed:
ChangeLog
WebCore/ChangeLog
WebCore/WebCore.pro
WebCore/loader/gdk/FrameLoaderClientGdk.cpp
WebCore/loader/gdk/FrameLoaderClientGdk.h
WebCore/platform/gdk/ChromeClientGdk.h [deleted file]
WebCore/platform/gdk/EditorClientGdk.cpp
WebCore/platform/gdk/EditorClientGdk.h
WebCore/platform/gdk/FrameGdk.cpp
WebCore/platform/gdk/FrameGdk.h
WebCore/platform/gdk/ScrollViewGdk.cpp
WebCore/platform/gdk/TemporaryLinkStubs.cpp
WebKit.pri
WebKit/ChangeLog
WebKit/gtk/Api/headers.pri [new file with mode: 0644]
WebKit/gtk/Api/webkitgtk-marshal.list [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkdefines.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkframe.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkframe.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkframedata.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkframedata.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkglobal.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkglobal.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtknetworkrequest.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtknetworkrequest.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkpage.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkpage.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkprivate.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtkprivate.h [new file with mode: 0644]
WebKit/gtk/Api/webkitgtksettings.cpp [new file with mode: 0644]
WebKit/gtk/Api/webkitgtksettings.h [new file with mode: 0644]
WebKit/gtk/WebCoreSupport/ChromeClientGdk.cpp [new file with mode: 0644]
WebKit/gtk/WebCoreSupport/ChromeClientGdk.h [new file with mode: 0644]
WebKitTools/ChangeLog
WebKitTools/GdkLauncher/main.cpp
WebKitTools/Scripts/webkitdirs.pm

index 8149c73..2d28953 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>
+
+        Reviewed by Adam.
+
+        Add WebKit/gtk/Api and WebCoreSupport API to the INCLUDEPATH to allow GdkLauncher to be
+        build against it.
+
+        * WebKit.pri:
+
 2007-07-18  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Zack.
index 6d56435..64631bd 100644 (file)
@@ -1,3 +1,26 @@
+2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>
+
+        Reviewed by Adam.
+
+        WARNING: NO TEST CASES ADDED OR CHANGED
+
+        Add the WebKit/Gtk API to the buildsystem, ask qmake to create a
+        pkg-config file and install headers and libraries.
+
+        Start to emit signals from FrameLoaderClientGdk, hide the kit Frame
+        inside the the FrameLoaderClientGdk.
+
+        Move ChromeClientGdk to WebKit/gtk/WebCoreSupport
+
+        * WebCore.pro:
+        * loader/gdk/FrameLoaderClientGdk.cpp:
+        * loader/gdk/FrameLoaderClientGdk.h:
+        * platform/gdk/ChromeClientGdk.h: Removed.
+        * platform/gdk/FrameGdk.cpp: Remove code not belonging here
+        * platform/gdk/FrameGdk.h:
+        * platform/gdk/ScrollViewGdk.cpp: The gdkDrawable won't exist at that time and it is fine
+        * platform/gdk/TemporaryLinkStubs.cpp: Removed ChromeClientGdk stubs
+
 2007-07-22  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Adam.
index e32f066..843b6a9 100644 (file)
@@ -20,7 +20,7 @@ CONFIG -= warn_on
 QMAKE_CXXFLAGS += -Wreturn-type
 #QMAKE_CXXFLAGS += -Wall -Wno-undef -Wno-unused-parameter
 
-qt-port:contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
+contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
 unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions
 
 linux-*: DEFINES += HAVE_STDINT_H
@@ -89,7 +89,9 @@ gdk-port {
                   page/gdk                    \
                   platform/graphics/cairo     \
                   platform/graphics/svg/cairo \
-                  platform/network/curl
+                  platform/network/curl       \
+                  ../WebKit/gtk/Api           \ 
+                  ../WebKit/gtk/WebCoreSupport
 }
 
 INCLUDEPATH +=  $$PWD \
@@ -816,7 +818,18 @@ qt-port:SOURCES += \
     ../WebKitQt/Api/qwebobjectplugin.cpp \
     ../WebKitQt/Api/qwebobjectpluginconnector.cpp 
 
-gdk-port:SOURCES += \
+gdk-port {
+    HEADERS += \
+        ../WebKit/gtk/Api/webkitgtkdefines.h \
+        ../WebKit/gtk/Api/webkitgtkframe.h \
+        ../WebKit/gtk/Api/webkitgtkframedata.h \
+        ../WebKit/gtk/Api/webkitgtkglobal.h \
+        ../WebKit/gtk/Api/webkitgtknetworkrequest.h \
+        ../WebKit/gtk/Api/webkitgtkpage.h \
+        ../WebKit/gtk/Api/webkitgtkprivate.h \
+        ../WebKit/gtk/Api/webkitgtksettings.h \
+        ../WebKit/gtk/WebCoreSupport/ChromeClientGdk.h
+    SOURCES += \
         platform/TextCodecICU.cpp \
         platform/TextBreakIteratorICU.cpp \
         page/gdk/EventHandlerGdk.cpp \
@@ -866,7 +879,16 @@ gdk-port:SOURCES += \
         platform/image-decoders/jpeg/JPEGImageDecoder.cpp \
         platform/image-decoders/bmp/BMPImageDecoder.cpp \
         platform/image-decoders/ico/ICOImageDecoder.cpp \
-        platform/image-decoders/xbm/XBMImageDecoder.cpp
+        platform/image-decoders/xbm/XBMImageDecoder.cpp \
+        ../WebKit/gtk/Api/webkitgtkframe.cpp \
+        ../WebKit/gtk/Api/webkitgtkframedata.cpp \
+        ../WebKit/gtk/Api/webkitgtkglobal.cpp \
+        ../WebKit/gtk/Api/webkitgtknetworkrequest.cpp \
+        ../WebKit/gtk/Api/webkitgtkpage.cpp \
+        ../WebKit/gtk/Api/webkitgtkprivate.cpp \
+        ../WebKit/gtk/Api/webkitgtksettings.cpp \
+        ../WebKit/gtk/WebCoreSupport/ChromeClientGdk.cpp
+}
  
 contains(DEFINES, ENABLE_ICONDATABASE=1) {
     qt-port: INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/sqlite/
@@ -1437,3 +1459,38 @@ qt-port {
     }
 }
 
+gdk-port {
+    isEmpty(WEBKIT_LIB_DIR):WEBKIT_LIB_DIR=$$[QT_INSTALL_LIBS]
+    isEmpty(WEBKIT_INC_DIR):WEBKIT_INC_DIR=$$[QT_INSTALL_HEADERS]/WebKitGtk
+
+    target.path = $$WEBKIT_LIB_DIR
+    include($$PWD/../WebKit/gtk/Api/headers.pri)
+    headers.files = $$WEBKIT_API_HEADERS
+    headers.path = $$WEBKIT_INC_DIR
+    INSTALLS += target headers
+
+    unix {
+        CONFIG += create_pc create_prl
+        QMAKE_PKGCONFIG_LIBDIR = $$target.path
+        QMAKE_PKGCONFIG_INCDIR = $$headers.path
+        QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+        lib_replace.match = $$DESTDIR
+        lib_replace.replace = $$[QT_INSTALL_LIBS]
+        QMAKE_PKGCONFIG_INSTALL_REPLACE += lib_replace
+    }
+
+    GENMARSHALS = ../WebKit/gtk/Api/webkitgtk-marshal.list
+    GENMARSHALS_PREFIX = webkit_gtk_marshal
+
+    #
+    # integrate glib-genmarshal as additional compiler
+    #
+    QMAKE_GENMARSHAL_CC  = glib-genmarshal
+    glib-genmarshal.commands = $${QMAKE_GENMARSHAL_CC} --prefix=$${GENMARSHALS_PREFIX} ${QMAKE_FILE_IN} --header --body >${QMAKE_FILE_OUT}
+    glib-genmarshal.output = $$OUT_PWD/${QMAKE_FILE_BASE}.h
+    glib-genmarshal.input = GENMARSHALS
+    glib-genmarshal.CONFIG = no_link
+    glib-genmarshal.variable_out = PRE_TARGETDEPS
+    glib-genmarshal.name = GENMARSHALS
+    QMAKE_EXTRA_UNIX_COMPILERS += glib-genmarshal
+}
index e51d6ba..8cf33c1 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
  * Copyright (C) 2007 Trolltech ASA
  * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk>
+ * Copyright (C) 2007 Holger Hans Peter Freyther
  *
  * All rights reserved.
  *
 #include "NotImplemented.h"
 #include "PlatformString.h"
 #include "ResourceRequest.h"
+#include "CString.h"
+#include "ProgressTracker.h"
+#include "webkitgtkpage.h"
+#include "webkitgtkframe.h"
+#include "webkitgtkprivate.h"
 #include <stdio.h>
 
+using namespace WebKitGtk;
+
 namespace WebCore {
 
-FrameLoaderClientGdk::FrameLoaderClientGdk()
-    : m_frame(0)
+FrameLoaderClientGdk::FrameLoaderClientGdk(WebKitGtkFrame* frame)
+    : m_frame(frame)
     , m_firstData(false)
 {
-}
-
-Frame* FrameLoaderClientGdk::frame()
-{ 
-    return static_cast<Frame*>(m_frame);
+    ASSERT(m_frame);
 }
 
 String FrameLoaderClientGdk::userAgent(const KURL&)
@@ -67,17 +71,15 @@ WTF::PassRefPtr<WebCore::DocumentLoader> FrameLoaderClientGdk::createDocumentLoa
 void FrameLoaderClientGdk::dispatchWillSubmitForm(FramePolicyFunction policyFunction,  PassRefPtr<FormState>)
 {
     // FIXME: This is surely too simple
-    ASSERT(frame() && policyFunction);
-    if (!frame() || !policyFunction)
+    ASSERT(policyFunction);
+    if (!policyFunction)
         return;
-    (frame()->loader()->*policyFunction)(PolicyUse);
+    (core(m_frame)->loader()->*policyFunction)(PolicyUse);
 }
 
 
 void FrameLoaderClientGdk::committedLoad(DocumentLoader* loader, const char* data, int length)
 {
-    if (!frame())
-        return;
     FrameLoader *fl = loader->frameLoader();
     fl->setEncoding(m_response.textEncodingName(), false);
     fl->addData(data, length);
@@ -105,17 +107,23 @@ void FrameLoaderClientGdk::assignIdentifierToInitialRequest(unsigned long identi
 
 void FrameLoaderClientGdk::postProgressStartedNotification()
 {
-    // no progress notification for now
+    WebKitGtkPage* page = getPageFromFrame(m_frame);
+    g_signal_emit_by_name(page, "load_started", m_frame);
 }
 
 void FrameLoaderClientGdk::postProgressEstimateChangedNotification()
 {
-    // no progress notification for now    
+    WebKitGtkPage* kitPage = getPageFromFrame(m_frame);
+    Page* corePage = core(kitPage);
+
+    g_signal_emit_by_name(kitPage, "load_progress_changed", lround(corePage->progress()->estimatedProgress()*100)); 
 }
 
 void FrameLoaderClientGdk::postProgressFinishedNotification()
 {
-    // no progress notification for now
+    WebKitGtkPage* page = getPageFromFrame(m_frame);
+
+    g_signal_emit_by_name(page, "load_finished", m_frame);
 }
 
 void FrameLoaderClientGdk::frameLoaderDestroyed()
@@ -133,28 +141,28 @@ void FrameLoaderClientGdk::dispatchDidReceiveResponse(DocumentLoader*, unsigned
 void FrameLoaderClientGdk::dispatchDecidePolicyForMIMEType(FramePolicyFunction policyFunction, const String&, const ResourceRequest&)
 {
     // FIXME: we need to call directly here (comment copied from Qt version)
-    ASSERT(frame() && policyFunction);
-    if (!frame() || !policyFunction)
+    ASSERT(policyFunction);
+    if (!policyFunction)
         return;
-    (frame()->loader()->*policyFunction)(PolicyUse);
+    (core(m_frame)->loader()->*policyFunction)(PolicyUse);
 }
 
 void FrameLoaderClientGdk::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest&, const String&)
 {
-    ASSERT(frame() && policyFunction);
-    if (!frame() || !policyFunction)
+    ASSERT(policyFunction);
+    if (!policyFunction)
         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
-    (frame()->loader()->*policyFunction)(PolicyIgnore);
+    (core(m_frame)->loader()->*policyFunction)(PolicyIgnore);
 }
 
 void FrameLoaderClientGdk::dispatchDecidePolicyForNavigationAction(FramePolicyFunction policyFunction, const NavigationAction&, const ResourceRequest&)
 {
-    ASSERT(frame() && policyFunction);
-    if (!frame() || !policyFunction)
+    ASSERT(policyFunction);
+    if (!policyFunction)
         return;
-    (frame()->loader()->*policyFunction)(PolicyUse);
+    (core(m_frame)->loader()->*policyFunction)(PolicyUse);
 }
 
 Widget* FrameLoaderClientGdk::createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool)
@@ -203,7 +211,7 @@ String FrameLoaderClientGdk::overrideMediaType() const
 
 void FrameLoaderClientGdk::windowObjectCleared() const
 {
-    notImplemented();
+    g_signal_emit_by_name(m_frame, "cleared");
 }
 
 void FrameLoaderClientGdk::setMainFrameDocumentReady(bool) 
@@ -225,8 +233,7 @@ bool FrameLoaderClientGdk::hasFrameView() const
 
 void FrameLoaderClientGdk::dispatchDidFinishLoad() 
 { 
-    FrameGdk *frameGdk = static_cast<FrameGdk*>(m_frame);
-    frameGdk->onDidFinishLoad();
+    g_signal_emit_by_name(m_frame, "load_done", true);
 }
 
 void FrameLoaderClientGdk::frameLoadCompleted() 
@@ -269,9 +276,23 @@ void FrameLoaderClientGdk::dispatchDidCancelClientRedirect() { notImplemented();
 void FrameLoaderClientGdk::dispatchWillPerformClientRedirect(const KURL&, double, double) { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidChangeLocationWithinPage() { notImplemented(); }
 void FrameLoaderClientGdk::dispatchWillClose() { notImplemented(); }
-void FrameLoaderClientGdk::dispatchDidReceiveIcon() { notImplemented(); }
-void FrameLoaderClientGdk::dispatchDidStartProvisionalLoad() { notImplemented(); }
-void FrameLoaderClientGdk::dispatchDidReceiveTitle(const String&) { notImplemented(); }
+
+void FrameLoaderClientGdk::dispatchDidReceiveIcon()
+{
+    WebKitGtkPage* page = getPageFromFrame(m_frame);
+
+    g_signal_emit_by_name(page, "icon_loaded", m_frame);
+}
+
+void FrameLoaderClientGdk::dispatchDidStartProvisionalLoad()
+{
+}
+
+void FrameLoaderClientGdk::dispatchDidReceiveTitle(const String& title)
+{
+    notImplemented();
+}
+
 void FrameLoaderClientGdk::dispatchDidCommitLoad() { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidFinishDocumentLoad() { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidFirstLayout() { notImplemented(); }
@@ -292,17 +313,46 @@ bool FrameLoaderClientGdk::canHandleRequest(const ResourceRequest&) const { notI
 bool FrameLoaderClientGdk::canShowMIMEType(const String&) const { notImplemented(); return true; }
 bool FrameLoaderClientGdk::representationExistsForURLScheme(const String&) const { notImplemented(); return false; }
 String FrameLoaderClientGdk::generatedMIMETypeForURLScheme(const String&) const { notImplemented(); return String(); }
-void FrameLoaderClientGdk::provisionalLoadStarted() { notImplemented(); }
-void FrameLoaderClientGdk::didFinishLoad() { notImplemented(); }
+
+void FrameLoaderClientGdk::provisionalLoadStarted()
+{
+    notImplemented();
+}
+
+void FrameLoaderClientGdk::didFinishLoad() {
+    notImplemented();
+}
+
 void FrameLoaderClientGdk::prepareForDataSourceReplacement() { notImplemented(); }
-void FrameLoaderClientGdk::setTitle(const String&, const KURL&) { notImplemented(); }
+
+void FrameLoaderClientGdk::setTitle(const String& title, const KURL& url)
+{
+    WebKitGtkPage* page = getPageFromFrame(m_frame);
+
+    CString titleString = title.utf8(); 
+    DeprecatedCString urlString = url.prettyURL().utf8();
+    g_signal_emit_by_name(m_frame, "title_changed", titleString.data(), urlString.data());
+
+    if (m_frame == webkit_gtk_page_get_main_frame(page))
+        g_signal_emit_by_name(page, "title_changed", titleString.data(), urlString.data());
+}
+
 void FrameLoaderClientGdk::setDocumentViewFromCachedPage(WebCore::CachedPage*) { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidReceiveContentLength(DocumentLoader*, unsigned long  identifier, int lengthReceived) { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidFinishLoading(DocumentLoader*, unsigned long  identifier) { notImplemented(); }
 void FrameLoaderClientGdk::dispatchDidFailLoading(DocumentLoader*, unsigned long  identifier, const ResourceError&) { notImplemented(); }
 bool FrameLoaderClientGdk::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) { notImplemented(); return false; }
-void FrameLoaderClientGdk::dispatchDidFailProvisionalLoad(const ResourceError&) { notImplemented(); }
-void FrameLoaderClientGdk::dispatchDidFailLoad(const ResourceError&) { notImplemented(); }
+
+void FrameLoaderClientGdk::dispatchDidFailProvisionalLoad(const ResourceError&)
+{
+    g_signal_emit_by_name(m_frame, "load_done", false);
+}
+
+void FrameLoaderClientGdk::dispatchDidFailLoad(const ResourceError&)
+{
+    g_signal_emit_by_name(m_frame, "load_done", false);
+}
+
 void FrameLoaderClientGdk::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { notImplemented(); }
 ResourceError FrameLoaderClientGdk::cancelledError(const ResourceRequest&) { notImplemented(); return ResourceError(); }
 ResourceError FrameLoaderClientGdk::blockedError(const ResourceRequest&) { notImplemented(); return ResourceError(); }
index 035aeb6..b57bb28 100644 (file)
 
 #include "ResourceResponse.h"
 
+typedef struct _WebKitGtkFrame WebKitGtkFrame;
+
 namespace WebCore {
 
     class FrameGdk;
 
     class FrameLoaderClientGdk : public FrameLoaderClient {
     public:
-        FrameLoaderClientGdk();
+        FrameLoaderClientGdk(WebKitGtkFrame*);
         virtual ~FrameLoaderClientGdk() { }
         virtual void frameLoaderDestroyed();
 
-        void setFrame(FrameGdk *frame) { m_frame = frame; }
-        Frame* frame();
+        WebKitGtkFrame*  webFrame() const { return m_frame; }
 
         virtual bool hasWebView() const;
         virtual bool hasFrameView() const;
@@ -177,7 +178,7 @@ namespace WebCore {
         virtual bool canCachePage() const;
         virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&);
     private:
-        FrameGdk *m_frame;
+        WebKitGtkFrame* m_frame;
         ResourceResponse m_response;
         bool m_firstData;
     };
diff --git a/WebCore/platform/gdk/ChromeClientGdk.h b/WebCore/platform/gdk/ChromeClientGdk.h
deleted file mode 100644 (file)
index e4bdf75..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ChromeClientGdk_h
-#define ChromeClientGdk_h
-
-#include "ChromeClient.h"
-
-namespace WebCore {
-
-    class ChromeClientGdk : public ChromeClient {
-    public:
-        virtual ~ChromeClientGdk() { }
-
-        virtual void chromeDestroyed();
-
-        virtual void setWindowRect(const FloatRect&);
-        virtual FloatRect windowRect();
-
-        virtual FloatRect pageRect();
-
-        virtual float scaleFactor();
-
-        virtual void focus();
-        virtual void unfocus();
-
-        virtual bool canTakeFocus(FocusDirection);
-        virtual void takeFocus(FocusDirection);
-
-        virtual Page* createWindow(Frame*, const FrameLoadRequest&);
-        virtual Page* createModalDialog(Frame*, const FrameLoadRequest&);
-        virtual void show();
-
-        virtual bool canRunModal();
-        virtual void runModal();
-
-        virtual void setToolbarsVisible(bool);
-        virtual bool toolbarsVisible();
-
-        virtual void setStatusbarVisible(bool);
-        virtual bool statusbarVisible();
-
-        virtual void setScrollbarsVisible(bool);
-        virtual bool scrollbarsVisible();
-
-        virtual void setMenubarVisible(bool);
-        virtual bool menubarVisible();
-
-        virtual void setResizable(bool);
-
-        virtual void addMessageToConsole(const String& message, unsigned int lineNumber,
-                                         const String& sourceID);
-
-        virtual bool canRunBeforeUnloadConfirmPanel();
-        virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
-
-        virtual void closeWindowSoon();
-
-        virtual void runJavaScriptAlert(Frame*, const String&);
-        virtual bool runJavaScriptConfirm(Frame*, const String&);
-        virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
-        virtual void setStatusbarText(const String&);
-        virtual bool shouldInterruptJavaScript();
-        virtual bool tabsToLinks() const;
-
-        virtual IntRect windowResizerRect() const;
-        virtual void addToDirtyRegion(const IntRect&);
-        virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
-        virtual void updateBackingStore();
-
-        virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
-
-        virtual void setToolTip(const String&);
-
-        virtual void print(Frame*);
-    };
-}
-
-#endif // ChromeClientGdk_h
index 82d2923..1011338 100644 (file)
 #include "NotImplemented.h"
 #include "Page.h"
 #include "PlatformKeyboardEvent.h"
+#include "webkitgtkprivate.h"
 
 #include <stdio.h>
 
+using namespace WebKitGtk;
+
 namespace WebCore {
 
 bool EditorClientGdk::shouldDeleteRange(Range*)
@@ -207,12 +210,11 @@ void EditorClientGdk::toggleContinuousSpellChecking()
 
 void EditorClientGdk::toggleGrammarChecking()
 {
-    EditorClientGdk();
 }
 
 void EditorClientGdk::handleKeypress(KeyboardEvent* event)
 {
-    Frame* frame = m_page->focusController()->focusedOrMainFrame();
+    Frame* frame = core(m_page)->focusController()->focusedOrMainFrame();
     if (!frame)
         return;
 
@@ -255,13 +257,9 @@ void EditorClientGdk::handleInputMethodKeypress(KeyboardEvent*)
     notImplemented();
 }
 
-EditorClientGdk::EditorClientGdk()
-{
-}
-
-void EditorClientGdk::setPage(Page* page)
+EditorClientGdk::EditorClientGdk(WebKitGtkPage* page)
+    : m_page(page)
 {
-    m_page = page;
 }
 
 void EditorClientGdk::textFieldDidBeginEditing(Element*)
index c03db56..a869985 100644 (file)
 
 #include <wtf/Forward.h>
 
+typedef struct _WebKitGtkPage WebKitGtkPage;
+
 namespace WebCore {
 
 class Page;
 
 class EditorClientGdk : public EditorClient {
 public:
-    EditorClientGdk();
+    EditorClientGdk(WebKitGtkPage*);
 
     // from EditorClient
     virtual void pageDestroyed();
@@ -102,11 +104,8 @@ public:
     virtual bool spellingUIIsShowing();
     virtual void getGuessesForWord(const String&, Vector<String>& guesses);
 
-    // EditorClientGdk only
-    void setPage(Page*);
-
 private:
-    Page* m_page;
+    WebKitGtkPage* m_page;
 };
 
 }
index 9ae55ae..aedb56e 100644 (file)
@@ -54,6 +54,7 @@
 #include "SelectionController.h"
 #include "Settings.h"
 #include "TypingCommand.h"
+#include "webkitgtkframe.h"
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
@@ -88,9 +89,6 @@ namespace WebCore {
 FrameGdk::FrameGdk(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClientGdk* frameLoader)
     : Frame(page, ownerElement, frameLoader)
 {
-    m_exitAfterLoading = false;
-    m_dumpRenderTreeAfterLoading = false;
-
     Settings* settings = page->settings();
     settings->setLoadsImagesAutomatically(true);
     settings->setMinimumFontSize(5);
@@ -104,8 +102,6 @@ FrameGdk::FrameGdk(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderC
     settings->setSansSerifFontFamily("Arial");
     settings->setFixedFontFamily("Courier");
     settings->setStandardFontFamily("Arial");
-
-    frameLoader->setFrame(this);
 }
 
 FrameGdk::~FrameGdk()
@@ -113,14 +109,6 @@ FrameGdk::~FrameGdk()
     loader()->cancelAndClear();
 }
 
-void FrameGdk::onDidFinishLoad()
-{
-    if (dumpRenderTreeAfterLoading())
-        dumpRenderTree();
-    if (exitAfterLoading())
-        gtk_main_quit();  // FIXME: a bit drastic?
-}
-
 void FrameGdk::dumpRenderTree() const
 {
     if (view()->needsLayout())
index ced443d..72ce7c5 100644 (file)
@@ -40,6 +40,7 @@ class FrameGdk;
 class FrameLoaderClientGdk;
 class FormData;
 
+
 class FrameGdk : public Frame {
 public:
     FrameGdk(Page*, HTMLFrameOwnerElement*, FrameLoaderClientGdk*);
@@ -49,17 +50,6 @@ public:
     bool keyPress(const PlatformKeyboardEvent& keyEvent);
 
     void dumpRenderTree() const;
-
-    void setExitAfterLoading(bool exitAfterLoading) { m_exitAfterLoading = exitAfterLoading; }
-    bool exitAfterLoading() const { return m_exitAfterLoading; }
-
-    void setDumpRenderTreeAfterLoading(bool dumpRenderTreeAfterLoading) { m_dumpRenderTreeAfterLoading = dumpRenderTreeAfterLoading; }
-    bool dumpRenderTreeAfterLoading() const { return m_dumpRenderTreeAfterLoading; }
-
-    void onDidFinishLoad();
-private:
-    bool            m_exitAfterLoading;
-    bool            m_dumpRenderTreeAfterLoading;
 };
 
 }
index 09192b3..3af89cc 100644 (file)
@@ -54,8 +54,6 @@ public:
         , vScrollbarMode(ScrollbarAuto)
         , hScrollbarMode(ScrollbarAuto)
         , layout(0)
-        , horizontalAdjustment(0)
-        , verticalAdjustment(0)
         , scrollBarsNeedUpdate(false)
     { }
 
@@ -64,8 +62,6 @@ public:
     ScrollbarMode vScrollbarMode;
     ScrollbarMode hScrollbarMode;
     GtkLayout *layout;
-    GtkAdjustment *horizontalAdjustment;
-    GtkAdjustment *verticalAdjustment;
     IntSize contentsSize;
     IntSize viewPortSize;
     bool scrollBarsNeedUpdate;
@@ -151,14 +147,14 @@ void ScrollView::resizeContents(int w, int h)
 
 int ScrollView::contentsX() const
 {
-    g_return_val_if_fail(m_data->horizontalAdjustment, 0);
-    return static_cast<int>(gtk_adjustment_get_value(m_data->horizontalAdjustment));
+    g_return_val_if_fail(gtk_layout_get_hadjustment(m_data->layout), 0);
+    return static_cast<int>(gtk_adjustment_get_value(gtk_layout_get_hadjustment(m_data->layout)));
 }
 
 int ScrollView::contentsY() const
 {
-    g_return_val_if_fail(m_data->verticalAdjustment, 0);
-    return static_cast<int>(gtk_adjustment_get_value(m_data->verticalAdjustment));
+    g_return_val_if_fail(gtk_layout_get_vadjustment(m_data->layout), 0);
+    return static_cast<int>(gtk_adjustment_get_value(gtk_layout_get_vadjustment(m_data->layout)));
 }
 
 int ScrollView::contentsWidth() const
@@ -179,18 +175,21 @@ IntSize ScrollView::scrollOffset() const
 
 void ScrollView::scrollBy(int dx, int dy)
 {
-    g_return_if_fail(m_data->horizontalAdjustment);
-    g_return_if_fail(m_data->verticalAdjustment);
+    GtkAdjustment* hadj = gtk_layout_get_hadjustment(m_data->layout);
+    GtkAdjustment* vadj = gtk_layout_get_vadjustment(m_data->layout);
+    g_return_if_fail(hadj);
+    g_return_if_fail(vadj);
 
     int current_x = contentsX();
     int current_y = contentsY();
 
-    gtk_adjustment_set_value(m_data->horizontalAdjustment,
-                             CLAMP(current_x+dx, m_data->horizontalAdjustment->lower,
-                                   MAX(0.0, m_data->horizontalAdjustment->upper - m_data->horizontalAdjustment->page_size)));
-    gtk_adjustment_set_value(m_data->verticalAdjustment,
-                             CLAMP(current_y+dy, m_data->verticalAdjustment->lower,
-                                   MAX(0.0, m_data->verticalAdjustment->upper - m_data->verticalAdjustment->page_size)));
+
+    gtk_adjustment_set_value(hadj,
+                             CLAMP(current_x+dx, hadj->lower,
+                                   MAX(0.0, hadj->upper - hadj->page_size)));
+    gtk_adjustment_set_value(vadj,
+                             CLAMP(current_y+dy, vadj->lower,
+                                   MAX(0.0, vadj->upper - vadj->page_size)));
 }
 
 ScrollbarMode ScrollView::hScrollbarMode() const
@@ -256,14 +255,8 @@ void ScrollView::setGtkWidget(GtkLayout* layout)
 {
     g_return_if_fail(GTK_LAYOUT(layout));
     m_data->layout = layout;
-    m_data->horizontalAdjustment = gtk_layout_get_hadjustment(layout);
-    m_data->verticalAdjustment = gtk_layout_get_vadjustment(layout);
 
     Widget::setGtkWidget(GTK_WIDGET(layout));
-    if (!GDK_IS_WINDOW(gdkDrawable())) {
-        LOG_ERROR("image scrollview not supported");
-        return;
-    }
 }
 
 void ScrollView::addChild(Widget* w)
@@ -300,20 +293,23 @@ void ScrollView::wheelEvent(PlatformWheelEvent&)
 
 void ScrollView::updateScrollbars()
 {
-    g_return_if_fail(m_data->horizontalAdjustment);
-    g_return_if_fail(m_data->verticalAdjustment);
+    GtkAdjustment* hadj = gtk_layout_get_hadjustment(m_data->layout);
+    GtkAdjustment* vadj = gtk_layout_get_vadjustment(m_data->layout);
+
+    g_return_if_fail(hadj);
+    g_return_if_fail(vadj);
     
-    m_data->horizontalAdjustment->page_size = visibleWidth();
-    m_data->horizontalAdjustment->step_increment = 13;
+    hadj->page_size = visibleWidth();
+    hadj->step_increment = 13;
     
-    m_data->verticalAdjustment->page_size = visibleHeight();
-    m_data->verticalAdjustment->step_increment = 13;
+    vadj->page_size = visibleHeight();
+    vadj->step_increment = 13;
     
-    gtk_adjustment_changed(m_data->horizontalAdjustment);
-    gtk_adjustment_value_changed(m_data->horizontalAdjustment);
+    gtk_adjustment_changed(hadj);
+    gtk_adjustment_value_changed(hadj);
     
-    gtk_adjustment_changed(m_data->verticalAdjustment);
-    gtk_adjustment_value_changed(m_data->verticalAdjustment);
+    gtk_adjustment_changed(vadj);
+    gtk_adjustment_value_changed(vadj);
 
     m_data->scrollBarsNeedUpdate = false;
 }
index e6becac..62260b4 100644 (file)
@@ -31,7 +31,6 @@
 #include "CString.h"
 #include "CachedPage.h"
 #include "CachedResource.h"
-#include "ChromeClientGdk.h"
 #include "Clipboard.h"
 #include "ContextMenu.h"
 #include "ContextMenuItem.h"
@@ -89,99 +88,6 @@ int WebCore::findNextWordFromIndex(UChar const*, int, int, bool) { notImplemente
 void WebCore::findWordBoundary(UChar const* str, int len, int position, int* start, int* end) {*start = position; *end = position; }
 const char* WebCore::currentTextBreakLocaleID() { notImplemented(); return "en_us"; }
 
-void ChromeClientGdk::chromeDestroyed() { notImplemented(); }
-FloatRect ChromeClientGdk::windowRect() { notImplemented(); return FloatRect(); }
-void ChromeClientGdk::setWindowRect(const FloatRect& r) {notImplemented(); }
-FloatRect ChromeClientGdk::pageRect() { notImplemented(); return FloatRect(); }
-float ChromeClientGdk::scaleFactor() { notImplemented(); return 1.0; }
-void ChromeClientGdk::focus() { notImplemented(); }
-void ChromeClientGdk::unfocus() { notImplemented(); }
-WebCore::Page* ChromeClientGdk::createWindow(Frame*, const FrameLoadRequest&) { notImplemented(); return 0; }
-WebCore::Page* ChromeClientGdk::createModalDialog(Frame*, const FrameLoadRequest&) { notImplemented(); return 0; }
-void ChromeClientGdk::show() { notImplemented(); }
-bool ChromeClientGdk::canRunModal() { notImplemented(); return false; }
-void ChromeClientGdk::runModal() { notImplemented(); }
-void ChromeClientGdk::setToolbarsVisible(bool) { notImplemented(); }
-bool ChromeClientGdk::toolbarsVisible() { notImplemented(); return false; }
-void ChromeClientGdk::setStatusbarVisible(bool) { notImplemented(); }
-bool ChromeClientGdk::statusbarVisible() { notImplemented(); return false; }
-void ChromeClientGdk::setScrollbarsVisible(bool) { notImplemented(); }
-bool ChromeClientGdk::scrollbarsVisible() { notImplemented(); return false; }
-void ChromeClientGdk::setMenubarVisible(bool) { notImplemented(); }
-bool ChromeClientGdk::menubarVisible() { notImplemented(); return false; }
-void ChromeClientGdk::setResizable(bool) { notImplemented(); }
-void ChromeClientGdk::closeWindowSoon() { notImplemented(); }
-bool ChromeClientGdk::canTakeFocus(FocusDirection) { notImplemented(); return true; }
-void ChromeClientGdk::takeFocus(FocusDirection) { notImplemented(); }
-bool ChromeClientGdk::canRunBeforeUnloadConfirmPanel() { notImplemented(); return false; }
-void ChromeClientGdk::addMessageToConsole(const WebCore::String&, unsigned int, const WebCore::String&) { notImplemented(); }
-bool ChromeClientGdk::runBeforeUnloadConfirmPanel(const WebCore::String&, WebCore::Frame*) { notImplemented(); return false; }
-void ChromeClientGdk::runJavaScriptAlert(Frame*, const String&)
-{
-    notImplemented();
-}
-bool ChromeClientGdk::runJavaScriptConfirm(Frame*, const String&)
-{
-    notImplemented();
-    return false;
-}
-bool ChromeClientGdk::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result)
-{
-    notImplemented();
-    return false;
-}
-void ChromeClientGdk::setStatusbarText(const String&)
-{
-    notImplemented();
-}
-
-bool ChromeClientGdk::shouldInterruptJavaScript()
-{
-    notImplemented();
-    return false;
-}
-
-bool ChromeClientGdk::tabsToLinks() const
-{
-    notImplemented();
-    return false;
-}
-
-IntRect ChromeClientGdk::windowResizerRect() const
-{
-    notImplemented();
-    return IntRect();
-}
-
-void ChromeClientGdk::addToDirtyRegion(const IntRect&)
-{
-    notImplemented();
-}
-
-void ChromeClientGdk::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
-{
-    notImplemented();
-}
-
-void ChromeClientGdk::updateBackingStore()
-{
-    notImplemented();
-}
-
-void ChromeClientGdk::mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags)
-{
-    notImplemented();
-}
-
-void ChromeClientGdk::setToolTip(const String&)
-{
-    notImplemented();
-}
-
-void ChromeClientGdk::print(Frame*)
-{
-    notImplemented();
-}
 
 /********************************************************/
 /* Completely empty stubs (mostly to allow DRT to run): */
index 11cc0ac..412ad9b 100644 (file)
@@ -28,7 +28,9 @@ gdk-port:INCLUDEPATH += \
     $$BASE_DIR/WebCore/platform/network/curl \
     $$BASE_DIR/WebCore/platform/graphics/cairo \
     $$BASE_DIR/WebCore/loader/gdk \
-    $$BASE_DIR/WebCore/page/gdk
+    $$BASE_DIR/WebCore/page/gdk \
+    $$BASE_DIR/WebKit/gtk/Api \
+    $$BASE_DIR/WebKit/gtk/WebCoreSupport
 INCLUDEPATH += \
     $$BASE_DIR/JavaScriptCore/ \
     $$BASE_DIR/JavaScriptCore/kjs \
index a1b1191..d0a9eed 100644 (file)
@@ -1,3 +1,79 @@
+2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>
+
+        Reviewed by Adam.
+
+        Add the first API and partial implementation of the WebKit/Gtk port as
+        of http://bugs.webkit.org/show_bug.cgi?id=14678.
+
+        The delegates of WebView will be modeled as signals. Delegates like the
+        WebPolicyDelegate will be implemented as signals with default handlers.
+
+        Start moving files to WebKit/gtk/WebCoreSupport.
+
+        * gtk: Added.
+        * gtk/Api: Added.
+        * gtk/Api/headers.pri: Added.
+        * gtk/Api/webkitgtk-marshal.list: Added.
+        * gtk/Api/webkitgtkdefines.h: Added.
+        * gtk/Api/webkitgtkframe.cpp: Added.
+        * gtk/Api/webkitgtkframe.h: Added.
+        * gtk/Api/webkitgtkframedata.cpp: Added.
+        * gtk/Api/webkitgtkframedata.h: Added.
+        * gtk/Api/webkitgtkglobal.cpp: Added.
+        * gtk/Api/webkitgtkglobal.h: Added.
+        * gtk/Api/webkitgtknetworkrequest.cpp: Added.
+        * gtk/Api/webkitgtknetworkrequest.h: Added.
+        * gtk/Api/webkitgtkpage.cpp: Added.
+        * gtk/Api/webkitgtkpage.h: Added.
+        * gtk/Api/webkitgtkprivate.cpp: Added.
+        * gtk/Api/webkitgtkprivate.h: Added.
+        * gtk/Api/webkitgtksettings.cpp: Added.
+        * gtk/Api/webkitgtksettings.h: Added.
+        * gtk/WebCoreSupport: Added.
+        * gtk/WebCoreSupport/ChromeClientGdk.cpp: Added.
+        (WebCore::ChromeClientGdk::ChromeClientGdk):
+        (WebCore::ChromeClientGdk::chromeDestroyed):
+        (WebCore::ChromeClientGdk::windowRect):
+        (WebCore::ChromeClientGdk::setWindowRect):
+        (WebCore::ChromeClientGdk::pageRect):
+        (WebCore::ChromeClientGdk::scaleFactor):
+        (WebCore::ChromeClientGdk::focus):
+        (WebCore::ChromeClientGdk::unfocus):
+        (WebCore::ChromeClientGdk::createWindow):
+        (WebCore::ChromeClientGdk::createModalDialog):
+        (WebCore::ChromeClientGdk::show):
+        (WebCore::ChromeClientGdk::canRunModal):
+        (WebCore::ChromeClientGdk::runModal):
+        (WebCore::ChromeClientGdk::setToolbarsVisible):
+        (WebCore::ChromeClientGdk::toolbarsVisible):
+        (WebCore::ChromeClientGdk::setStatusbarVisible):
+        (WebCore::ChromeClientGdk::statusbarVisible):
+        (WebCore::ChromeClientGdk::setScrollbarsVisible):
+        (WebCore::ChromeClientGdk::scrollbarsVisible):
+        (WebCore::ChromeClientGdk::setMenubarVisible):
+        (WebCore::ChromeClientGdk::menubarVisible):
+        (WebCore::ChromeClientGdk::setResizable):
+        (WebCore::ChromeClientGdk::closeWindowSoon):
+        (WebCore::ChromeClientGdk::canTakeFocus):
+        (WebCore::ChromeClientGdk::takeFocus):
+        (WebCore::ChromeClientGdk::canRunBeforeUnloadConfirmPanel):
+        (WebCore::ChromeClientGdk::runBeforeUnloadConfirmPanel):
+        (WebCore::ChromeClientGdk::addMessageToConsole):
+        (WebCore::ChromeClientGdk::runJavaScriptAlert):
+        (WebCore::ChromeClientGdk::runJavaScriptConfirm):
+        (WebCore::ChromeClientGdk::runJavaScriptPrompt):
+        (WebCore::ChromeClientGdk::setStatusbarText):
+        (WebCore::ChromeClientGdk::shouldInterruptJavaScript):
+        (WebCore::ChromeClientGdk::tabsToLinks):
+        (WebCore::ChromeClientGdk::windowResizerRect):
+        (WebCore::ChromeClientGdk::addToDirtyRegion):
+        (WebCore::ChromeClientGdk::scrollBackingStore):
+        (WebCore::ChromeClientGdk::updateBackingStore):
+        (WebCore::ChromeClientGdk::mouseDidMoveOverElement):
+        (WebCore::ChromeClientGdk::setToolTip):
+        (WebCore::ChromeClientGdk::print):
+        * gtk/WebCoreSupport/ChromeClientGdk.h: Added.
+
 2007-07-23  Alice Liu  <alice.liu@apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebKit/gtk/Api/headers.pri b/WebKit/gtk/Api/headers.pri
new file mode 100644 (file)
index 0000000..11268e9
--- /dev/null
@@ -0,0 +1,7 @@
+WEBKIT_API_HEADERS = $$PWD/webkitgtkdefines.h \
+                     $$PWD/webkitgtkframe.h \
+                     $$PWD/webkitgtkframedata.h \
+                     $$PWD/webkitgtkglobal.h \
+                     $$PWD/webkitgtknetworkrequest.h \
+                     $$PWD/webkitgtkpage.h \
+                     $$PWD/webkitgtksettings.h
diff --git a/WebKit/gtk/Api/webkitgtk-marshal.list b/WebKit/gtk/Api/webkitgtk-marshal.list
new file mode 100644 (file)
index 0000000..aca467a
--- /dev/null
@@ -0,0 +1,2 @@
+VOID:STRING,STRING
+VOID:OBJECT,BOOLEAN
diff --git a/WebKit/gtk/Api/webkitgtkdefines.h b/WebKit/gtk/Api/webkitgtkdefines.h
new file mode 100644 (file)
index 0000000..97e352b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_DEFINES_H
+#define WEBKIT_GTK_DEFINES_H
+
+#include <glib.h>
+
+#ifdef G_OS_WIN32
+    #ifdef BUILDING_WEBKIT
+        #define WEBKIT_GTK_API __declspec(dllexport)
+    #else
+        #define WEBKIT_GTK_API __declspec(dllimport)
+    #endif
+#else
+    #define WEBKIT_GTK_API __attribute__((visibility("default")))
+#endif
+
+#ifndef WEBKIT_GTK_API
+#define WEBKIT_GTK_API
+#endif
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtkframe.cpp b/WebKit/gtk/Api/webkitgtkframe.cpp
new file mode 100644 (file)
index 0000000..c4f2aca
--- /dev/null
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "webkitgtkframe.h"
+#include "webkitgtkpage.h"
+#include "webkitgtkprivate.h"
+
+#include "FrameGdk.h"
+#include "FrameLoaderClientGdk.h"
+#include "FrameView.h"
+
+using namespace WebCore;
+
+extern "C" {
+
+extern void webkit_gtk_marshal_VOID__STRING_STRING (GClosure     *closure,
+                                                    GValue       *return_value,
+                                                    guint         n_param_values,
+                                                    const GValue *param_values,
+                                                    gpointer      invocation_hint,
+                                                    gpointer      marshal_data);
+
+enum {
+    CLEARED,
+    LOAD_DONE,
+    TITLE_CHANGED,
+    HOVERING_OVER_LINK,
+    LAST_SIGNAL
+};
+
+static guint webkit_gtk_frame_signals[LAST_SIGNAL] = { 0, };
+
+G_DEFINE_TYPE(WebKitGtkFrame, webkit_gtk_frame, G_TYPE_OBJECT)
+
+static void webkit_gtk_frame_finalize(GObject* object)
+{
+    WebKitGtkFramePrivate *private_data = WEBKIT_GTK_FRAME_GET_PRIVATE(WEBKIT_GTK_FRAME(object));
+    delete private_data->frame;
+}
+
+static void webkit_gtk_frame_class_init(WebKitGtkFrameClass* frame_class)
+{
+    g_type_class_add_private(frame_class, sizeof(WebKitGtkFramePrivate));
+
+    /*
+     * signals
+     */
+    webkit_gtk_frame_signals[CLEARED] = g_signal_new("cleared",
+            G_TYPE_FROM_CLASS(frame_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+
+    webkit_gtk_frame_signals[LOAD_DONE] = g_signal_new("load_done",
+            G_TYPE_FROM_CLASS(frame_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__BOOLEAN,
+            G_TYPE_NONE, 1,
+            G_TYPE_BOOLEAN);
+
+    webkit_gtk_frame_signals[TITLE_CHANGED] = g_signal_new("title_changed",
+            G_TYPE_FROM_CLASS(frame_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            webkit_gtk_marshal_VOID__STRING_STRING,
+            G_TYPE_NONE, 2,
+            G_TYPE_STRING, G_TYPE_STRING);
+
+    webkit_gtk_frame_signals[HOVERING_OVER_LINK] = g_signal_new("hovering_over_link",
+            G_TYPE_FROM_CLASS(frame_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            webkit_gtk_marshal_VOID__STRING_STRING,
+            G_TYPE_NONE, 2,
+            G_TYPE_STRING, G_TYPE_STRING);
+
+    /*
+     * implementations of virtual methods
+     */
+    G_OBJECT_CLASS(frame_class)->finalize = webkit_gtk_frame_finalize;
+}
+
+static void webkit_gtk_frame_init(WebKitGtkFrame* frame)
+{
+}
+
+GObject* webkit_gtk_frame_new(WebKitGtkPage* page)
+{
+    WebKitGtkFrame* frame = WEBKIT_GTK_FRAME(g_object_new(WEBKIT_GTK_TYPE_FRAME, NULL));
+    WebKitGtkFramePrivate *frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(frame);
+    WebKitGtkPagePrivate  *page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+
+    frame_data->client = new FrameLoaderClientGdk(frame);
+    frame_data->frame = new FrameGdk(page_data->page, 0, frame_data->client);
+
+    FrameView* frame_view = new FrameView(frame_data->frame);
+    frame_data->frame->setView(frame_view);
+
+    frame_view->setGtkWidget(GTK_LAYOUT(page));
+    frame_data->frame->init();
+    frame_data->page = page;
+
+    return G_OBJECT(frame);
+}
+
+WebKitGtkPage*
+webkit_gtk_frame_get_page(WebKitGtkFrame* frame)
+{
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(frame);
+    return frame_data->page;
+}
+}
diff --git a/WebKit/gtk/Api/webkitgtkframe.h b/WebKit/gtk/Api/webkitgtkframe.h
new file mode 100644 (file)
index 0000000..f6e93f5
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_FRAME_H
+#define WEBKIT_GTK_FRAME_H
+
+#include <glib-object.h>
+#include <gdk/gdk.h>
+
+#include "webkitgtkdefines.h"
+
+G_BEGIN_DECLS
+
+#define WEBKIT_GTK_TYPE_FRAME            (webkit_gtk_frame_get_type())
+#define WEBKIT_GTK_FRAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_GTK_TYPE_FRAME, WebKitGtkFrame))
+#define WEBKIT_GTK_FRAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_GTK_TYPE_FRAME, WebKitGtkFrameClass))
+#define WEBKIT_GTK_IS_FRAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_GTK_TYPE_FRAME))
+#define WEBKIT_GTK_IS_FRAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_GTK_TYPE_FRAME))
+#define WEBKIT_GTK_FRAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_GTK_TYPE_FRAME, WebKitGtkFrameClass))
+
+typedef struct _WebKitGtkPage  WebKitGtkPage;
+typedef struct _WebKitGtkFrame WebKitGtkFrame;
+typedef struct _WebKitGtkFrameClass WebKitGtkFrameClass;
+
+struct _WebKitGtkFrame {
+    GObject parent;
+};
+
+struct _WebKitGtkFrameClass {
+    GObjectClass parent;
+
+    /*
+     * protected virtual methods
+     */
+    void (*mouse_move_event)  (WebKitGtkFrame* frame, GdkEvent* move_event);
+    void (*mouse_press_event) (WebKitGtkFrame* frame, GdkEvent* press_event);
+    void (*mouse_release_event) (WebKitGtkFrame* frame, GdkEvent* mouse_release_event);
+    void (*mouse_double_click_event) (WebKitGtkFrame* frame, GdkEvent* double_click_event);
+    void (*mouse_wheel_event) (WebKitGtkFrame* frame, GdkEvent* wheel_event);
+};
+
+WEBKIT_GTK_API GType
+webkit_gtk_frame_get_type (void);
+
+WEBKIT_GTK_API GObject*
+webkit_gtk_frame_new (WebKitGtkPage *page);
+
+WEBKIT_GTK_API WebKitGtkPage*
+webkit_gtk_frame_get_page (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API gchar*
+webkit_gtk_frame_get_markup (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API gchar*
+webkit_gtk_frame_get_inner_text (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API gchar*
+webkit_gtk_frame_get_selected_text (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API gchar*
+webkit_gtk_frame_get_title (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API GSList*
+webkit_gtk_frame_get_child_frames (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API GdkPoint*
+webkit_gtk_frame_get_position (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API GdkRectangle*
+webkit_gtk_frame_get_rectangle (WebKitGtkFrame* frame);
+
+WEBKIT_GTK_API WebKitGtkPage*
+webkit_gtk_frame_get_page (WebKitGtkFrame* frame);
+
+G_END_DECLS
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtkframedata.cpp b/WebKit/gtk/Api/webkitgtkframedata.cpp
new file mode 100644 (file)
index 0000000..33b8f95
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "webkitgtkframedata.h"
diff --git a/WebKit/gtk/Api/webkitgtkframedata.h b/WebKit/gtk/Api/webkitgtkframedata.h
new file mode 100644 (file)
index 0000000..6d76886
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_FRAME_DATA_H
+#define WEBKIT_GTK_FRAME_DATA_H
+
+#include <glib-object.h>
+
+#include "webkitgtkdefines.h"
+
+G_BEGIN_DECLS
+
+#define WEBKIT_GTK_TYPE_FRAME_DATA            (webkit_gtk_frame_data_get_type())
+#define WEBKIT_GTK_FRAME_DATA(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_GTK_TYPE_FRAME_DATA, WebKitGtkFrameData))
+#define WEBKIT_GTK_FRAME_DATA_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_GTK_TYPE_FRAME_DATA, WebKitGtkFrameDataClass))
+#define WEBKIT_GTK_IS_FRAME_DATA(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_GTK_TYPE_FRAME_DATA))
+#define WEBKIT_GTK_IS_FRAME_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_GTK_TYPE_FRAME_DATA))
+#define WEBKIT_GTK_FRAME_DATA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_GTK_TYPE_FRAME_DATA, WebKitGtkFrameDataClass))
+
+
+typedef struct _WebKitGtkFrameData WebKitGtkFrameData;
+typedef struct _WebKitGtkFrameDataClass WebKitGtkFrameDataClass;
+
+struct _WebKitGtkFrameData {
+    GObject parent;
+};
+
+struct _WebKitGtkFrameDataClass {
+    GObject parent;
+};
+
+WEBKIT_GTK_API GType
+webkit_gtk_frame_data_get_type (void);
+
+WEBKIT_GTK_API GObject*
+webkit_gtk_frame_data_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtkglobal.cpp b/WebKit/gtk/Api/webkitgtkglobal.cpp
new file mode 100644 (file)
index 0000000..f506a7a
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "webkitgtkglobal.h"
+
+#include "Logging.h"
+
+extern "C" {
+void webkit_gtk_init(void)
+{
+    WebCore::InitializeLoggingChannelsIfNecessary();
+}
+}
diff --git a/WebKit/gtk/Api/webkitgtkglobal.h b/WebKit/gtk/Api/webkitgtkglobal.h
new file mode 100644 (file)
index 0000000..1bcd6d7
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_GLOBAL_H
+#define WEBKIT_GTK_GLOBAL_H
+
+#include "webkitgtkdefines.h"
+
+G_BEGIN_DECLS
+
+WEBKIT_GTK_API void
+webkit_gtk_init (void);
+
+G_END_DECLS
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtknetworkrequest.cpp b/WebKit/gtk/Api/webkitgtknetworkrequest.cpp
new file mode 100644 (file)
index 0000000..b3171f5
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "webkitgtknetworkrequest.h"
diff --git a/WebKit/gtk/Api/webkitgtknetworkrequest.h b/WebKit/gtk/Api/webkitgtknetworkrequest.h
new file mode 100644 (file)
index 0000000..7e7c97b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_NETWORK_REQUEST_H
+#define WEBKIT_GTK_NETWORK_REQUEST_H
+
+#include <glib-object.h>
+
+#include "webkitgtkdefines.h"
+
+G_BEGIN_DECLS
+
+#define WEBKIT_GTK_TYPE_NETWORK_REQUEST            (webkit_gtk_network_request_get_type())
+#define WEBKIT_GTK_NETWORK_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_GTK_TYPE_NETWORK_REQUEST, WebKitGtkNetworkRequest))
+#define WEBKIT_GTK_NETWORK_REQUEST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_GTK_TYPE_NETWORK_REQUEST, WebKitGtkNetworkRequestClass))
+#define WEBKIT_GTK_IS_NETWORK_REQUEST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_GTK_TYPE_NETWORK_REQUEST))
+#define WEBKIT_GTK_IS_NETWORK_REQUEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_GTK_TYPE_NETWORK_REQUEST))
+#define WEBKIT_GTK_NETWORK_REQUEST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_GTK_TYPE_NETWORK_REQUEST, WebKitGtkNetworkRequestClass))
+
+
+typedef struct _WebKitGtkNetworkRequest WebKitGtkNetworkRequest;
+typedef struct _WebKitGtkNetworkRequestClass WebKitGtkNetworkRequestClass;
+
+struct _WebKitGtkNetworkRequest {
+    GObject parent;
+};
+
+struct _WebKitGtkNetworkRequestClass {
+    GObject parent;
+};
+
+WEBKIT_GTK_API GType
+webkit_gtk_network_request_get_type (void);
+
+WEBKIT_GTK_API GObject*
+webkit_gtk_network_request_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtkpage.cpp b/WebKit/gtk/Api/webkitgtkpage.cpp
new file mode 100644 (file)
index 0000000..b1dbc55
--- /dev/null
@@ -0,0 +1,372 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "webkitgtkpage.h"
+#include "webkitgtk-marshal.h"
+#include "webkitgtkprivate.h"
+
+#include "NotImplemented.h"
+#include "ChromeClientGdk.h"
+#include "ContextMenuClientGdk.h"
+#include "EditorClientGdk.h"
+#include "InspectorClientGdk.h"
+#include "FrameLoader.h"
+#include "FrameView.h"
+#include "SubstituteData.h"
+
+
+using namespace WebCore;
+using namespace WebKitGtk;
+
+extern "C" {
+
+enum {
+    /* normal signals */
+    LOAD_STARTED,
+    LOAD_PROGRESS_CHANGED,
+    LOAD_FINISHED,
+    TITLE_CHANGED,
+    HOVERING_OVER_LINK,
+    STATUS_BAR_TEXT_CHANGED,
+    ICOND_LOADED,
+    SELECTION_CHANGED,
+    LAST_SIGNAL
+};
+
+static guint webkit_gtk_page_signals[LAST_SIGNAL] = { 0, };
+
+G_DEFINE_TYPE(WebKitGtkPage, webkit_gtk_page, GTK_TYPE_LAYOUT)
+
+static void webkit_gtk_page_rendering_area_handle_gdk_event(GtkWidget*, GdkEvent* event, WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+
+    frame_data->frame->handleGdkEvent(event);
+}
+
+static void webkit_gtk_page_rendering_area_resize_callback(GtkWidget*, GtkAllocation* allocation, WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+
+    frame_data->frame->view()->updateGeometry(allocation->width, allocation->height);
+    frame_data->frame->forceLayout();
+    frame_data->frame->view()->adjustViewSize();
+    frame_data->frame->sendResizeEvent();
+}
+
+static void webkit_gtk_page_register_rendering_area_events(GtkWidget* win, WebKitGtkPage* page)
+{
+    gdk_window_set_events(GTK_IS_LAYOUT(win) ? GTK_LAYOUT(win)->bin_window : win->window,
+                          (GdkEventMask)(GDK_EXPOSURE_MASK
+                            | GDK_BUTTON_PRESS_MASK
+                            | GDK_BUTTON_RELEASE_MASK
+                            | GDK_POINTER_MOTION_MASK
+                            | GDK_KEY_PRESS_MASK
+                            | GDK_KEY_RELEASE_MASK
+                            | GDK_BUTTON_MOTION_MASK
+                            | GDK_BUTTON1_MOTION_MASK
+                            | GDK_BUTTON2_MOTION_MASK
+                            | GDK_BUTTON3_MOTION_MASK));
+
+    g_signal_connect(GTK_OBJECT(win), "expose-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "key-press-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "key-release-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "button-press-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "button-release-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "motion-notify-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+    g_signal_connect(GTK_OBJECT(win), "scroll-event", G_CALLBACK(webkit_gtk_page_rendering_area_handle_gdk_event), page);
+}
+
+static WebKitGtkFrame* webkit_gtk_page_real_create_frame(WebKitGtkPage*, WebKitGtkFrame* parent, WebKitGtkFrameData*)
+{
+    notImplemented();
+    return 0;
+}
+
+static WebKitGtkPage* webkit_gtk_page_real_create_page(WebKitGtkPage*)
+{
+    notImplemented();
+    return 0;
+}
+
+static WEBKIT_GTK_NAVIGATION_REQUEST_RESPONSE webkit_gtk_page_real_navigation_requested(WebKitGtkPage*, WebKitGtkFrame* frame, WebKitGtkNetworkRequest*)
+{
+    notImplemented();
+    return WEBKIT_GTK_ACCEPT_NAVIGATION_REQUEST;
+}
+
+static gchar* webkit_gtk_page_real_choose_file(WebKitGtkPage*, WebKitGtkFrame*, const gchar* old_name)
+{
+    notImplemented();
+    return g_strdup(old_name);
+}
+
+static void webkit_gtk_page_real_java_script_alert(WebKitGtkPage*, WebKitGtkFrame*, const gchar*)
+{
+    notImplemented();
+}
+
+static gboolean webkit_gtk_page_real_java_script_confirm(WebKitGtkPage*, WebKitGtkFrame*, const gchar*)
+{
+    notImplemented();
+    return FALSE;
+}
+
+/**
+ * WebKitGtkPage::java_script_prompt
+ *
+ * @return: NULL to cancel the prompt
+ */
+static gchar* webkit_gtk_page_real_java_script_prompt(WebKitGtkPage*, WebKitGtkFrame*, const gchar*, const gchar* default_value)
+{
+    notImplemented();
+    return g_strdup(default_value);
+}
+
+static void webkit_gtk_page_real_java_script_console_message(WebKitGtkPage*, const gchar*, unsigned int, const gchar*)
+{
+    notImplemented();
+}
+
+static void webkit_gtk_page_finalize(GObject* object)
+{
+    webkit_gtk_page_stop_loading(WEBKIT_GTK_PAGE(object));
+
+    WebKitGtkPagePrivate *private_data = WEBKIT_GTK_PAGE_GET_PRIVATE(WEBKIT_GTK_PAGE(object));
+    //delete private_data->page; - we don't have a DragClient yet, so it is crashing here
+    delete private_data->settings;
+    g_object_unref(private_data->main_frame);
+    delete private_data->user_agent;
+}
+
+static void webkit_gtk_page_class_init(WebKitGtkPageClass* page_class)
+{
+    g_type_class_add_private(page_class, sizeof(WebKitGtkPagePrivate));
+
+
+    /*
+     * signals
+     */
+    /**
+     * WebKitGtkPage::load-started
+     * @page: the object on which the signal is emitted
+     * @frame: the frame going to do the load
+     *
+     * When a WebKitGtkFrame begins to load this signal is emitted.
+     */
+    webkit_gtk_page_signals[LOAD_STARTED] = g_signal_new("load_started",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__OBJECT,
+            G_TYPE_NONE, 1,
+            WEBKIT_GTK_TYPE_FRAME);
+
+    /**
+     * WebKitGtkPage::load-progress-changed
+     * @page: The WebKitGtkPage
+     * @progress: Global progress
+     */
+    webkit_gtk_page_signals[LOAD_PROGRESS_CHANGED] = g_signal_new("load_progress_changed",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__INT,
+            G_TYPE_NONE, 1,
+            G_TYPE_INT);
+    
+    webkit_gtk_page_signals[LOAD_FINISHED] = g_signal_new("load_finished",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            webkit_gtk_marshal_VOID__OBJECT_BOOLEAN,
+            G_TYPE_NONE, 1,
+            WEBKIT_GTK_TYPE_FRAME);
+
+    webkit_gtk_page_signals[TITLE_CHANGED] = g_signal_new("title_changed",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            webkit_gtk_marshal_VOID__STRING_STRING,
+            G_TYPE_NONE, 2,
+            G_TYPE_STRING, G_TYPE_STRING);
+
+    webkit_gtk_page_signals[HOVERING_OVER_LINK] = g_signal_new("hovering_over_link",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            webkit_gtk_marshal_VOID__STRING_STRING,
+            G_TYPE_NONE, 2,
+            G_TYPE_STRING,
+            G_TYPE_STRING);
+
+    webkit_gtk_page_signals[STATUS_BAR_TEXT_CHANGED] = g_signal_new("status_bar_text_changed",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__STRING,
+            G_TYPE_NONE, 1,
+            G_TYPE_STRING);
+
+    webkit_gtk_page_signals[ICOND_LOADED] = g_signal_new("icon_loaded",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+
+    webkit_gtk_page_signals[SELECTION_CHANGED] = g_signal_new("selection_changed",
+            G_TYPE_FROM_CLASS(page_class),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            NULL,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE, 0);
+
+
+    /*
+     * implementations of virtual methods
+     */
+    page_class->create_frame = webkit_gtk_page_real_create_frame;
+    page_class->create_page = webkit_gtk_page_real_create_page;
+    page_class->navigation_requested = webkit_gtk_page_real_navigation_requested;
+    page_class->choose_file = webkit_gtk_page_real_choose_file;
+    page_class->java_script_alert = webkit_gtk_page_real_java_script_alert;
+    page_class->java_script_confirm = webkit_gtk_page_real_java_script_confirm;
+    page_class->java_script_prompt = webkit_gtk_page_real_java_script_prompt;
+    page_class->java_script_console_message = webkit_gtk_page_real_java_script_console_message;
+    G_OBJECT_CLASS(page_class)->finalize = webkit_gtk_page_finalize;
+}
+
+static void webkit_gtk_page_init(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate *private_data = WEBKIT_GTK_PAGE_GET_PRIVATE(WEBKIT_GTK_PAGE(page));
+    private_data->page = new Page(new ChromeClientGdk(page), new ContextMenuClientGdk, new EditorClientGdk(page), 0, new InspectorClientGdk);
+
+
+    GTK_WIDGET_SET_FLAGS(page, GTK_CAN_FOCUS);
+
+    g_signal_connect_after(G_OBJECT(page), "realize", G_CALLBACK(webkit_gtk_page_register_rendering_area_events), page);
+    g_signal_connect_after(G_OBJECT(page), "size-allocate", G_CALLBACK(webkit_gtk_page_rendering_area_resize_callback), page);
+
+    private_data->main_frame = WEBKIT_GTK_FRAME(webkit_gtk_frame_new(page));
+}
+
+GtkWidget* webkit_gtk_page_new(void)
+{
+    WebKitGtkPage* page = WEBKIT_GTK_PAGE(g_object_new(WEBKIT_GTK_TYPE_PAGE, NULL));
+
+    return GTK_WIDGET(page);
+}
+
+void webkit_gtk_page_set_settings(WebKitGtkPage* page, WebKitGtkSettings* settings)
+{
+    notImplemented();
+}
+
+WebKitGtkSettings* webkit_gtk_page_get_settings(WebKitGtkPage* page)
+{
+    notImplemented();
+    return 0;
+}
+
+void webkit_gtk_page_go_backward(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+    frame_data->frame->loader()->goBackOrForward(-1);
+}
+
+void webkit_gtk_page_go_forward(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+    frame_data->frame->loader()->goBackOrForward(1);
+}
+
+void webkit_gtk_page_open(WebKitGtkPage* page, const gchar* url)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+
+    DeprecatedString string = DeprecatedString::fromUtf8(url);
+    frame_data->frame->loader()->load(ResourceRequest(KURL(string)));
+}
+
+void webkit_gtk_page_load_string(WebKitGtkPage* page, const gchar* content, const gchar* content_mime_type, const gchar* content_encoding, const gchar* base_url)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+    
+    KURL url(DeprecatedString::fromUtf8(base_url));
+    RefPtr<SharedBuffer> sharedBuffer = new SharedBuffer(strdup(content), strlen(content));    
+    SubstituteData substituteData(sharedBuffer.release(), String(content_mime_type), String(content_encoding), KURL("about:blank"), url);
+
+    frame_data->frame->loader()->load(ResourceRequest(url), substituteData);
+}
+
+void webkit_gtk_page_load_html_string(WebKitGtkPage* page, const gchar* content, const gchar* base_url)
+{
+    webkit_gtk_page_load_string(page, content, "text/html", "UTF-8", base_url);
+}
+
+void webkit_gtk_page_stop_loading(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(page_data->main_frame);
+    
+    if (FrameLoader* loader = frame_data->frame->loader())
+        loader->stopAllLoaders();
+        
+}
+
+WebKitGtkFrame* webkit_gtk_page_get_main_frame(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* private_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    return private_data->main_frame;
+}
+}
diff --git a/WebKit/gtk/Api/webkitgtkpage.h b/WebKit/gtk/Api/webkitgtkpage.h
new file mode 100644 (file)
index 0000000..286d5a0
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_PAGE_H
+#define WEBKIT_GTK_PAGE_H
+
+#include <gtk/gtk.h>
+#include "webkitgtksettings.h"
+
+G_BEGIN_DECLS
+
+#define WEBKIT_GTK_TYPE_PAGE            (webkit_gtk_page_get_type())
+#define WEBKIT_GTK_PAGE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_GTK_TYPE_PAGE, WebKitGtkPage))
+#define WEBKIT_GTK_PAGE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_GTK_TYPE_PAGE, WebKitGtkPageClass))
+#define WEBKIT_GTK_IS_PAGE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_GTK_TYPE_PAGE))
+#define WEBKIT_GTK_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_GTK_TYPE_PAGE))
+#define WEBKIT_GTK_PAGE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_GTK_TYPE_PAGE, WebKitGtkPageClass))
+
+
+typedef enum {
+    WEBKIT_GTK_ACCEPT_NAVIGATION_REQUEST,
+    WEBKIT_GTK_IGNORE_NAVIGATION_REQUEST,
+    WEBKIT_GTK_DOWNLOAD_NAVIGATION_REQUEST
+} WEBKIT_GTK_NAVIGATION_REQUEST_RESPONSE;
+
+
+typedef struct _WebKitGtkFrame WebKitGtkFrame;
+typedef struct _WebKitGtkFrameData WebKitGtkFrameData;
+typedef struct _WebKitGtkNetworkRequest WebKitGtkNetworkRequest;
+typedef struct _WebKitGtkPage WebKitGtkPage;
+typedef struct _WebKitGtkPageClass WebKitGtkPageClass;
+
+/*
+ * FIXME: Will be different with multiple frames. Once we support multiple Frames
+ * this widget will not be a GtkLayout but we will just allocate a GdkWindow of
+ * the  size of the viewport and we won't be able to use gdk_window_move.
+ */
+struct _WebKitGtkPage {
+    GtkLayout parent;
+};
+
+struct _WebKitGtkPageClass {
+    GtkLayoutClass parent;
+
+    /*
+     * default handler/virtual methods
+     * DISCUSS: create_page 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...
+     */
+    WebKitGtkFrame* (*create_frame) (WebKitGtkPage* page, WebKitGtkFrame* parent_frame, WebKitGtkFrameData* frame_data);
+    WebKitGtkPage*  (*create_page)  (WebKitGtkPage* page);
+
+    /*
+     * TODO: FIXME: Create something like WebPolicyDecisionListener_Protocol instead
+     */
+    WEBKIT_GTK_NAVIGATION_REQUEST_RESPONSE (*navigation_requested) (WebKitGtkPage* page, WebKitGtkFrame* frame, WebKitGtkNetworkRequest* request);
+
+    /*
+     * TODO: DISCUSS: Should these be signals as well?
+     */
+    gchar* (*choose_file) (WebKitGtkPage* page, WebKitGtkFrame* frame, const gchar* old_file);
+    void   (*java_script_alert) (WebKitGtkPage* page, WebKitGtkFrame* frame, const gchar* alert_message);
+    gboolean   (*java_script_confirm) (WebKitGtkPage* page, WebKitGtkFrame* frame, const gchar* confirm_message);
+    gchar* (*java_script_prompt) (WebKitGtkPage* page, WebKitGtkFrame* frame, const gchar* message, const gchar* default_value);
+    void   (*java_script_console_message) (WebKitGtkPage*, const gchar* message, unsigned int line_number, const gchar* source_id);
+};
+
+WEBKIT_GTK_API GType
+webkit_gtk_page_get_type (void);
+
+WEBKIT_GTK_API GtkWidget*
+webkit_gtk_page_new (void);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_set_settings (WebKitGtkPage* page, WebKitGtkSettings* settings);
+
+WEBKIT_GTK_API WebKitGtkSettings*
+webkit_gtk_page_get_settings (WebKitGtkPage* page);
+
+WEBKIT_GTK_API gboolean
+webkit_gtk_page_can_cut (WebKitGtkPage* page);
+
+WEBKIT_GTK_API gboolean
+webkit_gtk_page_can_copy (WebKitGtkPage* page);
+
+WEBKIT_GTK_API gboolean
+webkit_gtk_page_can_copy (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_cut (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_copy (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_paste (WebKitGtkPage* page);
+
+WEBKIT_GTK_API gboolean
+webkit_gtk_page_can_go_backward (WebKitGtkPage* page);
+
+WEBKIT_GTK_API gboolean
+webkit_gtk_page_can_go_forward (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_go_backward (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_go_forward (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_stop_loading (WebKitGtkPage* page);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_open (WebKitGtkPage* page, const gchar* url);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_load_string (WebKitGtkPage* page, const gchar* content, const gchar* content_mime_type, const gchar* content_encoding, const gchar* base_url);
+
+WEBKIT_GTK_API void
+webkit_gtk_page_load_html_string (WebKitGtkPage* page, const gchar* content, const gchar* base_url);
+
+WEBKIT_GTK_API WebKitGtkFrame*
+webkit_gtk_page_get_main_frame (WebKitGtkPage* page);
+
+G_END_DECLS
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtkprivate.cpp b/WebKit/gtk/Api/webkitgtkprivate.cpp
new file mode 100644 (file)
index 0000000..19b7b12
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "webkitgtkprivate.h"
+#include "NotImplemented.h"
+#include "FrameLoader.h"
+#include "ChromeClientGdk.h"
+
+using namespace WebCore;
+
+namespace WebKitGtk {
+void apply(WebKitGtkSettings*, WebCore::Settings*)
+{
+    notImplemented();
+}
+
+WebKitGtkSettings* create(WebCore::Settings*)
+{
+    notImplemented();
+    return 0;
+}
+
+WebKitGtkFrame* getFrameFromPage(WebKitGtkPage* page)
+{
+    return webkit_gtk_page_get_main_frame(page);
+}
+
+WebKitGtkPage* getPageFromFrame(WebKitGtkFrame* frame)
+{
+    return webkit_gtk_frame_get_page(frame);
+}
+
+WebCore::Frame* core(WebKitGtkFrame* frame)
+{
+    WebKitGtkFramePrivate* frame_data = WEBKIT_GTK_FRAME_GET_PRIVATE(frame);
+    return frame_data->frame;
+}
+
+WebKitGtkFrame* kit(WebCore::Frame* coreFrame)
+{
+    FrameLoaderClientGdk* client = static_cast<FrameLoaderClientGdk*>(coreFrame->loader()->client());
+    return client->webFrame();
+}
+
+WebCore::Page* core(WebKitGtkPage* page)
+{
+    WebKitGtkPagePrivate* page_data = WEBKIT_GTK_PAGE_GET_PRIVATE(page);
+    return page_data->page;
+}
+
+WebKitGtkPage* kit(WebCore::Page* page)
+{
+    ChromeClientGdk* client = static_cast<ChromeClientGdk*>(page->chrome()->client());
+    return client->webPage();
+}
+}
diff --git a/WebKit/gtk/Api/webkitgtkprivate.h b/WebKit/gtk/Api/webkitgtkprivate.h
new file mode 100644 (file)
index 0000000..6084a05
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_PRIVATE_H
+#define WEBKIT_GTK_PRIVATE_H
+
+/*
+ * Internal class. This class knows the shared secret of WebKitGtkFrameData,
+ * WebKitGtkNetworkRequest. These private members point to WebCore resources
+ * we don't want to expose to the outer world.
+ */
+
+#include "webkitgtksettings.h"
+#include "webkitgtkpage.h"
+#include "webkitgtkframe.h"
+#include "webkitgtkframedata.h"
+#include "webkitgtknetworkrequest.h"
+
+
+#include "Settings.h"
+#include "Page.h"
+#include "FrameGdk.h"
+#include "FrameLoaderClientGdk.h"
+
+namespace WebKitGtk {
+    void apply(WebKitGtkSettings*,WebCore::Settings*);
+    WebKitGtkSettings* create(WebCore::Settings*);
+    WebKitGtkFrame*  getFrameFromPage(WebKitGtkPage*);
+    WebKitGtkPage* getPageFromFrame(WebKitGtkFrame*);
+
+    WebCore::Frame* core(WebKitGtkFrame*);
+    WebKitGtkFrame* kit(WebCore::Frame*);
+    WebCore::Page* core(WebKitGtkPage*);
+    WebKitGtkPage* kit(WebCore::Page*);
+}
+
+extern "C" {
+    #define WEBKIT_GTK_PAGE_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_GTK_TYPE_PAGE, WebKitGtkPagePrivate))
+    typedef struct _WebKitGtkPagePrivate WebKitGtkPagePrivate;
+    struct _WebKitGtkPagePrivate {
+        WebCore::Page* page;
+        WebCore::Settings* settings;
+
+        WebKitGtkFrame* main_frame;
+        WebCore::String application_name_for_user_agent;
+        WebCore::String* user_agent;
+    };
+    
+    #define WEBKIT_GTK_FRAME_GET_PRIVATE(obj)    (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_GTK_TYPE_FRAME, WebKitGtkFramePrivate))
+    typedef struct _WebKitGtkFramePrivate WebKitGtkFramePrivate;
+    struct _WebKitGtkFramePrivate {
+        WebCore::FrameGdk* frame;
+        WebCore::FrameLoaderClientGdk* client;
+        WebKitGtkPage* page;
+    };
+}
+
+#endif
diff --git a/WebKit/gtk/Api/webkitgtksettings.cpp b/WebKit/gtk/Api/webkitgtksettings.cpp
new file mode 100644 (file)
index 0000000..da55e38
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "webkitgtksettings.h"
+
+extern "C" {
+GType webkit_gtk_web_settings_get_type(void)
+{
+}
+
+WebKitGtkSettings* webkit_gtk_web_settings_copy(WebKitGtkSettings* setting)
+{
+}
+
+void webkit_gtk_web_settings_free(WebKitGtkSettings* setting)
+{
+}
+
+WebKitGtkSettings* webkit_gtk_web_settings_get_global(void)
+{
+}
+
+void webkit_gtk_web_settings_set_global (WebKitGtkSettings* setting)
+{
+}
+
+void webkit_gtk_web_settings_set_font_family(WebKitGtkSettings*, WebKitGtkFontFamily family, gchar* family_name)
+{
+}
+
+gchar* webkit_gtk_web_settings_get_font_family(WebKitGtkSettings*, WebKitGtkFontFamily family)
+{
+}
+
+void webkit_gtk_web_settings_set_user_style_sheet_location(WebKitGtkSettings*, gchar*)
+{
+}
+
+void webkit_gtk_set_ftp_directory_template_path(WebKitGtkSettings*, gchar*)
+{
+}
+}
diff --git a/WebKit/gtk/Api/webkitgtksettings.h b/WebKit/gtk/Api/webkitgtksettings.h
new file mode 100644 (file)
index 0000000..391de38
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WEBKIT_GTK_SETTINGS_H
+#define WEBKIT_GTK_SETTINGS_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "webkitgtkdefines.h"
+
+G_BEGIN_DECLS
+
+typedef enum {
+    WEBKIT_GTK_FONT_FAMILY_STANDARD,
+    WEBKIT_GTK_FONT_FAMILY_FIXED,
+    WEBKIT_GTK_FONT_FAMILY_SERIF,
+    WEBKIT_GTK_FONT_FAMILY_SANS_SERIF,
+    WEBKIT_GTK_FONT_FAMILY_CURSIVE,
+    WEBKIT_GTK_FONT_FAMILY_FANTASY,
+    WEBKIT_GTK_FONT_FAMILY_LAST_ENTRY
+} WebKitGtkFontFamily;
+
+typedef enum {
+    WEBKIT_GTK_EDITABLE_LINK_DEFAULT_BEHAVIOUR,
+    WEBKIT_GTK_EDITABLE_LINK_ALWAYS_LIVE,
+    WEBKIT_GTK_EDITABLE_LINK_ONLY_WITH_SHIFT_KEY,
+    WEBKIT_GTK_EDITABLE_LINK_LIVE_WHEN_NOT_FOCUSED,
+    WEBKIT_GTK_EDITABLE_LINK_NEVER_LIVE
+} WebKitGtkEditableLinkBehaviour;
+
+typedef struct _WebKitGtkSettings WebKitGtkSettings;
+typedef struct _WebKitGtkSettingsPrivate WebKitGtkSettingsPrivate;
+
+struct _WebKitGtkSettings {
+    gchar* font_name[WEBKIT_GTK_FONT_FAMILY_LAST_ENTRY];
+    gint   minimum_font_size;
+    gint   minimum_logical_font_size;
+    gint   default_font_size;
+    gint   default_fixed_font_size;
+    gboolean load_images_automatically;
+    gboolean is_java_script_enabled;
+    gboolean java_script_can_open_windows_automatically;
+    gboolean plugins_enabled;
+    gboolean private_browsing;
+    gchar* user_style_sheet_location;
+    gboolean should_print_backgrounds;
+    gboolean text_areas_are_resizable;
+    WebKitGtkEditableLinkBehaviour editable_link_behaviour;
+    gboolean uses_page_cache;
+    gboolean shrink_standalone_images_to_fit;
+    gboolean show_urls_in_tool_tips;
+    gchar* ftp_directory_template_path;
+    gboolean force_ftp_directory_listings;
+    gboolean developer_extras_enabled;
+
+
+    WebKitGtkSettingsPrivate *private_data;
+};
+
+GType
+webkit_gtk_web_settings_get_type (void);
+
+WebKitGtkSettings*
+webkit_gtk_web_settings_copy (WebKitGtkSettings* setting);
+
+void
+webkit_gtk_web_settings_free (WebKitGtkSettings* setting);
+
+WebKitGtkSettings*
+webkit_gtk_web_settings_get_global (void);
+
+void
+webkit_gtk_web_settings_set_global (WebKitGtkSettings* setting);
+
+void
+webkit_gtk_web_settings_set_font_family(WebKitGtkSettings*, WebKitGtkFontFamily family, gchar *family_name);
+
+gchar*
+webkit_gtk_web_settings_get_font_family(WebKitGtkSettings*, WebKitGtkFontFamily family);
+
+void
+webkit_gtk_web_settings_set_user_style_sheet_location(WebKitGtkSettings*, gchar*);
+
+void
+webkit_gtk_set_ftp_directory_template_path(WebKitGtkSettings*, gchar*);
+
+
+G_END_DECLS
+
+
+#endif
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGdk.cpp b/WebKit/gtk/WebCoreSupport/ChromeClientGdk.cpp
new file mode 100644 (file)
index 0000000..b4fc6ac
--- /dev/null
@@ -0,0 +1,286 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ChromeClientGdk.h"
+#include "FloatRect.h"
+#include "IntRect.h"
+#include "PlatformString.h"
+#include "CString.h"
+#include "TextEncoding.h"
+#include "webkitgtkpage.h"
+#include "webkitgtkprivate.h"
+#include "NotImplemented.h"
+
+using namespace WebCore;
+
+namespace WebKitGtk {
+ChromeClientGdk::ChromeClientGdk(WebKitGtkPage* page)
+    : m_webPage(page)
+{
+}
+
+void ChromeClientGdk::chromeDestroyed()
+{
+    notImplemented();
+}
+
+FloatRect ChromeClientGdk::windowRect()
+{
+    notImplemented();
+    return FloatRect();
+}
+
+void ChromeClientGdk::setWindowRect(const FloatRect& r)
+{
+    notImplemented();
+}
+
+FloatRect ChromeClientGdk::pageRect()
+{
+    notImplemented();
+    return FloatRect();
+}
+
+float ChromeClientGdk::scaleFactor()
+{
+    notImplemented();
+    return 1.0;
+}
+
+void ChromeClientGdk::focus()
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::unfocus()
+{
+    notImplemented();
+}
+    
+Page* ChromeClientGdk::createWindow(Frame*, const FrameLoadRequest&)
+{
+    /* TODO: FrameLoadRequest is not used */
+    WebKitGtkPage* page = WEBKIT_GTK_PAGE_GET_CLASS(m_webPage)->create_page(m_webPage);
+    if (!page)
+        return 0;
+
+    WebKitGtkPagePrivate *private_data = WEBKIT_GTK_PAGE_GET_PRIVATE(WEBKIT_GTK_PAGE(page));
+    return private_data->page;
+}
+
+Page* ChromeClientGdk::createModalDialog(Frame*, const FrameLoadRequest&)
+{
+    notImplemented();
+    return 0;
+}
+
+void ChromeClientGdk::show()
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::canRunModal()
+{
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::runModal()
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::setToolbarsVisible(bool)
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::toolbarsVisible()
+{
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::setStatusbarVisible(bool)
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::statusbarVisible()
+{
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::setScrollbarsVisible(bool)
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::scrollbarsVisible() {
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::setMenubarVisible(bool)
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::menubarVisible()
+{
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::setResizable(bool)
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::closeWindowSoon()
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::canTakeFocus(FocusDirection)
+{
+    notImplemented();
+    return true;
+}
+
+void ChromeClientGdk::takeFocus(FocusDirection)
+{
+    notImplemented();
+}
+
+bool ChromeClientGdk::canRunBeforeUnloadConfirmPanel()
+{
+    notImplemented();
+    return false;
+}
+
+bool ChromeClientGdk::runBeforeUnloadConfirmPanel(const WebCore::String&, WebCore::Frame*)
+{
+    notImplemented();
+    return false;
+}
+
+void ChromeClientGdk::addMessageToConsole(const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceId)
+{
+    CString messageString = message.utf8();
+    CString sourceIdString = sourceId.utf8();
+
+    WEBKIT_GTK_PAGE_GET_CLASS(m_webPage)->java_script_console_message(m_webPage, messageString.data(), lineNumber, sourceIdString.data());
+}
+
+void ChromeClientGdk::runJavaScriptAlert(Frame* frame, const String& message)
+{
+    CString messageString = message.utf8();
+    WEBKIT_GTK_PAGE_GET_CLASS(m_webPage)->java_script_alert(m_webPage, kit(frame), messageString.data());
+}
+
+bool ChromeClientGdk::runJavaScriptConfirm(Frame* frame, const String& message)
+{
+    CString messageString = message.utf8();
+    return WEBKIT_GTK_PAGE_GET_CLASS(m_webPage)->java_script_confirm(m_webPage, kit(frame), messageString.data());
+}
+
+bool ChromeClientGdk::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
+{
+    CString messageString = message.utf8();
+    CString defaultValueString = defaultValue.utf8(); 
+
+    gchar* cresult = WEBKIT_GTK_PAGE_GET_CLASS(m_webPage)->java_script_prompt(m_webPage,
+                                                                              kit(frame),
+                                                                              messageString.data(),
+                                                                              defaultValueString.data());
+    if (!cresult)
+        return false;
+    else {
+        result = UTF8Encoding().decode(cresult, strlen(cresult));
+        g_free(cresult);
+        return true;
+    }
+}
+
+void ChromeClientGdk::setStatusbarText(const String& string)
+{
+    CString stringMessage = string.utf8();
+    g_signal_emit_by_name(m_webPage, "status_bar_text_changed", stringMessage.data());
+}
+
+bool ChromeClientGdk::shouldInterruptJavaScript()
+{
+    notImplemented();
+    return false;
+}
+
+bool ChromeClientGdk::tabsToLinks() const
+{
+    notImplemented();
+    return false;
+}
+
+IntRect ChromeClientGdk::windowResizerRect() const
+{
+    notImplemented();
+    return IntRect();
+}
+
+void ChromeClientGdk::addToDirtyRegion(const IntRect&)
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::updateBackingStore()
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags)
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::setToolTip(const String&)
+{
+    notImplemented();
+}
+
+void ChromeClientGdk::print(Frame*)
+{
+    notImplemented();
+}
+}
diff --git a/WebKit/gtk/WebCoreSupport/ChromeClientGdk.h b/WebKit/gtk/WebCoreSupport/ChromeClientGdk.h
new file mode 100644 (file)
index 0000000..d421b8d
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer. 
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution. 
+ * 3.  Neither the name of Apple, Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission. 
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ChromeClientGdk_h
+#define ChromeClientGdk_h
+
+#include "ChromeClient.h"
+
+typedef struct _WebKitGtkPage WebKitGtkPage;
+
+namespace WebKitGtk {
+
+    class ChromeClientGdk : public WebCore::ChromeClient {
+    public:
+        ChromeClientGdk(WebKitGtkPage*);
+        WebKitGtkPage* webPage() const { return m_webPage; }
+
+        virtual void chromeDestroyed();
+
+        virtual void setWindowRect(const WebCore::FloatRect&);
+        virtual WebCore::FloatRect windowRect();
+
+        virtual WebCore::FloatRect pageRect();
+
+        virtual float scaleFactor();
+
+        virtual void focus();
+        virtual void unfocus();
+
+        virtual bool canTakeFocus(WebCore::FocusDirection);
+        virtual void takeFocus(WebCore::FocusDirection);
+
+        virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&);
+        virtual WebCore::Page* createModalDialog(WebCore::Frame*, const WebCore::FrameLoadRequest&);
+        virtual void show();
+
+        virtual bool canRunModal();
+        virtual void runModal();
+
+        virtual void setToolbarsVisible(bool);
+        virtual bool toolbarsVisible();
+
+        virtual void setStatusbarVisible(bool);
+        virtual bool statusbarVisible();
+
+        virtual void setScrollbarsVisible(bool);
+        virtual bool scrollbarsVisible();
+
+        virtual void setMenubarVisible(bool);
+        virtual bool menubarVisible();
+
+        virtual void setResizable(bool);
+
+        virtual void addMessageToConsole(const WebCore::String& message, unsigned int lineNumber,
+                                         const WebCore::String& sourceID);
+
+        virtual bool canRunBeforeUnloadConfirmPanel();
+        virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, WebCore::Frame* frame);
+
+        virtual void closeWindowSoon();
+
+        virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
+        virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
+        virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
+        virtual void setStatusbarText(const WebCore::String&);
+        virtual bool shouldInterruptJavaScript();
+        virtual bool tabsToLinks() const;
+
+        virtual WebCore::IntRect windowResizerRect() const;
+        virtual void addToDirtyRegion(const WebCore::IntRect&);
+        virtual void scrollBackingStore(int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
+        virtual void updateBackingStore();
+
+        virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
+
+        virtual void setToolTip(const WebCore::String&);
+
+        virtual void print(WebCore::Frame*);
+    private:
+        WebKitGtkPage* m_webPage;
+    };
+}
+
+#endif // ChromeClientGdk_h
index a2ba4c0..5aaf521 100644 (file)
@@ -1,3 +1,13 @@
+2007-07-22  Holger Hans Peter Freyther  <zecke@selfish.org>
+
+        Reviewed by Adam.
+
+        Make the GdkLauncher use the new WebKit/Gtk API. Change webkitdirs.pm to
+        honor --qmakearg for the Gdk/Gtk build as well.
+
+        * GdkLauncher/main.cpp: Switch to the new API
+        * Scripts/webkitdirs.pm: Allow to specify --qmakearg, e.g. to control the WEBKIT_{INC,LIB}_DIR 
+
 2007-07-22  Darin Adler  <darin@apple.com>
 
         * DumpRenderTree/TextInputController.m: (-[TextInputController interpretKeyEvents:withSender:]):
index d09c838..7d90dde 100644 (file)
-#include "config.h"
-#include "Platform.h"
-#include "ChromeClientGdk.h"
-#include "ContextMenuClientGdk.h"
-#include "Document.h"
-#include "DragClient.h"
-#include "EditorClientGdk.h"
-#include "FrameGdk.h"
-#include "FrameLoader.h"
-#include "FrameLoaderClientGdk.h"
-#include "FrameView.h"
-#include "InspectorClientGdk.h"
-#include "KURL.h"
-#include "Logging.h"
-#include "Page.h"
-#include "PlatformString.h"
-#include "ResourceHandleManager.h"
-
-#if SVG_SUPPORT
-#include "SVGNames.h"
-#include "XLinkNames.h"
-#include "SVGDocumentExtensions.h"
-#endif
-
-#include <gdk/gdk.h>
+#include "webkitgtkpage.h"
+#include "webkitgtkglobal.h"
+
 #include <gtk/gtk.h>
 
-using namespace WebCore;
+#include <string.h>
 
 static GtkWidget* gURLBarEntry;
-static FrameGdk* gFrame = 0;
+static GtkWidget* gTopLevelWindow;
+static WebKitGtkPage* gPage;
+static gchar* gTitle;
+static gint gProgress;
 
 static bool stringIsEqual(const char* str1, const char* str2)
 {
     return 0 == strcmp(str1, str2);
 }
 
-static void handleGdkEvent(GtkWidget* widget, GdkEvent* event)
+static gchar* autocorrectURL(const gchar* url)
 {
-    gFrame->handleGdkEvent(event);
-}
-
-static String autocorrectURL(const String& url)
-{
-    String parsedURL = url;
-    if (!url.startsWith("http://") && !url.startsWith("https://")
-        && !url.startsWith("file://") && !url.startsWith("ftp://"))
-        parsedURL = String("http://") + url;
-    return parsedURL;
+    if (strncmp("http://", url, 7) != 0 && strncmp("https://", url, 8) != 0 && strncmp("file://", url, 7) != 0 && strncmp("ftp://", url, 6) != 0) {
+        GString* string = g_string_new("http://");
+        g_string_append(string, url);
+        return g_string_free(string, FALSE);
+    }
+    
+    return g_strdup(url);
 }
 
 static void goToURLBarText(GtkWidget* urlBarEntry)
 {
-    String url(gtk_entry_get_text(GTK_ENTRY(urlBarEntry)));
-    if (url.isEmpty())
+    const gchar* url = gtk_entry_get_text(GTK_ENTRY(urlBarEntry));
+    if (!url || strlen(url) == 0)
         return;
 
-    String parsedURL = autocorrectURL(url);
-    gFrame->loader()->load(ResourceRequest(parsedURL));
+    gchar* parsedURL = autocorrectURL(url);
+    webkit_gtk_page_open(gPage, parsedURL);
+    g_free(parsedURL);
 }
 
-static void goButtonClickedCallback(GtkWidget* widget, GtkWidget* entry)
+static void goButtonClickedCallback(GtkWidget*, GtkWidget* entry)
 {
     goToURLBarText(entry);
 }
 
-static void urlBarEnterCallback(GtkWidget* widget, GtkWidget* entry)
+static void urlBarEnterCallback(GtkWidget*, GtkWidget* entry)
 {
     goToURLBarText(entry);
 }
 
-static void registerRenderingAreaEvents(GtkWidget* win)
+static void updateWindowTitle()
 {
-    gdk_window_set_events(GTK_IS_LAYOUT(win) ? GTK_LAYOUT(win)->bin_window : win->window,
-                          (GdkEventMask)(GDK_EXPOSURE_MASK
-                            | GDK_BUTTON_PRESS_MASK
-                            | GDK_BUTTON_RELEASE_MASK
-                            | GDK_POINTER_MOTION_MASK
-                            | GDK_KEY_PRESS_MASK
-                            | GDK_KEY_RELEASE_MASK
-                            | GDK_BUTTON_MOTION_MASK
-                            | GDK_BUTTON1_MOTION_MASK
-                            | GDK_BUTTON2_MOTION_MASK
-                            | GDK_BUTTON3_MOTION_MASK));
-
-    g_signal_connect(GTK_OBJECT(win), "expose-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "key-press-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "key-release-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "button-press-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "button-release-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "motion-notify-event", G_CALLBACK(handleGdkEvent), NULL);
-    g_signal_connect(GTK_OBJECT(win), "scroll-event", G_CALLBACK(handleGdkEvent), NULL);
+    GString* string = g_string_new(NULL);
+    g_string_printf(string, "GdkLauncher %s  (%d/100)", gTitle, gProgress);
+    gchar* title = g_string_free(string, FALSE);
+    gtk_window_set_title(GTK_WINDOW(gTopLevelWindow), title);
+    g_free(title);
 }
 
-static void layout_realize_callback(GtkWidget *widget, gpointer)
+static void titleChanged(WebKitGtkPage*, const gchar* title, const gchar* url, WebKitGtkPage*)
 {
-    registerRenderingAreaEvents(widget);
+    gtk_entry_set_text(GTK_ENTRY(gURLBarEntry), url);
+
+    if (gTitle)
+        g_free(gTitle);
+    gTitle = g_strdup(title);
+    updateWindowTitle();
 }
 
-static void frameResizeCallback(GtkWidget* widget, GtkAllocation* allocation, gpointer data)
+static void progressChanged(WebKitGtkPage*, gint progress, WebKitGtkPage*)
 {
-    if (!gFrame)
-        return;
-
-    gFrame->view()->updateGeometry(allocation->width, allocation->height);
-    gFrame->forceLayout();
-    gFrame->view()->adjustViewSize();
-    gFrame->sendResizeEvent();
+    gProgress = progress;
+    updateWindowTitle();
 }
 
-static void frameDestroyCallback(GtkWidget* widget, gpointer data)
+static void frameDestroyCallback(GtkWidget*, gpointer)
 {
     gtk_main_quit();
 }
 
 static void menuMainBackCallback(gpointer data)
 {
-    ASSERT(!data);
-    gFrame->loader()->goBackOrForward(-1);
+    g_assert(!data);
+    webkit_gtk_page_go_backward(gPage);
 }
 
 static void menuMainForwardCallback(gpointer data)
 {
-    ASSERT(!data);
-    gFrame->loader()->goBackOrForward(1);
+    g_assert(!data);
+    webkit_gtk_page_go_forward(gPage);
 }
 
-static void menuMainQuitCallback(gpointer data)
+static void menuMainQuitCallback(gpointer)
 {
     gtk_main_quit();
 }
@@ -133,9 +98,9 @@ static void menuMainQuitCallback(gpointer data)
 int main(int argc, char* argv[]) 
 {
     gtk_init(&argc, &argv);
-    WebCore::InitializeLoggingChannelsIfNecessary();
+    webkit_gtk_init();
 
-    String url("http://www.google.com");
+    gchar* url = "http://www.google.com";
     bool exitAfterLoading = false;
     bool dumpRenderTree = false;
     for (int argPos = 1; argPos < argc; ++argPos) {
@@ -181,12 +146,12 @@ int main(int argc, char* argv[])
     GtkWidget* menuBar = gtk_menu_bar_new();
     gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuMainRoot);
 
-    GtkWidget* topLevelWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    gtk_window_set_default_size(GTK_WINDOW(topLevelWindow), 800, 600);
-    gtk_widget_set_name(topLevelWindow, "GdkLauncher");
+    gTopLevelWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_default_size(GTK_WINDOW(gTopLevelWindow), 800, 600);
+    gtk_widget_set_name(gTopLevelWindow, "GdkLauncher");
     GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
-    gtk_container_add(GTK_CONTAINER(topLevelWindow), vbox);
-    g_signal_connect(G_OBJECT(topLevelWindow), "destroy", G_CALLBACK(frameDestroyCallback), NULL);
+    gtk_container_add(GTK_CONTAINER(gTopLevelWindow), vbox);
+    g_signal_connect(G_OBJECT(gTopLevelWindow), "destroy", G_CALLBACK(frameDestroyCallback), NULL);
 
     GtkWidget* hbox = gtk_hbox_new(FALSE, 2);
     gtk_box_pack_start(GTK_BOX(vbox), menuBar, FALSE, FALSE, 0);
@@ -201,46 +166,19 @@ int main(int argc, char* argv[])
     g_signal_connect(G_OBJECT(urlBarSubmitButton), "clicked", G_CALLBACK(goButtonClickedCallback), (gpointer)gURLBarEntry);
     gtk_widget_show(vbox);
 
-    GtkWidget* scrolledWindow = gtk_scrolled_window_new(0,0);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledWindow),
-                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+    GtkWidget* scrolledWindow = gtk_scrolled_window_new(NULL,NULL);
+    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow),
+                                   GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+    gPage = WEBKIT_GTK_PAGE(webkit_gtk_page_new());
+    gtk_container_add(GTK_CONTAINER(scrolledWindow), GTK_WIDGET(gPage));
     gtk_box_pack_start(GTK_BOX(vbox), scrolledWindow, TRUE, TRUE, 0);
-    gtk_widget_show(scrolledWindow);
-
-    GtkWidget* layout = gtk_layout_new(gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW(scrolledWindow)),
-                                       gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scrolledWindow)));
-    g_signal_connect_after(G_OBJECT(layout), "realize", G_CALLBACK(layout_realize_callback), NULL );
-    gtk_container_add(GTK_CONTAINER(scrolledWindow), layout);
-
-    g_signal_connect_after(GTK_OBJECT(layout), "size-allocate", G_CALLBACK(frameResizeCallback), NULL);
-    gtk_widget_show(layout);
-    GTK_WIDGET_SET_FLAGS(scrolledWindow, GTK_CAN_FOCUS);
-    GTK_WIDGET_SET_FLAGS(layout, GTK_CAN_FOCUS);
-
-    gtk_widget_show_all(topLevelWindow);
-
-    EditorClientGdk* editorClient = new EditorClientGdk;
-    ContextMenuClient* contextMenuClient = new ContextMenuClientGdk;
-    Page* page = new Page(new ChromeClientGdk, contextMenuClient, editorClient, 0, new InspectorClientGdk);
-    editorClient->setPage(page);
-    FrameLoaderClientGdk* frameLoaderClient = new FrameLoaderClientGdk;
-    gFrame = new FrameGdk(page, 0, frameLoaderClient);
-    gFrame->setExitAfterLoading(exitAfterLoading);
-    gFrame->setDumpRenderTreeAfterLoading(dumpRenderTree);
-
-    FrameView* frameView = new FrameView(gFrame);
-    gFrame->setView(frameView);
-    frameView->setGtkWidget(GTK_LAYOUT(layout));
-
-    gFrame->init();
-    gFrame->loader()->load(ResourceRequest(url));
+    
+    g_signal_connect(gPage, "title-changed", G_CALLBACK(titleChanged), gPage);
+    g_signal_connect(gPage, "load-progress-changed", G_CALLBACK(progressChanged), gPage);
+    webkit_gtk_page_open(gPage, url);
+
+    gtk_widget_show_all(gTopLevelWindow);
     gtk_main();
-#if 0 // FIXME: this crashes at the moment. needs to provide DragClient
-    delete page;
-#endif
-    if (FrameLoader* loader = gFrame->loader())
-        loader->stopAllLoaders();
-    delete gFrame;
     return 0;
 }
 
index 8cd8b38..2af1bed 100644 (file)
@@ -600,6 +600,13 @@ sub buildQMakeGdkProject($$)
     my $prefix = $ENV{"WebKitInstallationPrefix"};
 
     my @buildArgs = ("-r");
+
+    foreach my $opt (@ARGV) {
+        if ($opt =~ /^--qmakearg=(.*)/i ) {
+            push @buildArgs, $1;
+        }
+    }
+
     push @buildArgs, "OUTPUT_DIR=" . baseProductDir() . "/$config";
     push @buildArgs, "CONFIG-=qt";
     push @buildArgs, "CONFIG+=gdk-port";