2006-11-08 Krzysztof Kowalczyk <kkowalczyk@gmail.com>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 06:39:26 +0000 (06:39 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Nov 2006 06:39:26 +0000 (06:39 +0000)
        Reviewed by Maciej.

        Linux\Gdk fixes.

        * platform/gdk/ChromeClientGdk.h:
        (WebCore::ChromeClientGdk::~ChromeClientGdk):
        * platform/gdk/CursorGdk.cpp:
        (WebCore::Cursor::Cursor):
        (WebCore::moveCursor):
        * platform/gdk/FrameGdk.cpp:
        (WebCore::FrameGdk::FrameGdk):
        (WebCore::FrameGdk::submitForm):
        (WebCore::FrameGdk::urlSelected):
        * platform/gdk/PageGdk.cpp:
        * platform/gdk/ScreenClientGdk.h: Added.
        (WebCore::ScreenClientGdk::~ScreenClientGdk):
        * platform/gdk/ScreenGdk.cpp:
        (WebCore::ScreenClientGdk::depth):
        (WebCore::ScreenClientGdk::depthPerComponent):
        (WebCore::ScreenClientGdk::isMonochrome):
        (WebCore::ScreenClientGdk::rect):
        (WebCore::ScreenClientGdk::usableRect):
        * platform/gdk/TemporaryLinkStubs.cpp:
        (FrameGdk::historyURL):
        (ChromeClientGdk::windowRect):
        (ChromeClientGdk::setWindowRect):
        (ChromeClientGdk::pageRect):
        (ChromeClientGdk::scaleFactor):
        (ChromeClientGdk::focus):
        (ChromeClientGdk::unfocus):
        (ChromeClientGdk::createWindow):
        (ChromeClientGdk::createModalDialog):
        (ChromeClientGdk::show):
        (ChromeClientGdk::canRunModal):
        (ChromeClientGdk::runModal):
        (ChromeClientGdk::setToolbarsVisible):
        (ChromeClientGdk::toolbarsVisible):
        (ChromeClientGdk::setStatusbarVisible):
        (ChromeClientGdk::statusbarVisible):
        (ChromeClientGdk::setScrollbarsVisible):
        (ChromeClientGdk::scrollbarsVisible):
        (ChromeClientGdk::setMenubarVisible):
        (ChromeClientGdk::menubarVisible):
        (ChromeClientGdk::setResizable):
        * platform/network/ResourceHandleInternal.h:
        (WebCore::ResourceHandleInternal::client):
        * platform/network/gdk/ResourceHandleManager.cpp:
        (WebCore::writeCallback):
        (WebCore::ResourceHandleManager::downloadTimerCallback):
        (WebCore::ResourceHandleManager::remove):

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

WebCore/ChangeLog
WebCore/platform/gdk/ChromeClientGdk.h
WebCore/platform/gdk/CursorGdk.cpp
WebCore/platform/gdk/FrameGdk.cpp
WebCore/platform/gdk/PageGdk.cpp
WebCore/platform/gdk/ScreenClientGdk.h [new file with mode: 0644]
WebCore/platform/gdk/ScreenGdk.cpp
WebCore/platform/gdk/TemporaryLinkStubs.cpp
WebCore/platform/network/ResourceHandleInternal.h
WebCore/platform/network/gdk/ResourceHandleManager.cpp

index 8c36957a5af561ae5f84880a40265ad7d9645c04..dbbd53bd3d4ff69887485664c97f4a1385de8882 100644 (file)
@@ -1,3 +1,56 @@
+2006-11-08  Krzysztof Kowalczyk  <kkowalczyk@gmail.com>
+
+        Reviewed by Maciej.
+
+        Linux\Gdk fixes.
+
+        * platform/gdk/ChromeClientGdk.h:
+        (WebCore::ChromeClientGdk::~ChromeClientGdk):
+        * platform/gdk/CursorGdk.cpp:
+        (WebCore::Cursor::Cursor):
+        (WebCore::moveCursor):
+        * platform/gdk/FrameGdk.cpp:
+        (WebCore::FrameGdk::FrameGdk):
+        (WebCore::FrameGdk::submitForm):
+        (WebCore::FrameGdk::urlSelected):
+        * platform/gdk/PageGdk.cpp:
+        * platform/gdk/ScreenClientGdk.h: Added.
+        (WebCore::ScreenClientGdk::~ScreenClientGdk):
+        * platform/gdk/ScreenGdk.cpp:
+        (WebCore::ScreenClientGdk::depth):
+        (WebCore::ScreenClientGdk::depthPerComponent):
+        (WebCore::ScreenClientGdk::isMonochrome):
+        (WebCore::ScreenClientGdk::rect):
+        (WebCore::ScreenClientGdk::usableRect):
+        * platform/gdk/TemporaryLinkStubs.cpp:
+        (FrameGdk::historyURL):
+        (ChromeClientGdk::windowRect):
+        (ChromeClientGdk::setWindowRect):
+        (ChromeClientGdk::pageRect):
+        (ChromeClientGdk::scaleFactor):
+        (ChromeClientGdk::focus):
+        (ChromeClientGdk::unfocus):
+        (ChromeClientGdk::createWindow):
+        (ChromeClientGdk::createModalDialog):
+        (ChromeClientGdk::show):
+        (ChromeClientGdk::canRunModal):
+        (ChromeClientGdk::runModal):
+        (ChromeClientGdk::setToolbarsVisible):
+        (ChromeClientGdk::toolbarsVisible):
+        (ChromeClientGdk::setStatusbarVisible):
+        (ChromeClientGdk::statusbarVisible):
+        (ChromeClientGdk::setScrollbarsVisible):
+        (ChromeClientGdk::scrollbarsVisible):
+        (ChromeClientGdk::setMenubarVisible):
+        (ChromeClientGdk::menubarVisible):
+        (ChromeClientGdk::setResizable):
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::client):
+        * platform/network/gdk/ResourceHandleManager.cpp:
+        (WebCore::writeCallback):
+        (WebCore::ResourceHandleManager::downloadTimerCallback):
+        (WebCore::ResourceHandleManager::remove):
+
 2006-11-08  Adam Roben  <aroben@apple.com>
 
         Build fix.
index c8028201042f2f2d3e27ec4722c1f28a092393ac..540d23a589e0a39f4c5caf8bc2f09976517716fe 100644 (file)
 
 namespace WebCore {
 
-class ChromeClientGdk : public ChromeClient {
-public:
-    virtual ~ChromeClientGdk() { }
+    class ChromeClientGdk : public ChromeClient {
+    public:
+        virtual ~ChromeClientGdk() { }
+            
+        virtual void setWindowRect(const FloatRect& r);
+        virtual FloatRect windowRect();
+
+        virtual FloatRect pageRect();
+
+        virtual float scaleFactor();
+
+        virtual void focus();
+        virtual void unfocus();
+
+        virtual Page* createWindow(const FrameLoadRequest&);
+        virtual Page* createModalDialog(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 bool canRunModal();
-    virtual void runModal();
-};
+        virtual void setMenubarVisible(bool);
+        virtual bool menubarVisible();
+
+        virtual void setResizable(bool);
+
+    };
 
 }
 
index 49bd0365d32c1eeb720fe5b8684a7c8eaccb3b8b..11178d4c60bed4c09c1f55b61f8563a238bcfcc0 100644 (file)
 
 #include "DeprecatedString.h"
 #include <gdk/gdk.h>
+#include <stdio.h>
+#include <stdlib.h>
 #include <wtf/Assertions.h>
 
+#define notImplemented() do { fprintf(stderr, "%s FIXME: UNIMPLEMENTED %s:%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); } while(0)
+
 namespace WebCore {
 
 Cursor::Cursor(const Cursor& other)
@@ -41,6 +45,11 @@ Cursor::Cursor(const Cursor& other)
         gdk_cursor_ref(m_impl);
 }
 
+Cursor::Cursor(Image*, const IntPoint&)
+{
+    notImplemented(); 
+}
+
 Cursor::~Cursor()
 {
     if (m_impl)
@@ -81,6 +90,12 @@ const Cursor& handCursor()
     return c;
 }
 
+const Cursor& moveCursor() 
+{
+    static Cursor c = gdk_cursor_new(GDK_FLEUR);
+    return c; 
+}
+
 const Cursor& iBeamCursor()
 {
     static Cursor c = gdk_cursor_new(GDK_XTERM);
index 46693ea23e0d0f24f700ccc32afa99e61ee2001e..8840b954fdbcd0a6ea5477114344c2ce173d7125 100644 (file)
@@ -35,6 +35,7 @@
 #include "FrameView.h"
 #include "FrameLoadRequest.h"
 #include "FramePrivate.h"
+#include <gdk/gdk.h>
 #include "GraphicsContext.h"
 #include "HitTestResult.h"
 #include "HitTestRequest.h"
 #include "RenderLayer.h"
 #include "ResourceHandle.h"
 #include "ResourceHandleInternal.h"
+#include "ScreenClientGdk.h"
 #include "SelectionController.h"
 #include "Settings.h"
 #include "SSLKeyGenerator.h"
 #include "TypingCommand.h"
-#include <gdk/gdk.h>
 
 // This function loads resources from WebKit
 // This does not belong here and I'm not sure where
@@ -158,7 +159,7 @@ static void doScroll(const RenderObject* r, float deltaX, float deltaY)
 }
 
 FrameGdk::FrameGdk(GdkDrawable* gdkdrawable)
-    : Frame(new Page(new ChromeClientGdk()), 0, 0), m_drawable(gdkdrawable)
+    : Frame(new Page(new ChromeClientGdk(), new ScreenClientGdk()), 0, 0), m_drawable(gdkdrawable)
 {
     Settings* settings = new Settings;
     settings->setAutoLoadImages(true);
@@ -208,8 +209,8 @@ void FrameGdk::submitForm(const FrameLoadRequest& frameLoadRequest, Event*)
 
     d->m_submittedFormURL = request.url();
 
-    if (m_client)
-        m_client->submitForm(request.httpMethod(), request.url(), &request.httpBody());
+    if (client())
+        client()->submitForm(request.httpMethod(), request.url(), &request.httpBody());
 
     clearRecordedFormValues();
 }
@@ -218,19 +219,11 @@ void FrameGdk::urlSelected(const FrameLoadRequest& frameLoadRequest, Event*)
 {
     ResourceRequest request = frameLoadRequest.resourceRequest();
 
-    if (!m_client)
+    if (!client())
         return;
 
-    m_client->openURL(request.url());
-}
-
-#if 0
-void FrameGdk::openURL(const KURL& url)
-{
-    ASSERT(m_client);
-    m_client->openURL(url);
+    client()->openURL(request.url());
 }
-#endif
 
 String FrameGdk::userAgent() const
 {
index d261fd13a3cd052d6b42d251f95460198c86caea..491b5633192de1d7db3d3ec027e1a90afa017086 100644 (file)
 
 namespace WebCore {
 
-static GdkDrawable* rootWindowForFrame(Frame* frame)
-{
-    if (!frame)
-        return 0;
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return 0;
-    GdkDrawable* drawable = frameView->drawable();
-    if (!drawable)
-        return 0;
-    if (!GDK_WINDOW(drawable))
-        return drawable;
-    GdkWindow* window = GDK_WINDOW(drawable);
-    return gdk_window_get_toplevel(window);
 }
 
-FloatRect Page::windowRect() const
-{
-    GdkDrawable* drawable = rootWindowForFrame(mainFrame());
-    if (!drawable)
-        return FloatRect();
-
-    gint x, y, width, height, depth;
-
-    if (!GDK_IS_WINDOW(drawable)) {
-        gdk_drawable_get_size(drawable, &width, &height);
-        return FloatRect(0, 0, width, height);
-    }
-
-    GdkWindow* window = GDK_WINDOW(drawable);
-    gdk_window_get_geometry(window, &x, &y, &width, &height, &depth);
-    return FloatRect(x, y, width, height);
-}
-
-void Page::setWindowRect(const FloatRect& r)
-{
-    GdkDrawable* drawable = rootWindowForFrame(mainFrame());
-    if (!drawable || !GDK_IS_WINDOW(drawable))
-        return;
-    GdkWindow* window = GDK_WINDOW(drawable);
-    gdk_window_move_resize(window, (int)r.x(), (int)r.y(), (int)r.width(), (int)r.height());
-}
-
-}
diff --git a/WebCore/platform/gdk/ScreenClientGdk.h b/WebCore/platform/gdk/ScreenClientGdk.h
new file mode 100644 (file)
index 0000000..8868b2a
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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 ScreenClientGdk_h
+#define ScreenClientGdk_h
+
+#include "ScreenClient.h"
+
+namespace WebCore {
+
+    class ScreenClientGdk : public ScreenClient {
+
+        virtual ~ScreenClientGdk() { }
+
+        virtual int depth();
+        virtual int depthPerComponent();
+
+        virtual bool isMonochrome();
+
+        virtual FloatRect rect();
+        virtual FloatRect usableRect();
+    };
+
+}
+
+#endif // ScreenClientGdk_h
index 4d7f46242f09fa17dd047eb19fd78f7db9fb6fe8..43a5ad16cb42066153f18740b32592f38ff0c27e 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
+// FIXME: should be renamed to ScreenClientGdk.cpp
+
 #include "config.h"
-#include "Screen.h"
+#include "ScreenClientGdk.h"
 
 #include "FloatRect.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "Page.h"
-#include "Widget.h"
-
 #include <gdk/gdk.h>
 
-namespace WebCore {
-
-static GdkDrawable* drawableForPage(const Page* page)
-{
-    Frame* frame = (page ? page->mainFrame() : 0);
-    FrameView* frameView = (frame ? frame->view() : 0);
-    
-    if (!frameView)
-        return 0;
-    
-    return frameView->drawable();
-}
+#define notImplemented() do { fprintf(stderr, "%s FIXME: UNIMPLEMENTED %s:%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); } while(0)
 
-FloatRect screenRect(const Page* page)
-{
-    GdkDrawable* drawable = drawableForPage(page);
-    if (!drawable)
-        return FloatRect();
-    GdkScreen* screen = gdk_drawable_get_screen(drawable);
-    return FloatRect(0, 0, gdk_screen_get_width(screen), gdk_screen_get_height(screen));
-}
+namespace WebCore {
 
-int screenDepth(const Page* page)
-{
-    GdkDrawable* drawable = drawableForPage(page);
-    if (!drawable)
-        return 32;
-    return gdk_drawable_get_depth(drawable);
-}
+int ScreenClientGdk::depth() { notImplemented(); return 32; }
+int ScreenClientGdk::depthPerComponent() { notImplemented(); return 8; }
 
-FloatRect usableScreenRect(const Page* page)
-{
-    return screenRect(page);
-}
+bool ScreenClientGdk::isMonochrome() { notImplemented(); return false; }
 
-float scaleFactor(const Page*)
-{
-    return 1.0f;
-
-}
+FloatRect ScreenClientGdk::rect() { notImplemented(); return FloatRect(); }
+FloatRect ScreenClientGdk::usableRect() { notImplemented(); return FloatRect(); }
 
 }
index b3baf6733df6388cd1fa851f4cfddb1b22235e18..743b1c222e0b24428ae8ab148891e5f5e5103dee 100644 (file)
@@ -50,7 +50,6 @@
 #include "loader.h"
 #include "LocalizedStrings.h"
 #include "Node.h"
-#include "Page.h"
 #include "Path.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformScrollBar.h"
@@ -72,6 +71,9 @@ using namespace WebCore;
 #define notImplemented() do { fprintf(stderr, "%s FIXME: UNIMPLEMENTED %s:%d\n", __PRETTY_FUNCTION__, __FILE__, __LINE__); } while(0)
 
 namespace WebCore {
+
+class Page;
+
 struct PlatformDataStruct
 {
 };
@@ -119,8 +121,6 @@ double Slider::value() const { notImplemented(); return 0; }
 Widget::FocusPolicy Slider::focusPolicy() const { notImplemented(); return NoFocus; }
 Widget::FocusPolicy TextField::focusPolicy() const { notImplemented(); return NoFocus; }
 
-Cursor::Cursor(Image*, const IntPoint&) { notImplemented(); }
-
 PlatformMouseEvent::PlatformMouseEvent(const CurrentEventTag&) { notImplemented(); }
 String WebCore::searchableIndexIntroduction() { notImplemented(); return String(); }
 
@@ -171,18 +171,31 @@ Plugin* FrameGdk::createPlugin(Element*, KURL const&, const Vector<String>&, con
 void FrameGdk::goBackOrForward(int distance) { notImplemented(); }
 int FrameGdk::getHistoryLength() {notImplemented(); return 0; }
 KURL FrameGdk::historyURL(int distance) { notImplemented(); return KURL(); }
-bool ChromeClientGdk::canRunModal() { notImplemented(); return 0; }
-void ChromeClientGdk::runModal() { notImplemented(); }
 
-int WebCore::screenDepthPerComponent(const Page*) { notImplemented(); return 0; }
-bool WebCore::screenIsMonochrome(const Page*) { notImplemented(); return false; }
+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(const FrameLoadRequest&) { notImplemented(); return 0; }
+WebCore::Page* ChromeClientGdk::createModalDialog(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(); }
 
 /********************************************************/
 /* Completely empty stubs (mostly to allow DRT to run): */
 /********************************************************/
-static Cursor localCursor;
-const Cursor& WebCore::moveCursor() { return localCursor; }
-
 bool AXObjectCache::gAccessibilityEnabled = false;
 
 bool WebCore::historyContains(DeprecatedString const&) { return false; }
index c787ed42db2a6c5cbac11ee55151e0ea0dfdb6f2..868fd8f7f760317922c98cadccd9f2d23f617289 100644 (file)
@@ -89,7 +89,9 @@ namespace WebCore {
         }
         
         ~ResourceHandleInternal();
-        
+
+        ResourceHandleClient* client() const { return m_client; }
+       
         ResourceHandleClient* m_client;
         
         ResourceRequest m_request;
index 758c500dcc47e51aac1cedb8696f2c35017875c0..cbba9a0598a9c1242804e2a4d7303d095b124873 100644 (file)
@@ -63,7 +63,8 @@ static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* obj)
     ResourceHandle* job = static_cast<ResourceHandle*>(obj);
     ResourceHandleInternal* d = job->getInternal();
     int totalSize = size * nmemb;
-    d->m_client->didReceiveData(job, static_cast<char*>(ptr), totalSize);
+    if (d->client())
+        d->client()->didReceiveData(job, static_cast<char*>(ptr), totalSize);
     return totalSize;
 }
 
@@ -86,8 +87,10 @@ void ResourceHandleManager::downloadTimerCallback(Timer<ResourceHandleManager>*
             CURLcode res = curl_easy_perform(d->m_handle);
             if (res != CURLE_OK)
                 printf("Error WITH JOB %d\n", res);
-            d->m_client->receivedAllData(job, 0);
-            d->m_client->didFinishLoading(job);
+            if (d->client()) {
+                d->client()->receivedAllData(job, 0);
+                d->client()->didFinishLoading(job);
+            }
             curl_easy_cleanup(d->m_handle);
             d->m_handle = 0;
         }
@@ -169,8 +172,10 @@ void ResourceHandleManager::remove(ResourceHandle* job)
         jobs->remove(job);
     if (jobs->isEmpty())
         m_downloadTimer.stop();
-    d->m_client->receivedAllData(job, 0);
-    d->m_client->didFinishLoading(job);
+    if (d->client()) {
+        d->client()->receivedAllData(job, 0);
+        d->client()->didFinishLoading(job);
+    }
     if (d->m_handle) {
         curl_multi_remove_handle(curlMultiHandle, d->m_handle);
         curl_easy_cleanup(d->m_handle);