Commit 383c9530 authored by bdash's avatar bdash

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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@17681 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 45d9e2bd
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.
......@@ -28,13 +28,42 @@
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);
};
}
......
......@@ -30,8 +30,12 @@
#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);
......
......@@ -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"
......@@ -51,11 +52,11 @@
#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
{
......
......@@ -35,47 +35,5 @@
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());
}
}
/*
* 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
......@@ -25,56 +25,24 @@
* 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(); }
}
......@@ -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; }
......
......@@ -89,7 +89,9 @@ namespace WebCore {
}
~ResourceHandleInternal();
ResourceHandleClient* client() const { return m_client; }
ResourceHandleClient* m_client;
ResourceRequest m_request;
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment