Reviewed and worked over a lot by Darin.
- check in first set of GDK-specific sources
* platform/gdk/BrowserExtensionGdk.h: Added.
* platform/gdk/CookieJarGdk.cpp: Added.
* platform/gdk/CursorGdk.cpp: Added.
* platform/gdk/FontCacheGdk.cpp: Added.
* platform/gdk/FontDataGdk.cpp: Added.
* platform/gdk/FontGdk.cpp: Added.
* platform/gdk/FontPlatformData.h: Added.
* platform/gdk/FontPlatformDataGdk.cpp: Added.
* platform/gdk/FrameGdk.cpp: Added.
* platform/gdk/FrameGdk.h: Added.
* platform/gdk/GlyphMapGdk.cpp: Added.
* platform/gdk/KeyEventGdk.cpp: Added.
* platform/gdk/KeyboardCodes.h: Added.
* platform/gdk/MouseEventGdk.cpp: Added.
* platform/gdk/PageGdk.cpp: Added.
* platform/gdk/RenderThemeGdk.cpp: Added.
* platform/gdk/RenderThemeGdk.h: Added.
* platform/gdk/ScreenGdk.cpp: Added.
* platform/gdk/ScrollViewGdk.cpp: Added.
* platform/gdk/SharedTimerLinux.cpp: Added.
* platform/gdk/SystemTimeLinux.cpp: Added.
* platform/gdk/TemporaryLinkStubs.cpp: Added.
* platform/gdk/TransferJobCurl.cpp: Added.
* platform/gdk/TransferJobManager.cpp: Added.
* platform/gdk/TransferJobManager.h: Added.
* platform/gdk/WheelEventGdk.cpp: Added.
* platform/gdk/WidgetGdk.cpp: Added.
* platform/gdk/gdk-encodings.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@15124 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 04f8801..42d290d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,40 @@
2006-06-30 Mike Emmel <mike.emmel@gmail.com>
+ Reviewed and worked over a lot by Darin.
+
+ - check in first set of GDK-specific sources
+
+ * platform/gdk/BrowserExtensionGdk.h: Added.
+ * platform/gdk/CookieJarGdk.cpp: Added.
+ * platform/gdk/CursorGdk.cpp: Added.
+ * platform/gdk/FontCacheGdk.cpp: Added.
+ * platform/gdk/FontDataGdk.cpp: Added.
+ * platform/gdk/FontGdk.cpp: Added.
+ * platform/gdk/FontPlatformData.h: Added.
+ * platform/gdk/FontPlatformDataGdk.cpp: Added.
+ * platform/gdk/FrameGdk.cpp: Added.
+ * platform/gdk/FrameGdk.h: Added.
+ * platform/gdk/GlyphMapGdk.cpp: Added.
+ * platform/gdk/KeyEventGdk.cpp: Added.
+ * platform/gdk/KeyboardCodes.h: Added.
+ * platform/gdk/MouseEventGdk.cpp: Added.
+ * platform/gdk/PageGdk.cpp: Added.
+ * platform/gdk/RenderThemeGdk.cpp: Added.
+ * platform/gdk/RenderThemeGdk.h: Added.
+ * platform/gdk/ScreenGdk.cpp: Added.
+ * platform/gdk/ScrollViewGdk.cpp: Added.
+ * platform/gdk/SharedTimerLinux.cpp: Added.
+ * platform/gdk/SystemTimeLinux.cpp: Added.
+ * platform/gdk/TemporaryLinkStubs.cpp: Added.
+ * platform/gdk/TransferJobCurl.cpp: Added.
+ * platform/gdk/TransferJobManager.cpp: Added.
+ * platform/gdk/TransferJobManager.h: Added.
+ * platform/gdk/WheelEventGdk.cpp: Added.
+ * platform/gdk/WidgetGdk.cpp: Added.
+ * platform/gdk/gdk-encodings.txt: Added.
+
+2006-06-30 Mike Emmel <mike.emmel@gmail.com>
+
Reviewed by Darin.
* WebCoreSources.bkl: Updated for recent file changes.
diff --git a/WebCore/platform/gdk/BrowserExtensionGdk.h b/WebCore/platform/gdk/BrowserExtensionGdk.h
new file mode 100644
index 0000000..6fc58cc
--- /dev/null
+++ b/WebCore/platform/gdk/BrowserExtensionGdk.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 BrowserExtensionGdk_H_
+#define BrowserExtensionGdk_H_
+
+#include "BrowserExtension.h"
+
+namespace WebCore {
+
+class Frame;
+class FrameGdk;
+
+class BrowserExtensionGdk : public BrowserExtension {
+public:
+ BrowserExtensionGdk(Frame*);
+
+ virtual void createNewWindow(const ResourceRequest&);
+ virtual void createNewWindow(const ResourceRequest&, const WindowArgs&, Frame*&);
+
+ virtual void setIconURL(const KURL&);
+ virtual void setTypedIconURL(const KURL&, const String& type);
+
+ virtual int getHistoryLength();
+ virtual void goBackOrForward(int distance);
+ virtual KURL historyURL(int distance);
+
+ virtual bool canRunModal();
+ virtual bool canRunModalNow();
+ virtual void runModal();
+
+private:
+ FrameGdk* m_frame;
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/CookieJarGdk.cpp b/WebCore/platform/gdk/CookieJarGdk.cpp
new file mode 100644
index 0000000..6701507
--- /dev/null
+++ b/WebCore/platform/gdk/CookieJarGdk.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "CookieJar.h"
+
+#include "DeprecatedString.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include "StringHash.h"
+#include <wtf/HashMap.h>
+
+namespace WebCore {
+
+static HashMap<String, String> cookieJar;
+
+void setCookies(const KURL& url, const KURL& /*policyURL*/, const String& value)
+{
+ cookieJar.set(url.url(), value);
+}
+
+String cookies(const KURL& url)
+{
+ return cookieJar.get(url.url());
+}
+
+bool cookiesEnabled()
+{
+ return true;
+}
+
+}
diff --git a/WebCore/platform/gdk/CursorGdk.cpp b/WebCore/platform/gdk/CursorGdk.cpp
new file mode 100644
index 0000000..d463ab6
--- /dev/null
+++ b/WebCore/platform/gdk/CursorGdk.cpp
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "Cursor.h"
+
+#include "DeprecatedString.h"
+#include <gdk/gdk.h>
+#include <wtf/Assertions.h>
+
+namespace WebCore {
+
+Cursor::Cursor(const Cursor& other)
+ : m_impl(other.m_impl)
+{
+ if (m_impl)
+ gdk_cursor_ref(m_impl);
+}
+
+Cursor::~Cursor()
+{
+ if (m_impl)
+ gdk_cursor_unref(m_impl);
+}
+
+Cursor& Cursor::operator=(const Cursor& other)
+{
+ gdk_cursor_ref(other.m_impl);
+ gdk_cursor_unref(m_impl);
+ m_impl = other.m_impl;
+ return *this;
+}
+
+Cursor::Cursor(GdkCursor* c)
+ : m_impl(c)
+{
+ m_impl = c;
+ ASSERT(c);
+ gdk_cursor_ref(c);
+}
+
+const Cursor& crossCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_CROSS);
+ return c;
+}
+
+const Cursor& handCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_HAND2);
+ return c;
+}
+
+const Cursor& iBeamCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_XTERM);
+ return c;
+}
+
+const Cursor& waitCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_WATCH);
+ return c;
+}
+
+const Cursor& helpCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_QUESTION_ARROW);
+ return c;
+}
+
+const Cursor& eastResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_RIGHT_SIDE);
+ return c;
+}
+
+const Cursor& northResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_TOP_SIDE);
+ return c;
+}
+
+const Cursor& northEastResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_TOP_RIGHT_CORNER);
+ return c;
+}
+
+const Cursor& northWestResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_TOP_LEFT_CORNER);
+ return c;
+}
+
+const Cursor& southResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_BOTTOM_SIDE);
+ return c;
+}
+
+const Cursor& southEastResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_BOTTOM_RIGHT_CORNER);
+ return c;
+}
+
+const Cursor& southWestResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_BOTTOM_LEFT_CORNER);
+ return c;
+}
+
+const Cursor& westResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_LEFT_SIDE);
+ return c;
+}
+
+const Cursor& northSouthResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_TOP_TEE);
+ return c;
+}
+
+const Cursor& eastWestResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_LEFT_SIDE);
+ return c;
+}
+
+const Cursor& northEastSouthWestResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_SIZING);
+ return c;
+}
+
+const Cursor& northWestSouthEastResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_SIZING);
+ return c;
+}
+
+const Cursor& columnResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_DOUBLE_ARROW);
+ return c;
+}
+
+const Cursor& rowResizeCursor()
+{
+ static Cursor c = gdk_cursor_new(GDK_DOUBLE_ARROW);
+ return c;
+}
+
+}
diff --git a/WebCore/platform/gdk/FontCacheGdk.cpp b/WebCore/platform/gdk/FontCacheGdk.cpp
new file mode 100644
index 0000000..66a438b
--- /dev/null
+++ b/WebCore/platform/gdk/FontCacheGdk.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 Computer, 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 "FontCache.h"
+
+#include "Font.h"
+#include "FontPlatformData.h"
+
+namespace WebCore {
+
+void FontCache::platformInit()
+{
+ if (!FontPlatformData::init()) {
+ assert(0);
+ fprintf(stderr, "no fonts found exiting\n");
+ exit(-1);
+ }
+}
+
+const FontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+{
+
+ FontData* fontData = 0;
+ fontData = new FontData(FontPlatformData(font.fontDescription(), font.family().family()));
+ return fontData;
+}
+
+FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)
+{
+ return new FontPlatformData(font.fontDescription(), font.family().family());
+}
+
+FontPlatformData* FontCache::getLastResortFallbackFont(const Font& font)
+{
+ // FIXME: Would be even better to somehow get the user's default font here.
+ // For now we'll pick the default that the user would get without changing any prefs.
+ static AtomicString timesStr("Times New Roman");
+ return getCachedFontPlatformData(font.fontDescription(), timesStr);
+}
+
+FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)
+{
+ return new FontPlatformData(fontDescription, family);
+}
+
+}
diff --git a/WebCore/platform/gdk/FontDataGdk.cpp b/WebCore/platform/gdk/FontDataGdk.cpp
new file mode 100644
index 0000000..7881ab6
--- /dev/null
+++ b/WebCore/platform/gdk/FontDataGdk.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 Computer, 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 "FontData.h"
+
+#include "FloatRect.h"
+#include "Font.h"
+#include "FontCache.h"
+#include "FontDescription.h"
+#include "GlyphBuffer.h"
+#include <cairo.h>
+#include <unicode/uchar.h>
+#include <unicode/unorm.h>
+#include <wtf/MathExtras.h>
+
+namespace WebCore {
+
+void FontData::platformInit()
+{
+ cairo_font_extents_t font_extents;
+ cairo_text_extents_t text_extents;
+ cairo_scaled_font_extents(m_font.m_scaledFont, &font_extents);
+ m_ascent = static_cast<int>(font_extents.ascent);
+ m_descent = static_cast<int>(font_extents.descent);
+ m_lineSpacing = static_cast<int>(font_extents.height);
+ cairo_scaled_font_text_extents(m_font.m_scaledFont, "x", &text_extents);
+ m_xHeight = text_extents.height;
+ cairo_scaled_font_text_extents(m_font.m_scaledFont, " ", &text_extents);
+ m_spaceWidth = static_cast<int>(text_extents.x_advance);
+ assert(m_spaceWidth != 0);
+ m_lineGap = m_lineSpacing - m_ascent - m_descent;
+}
+
+void FontData::platformDestroy()
+{
+ delete m_smallCapsFontData;
+}
+
+FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) const
+{
+ if (!m_smallCapsFontData) {
+ FontDescription desc = FontDescription(fontDescription);
+ desc.setSpecifiedSize(0.70f*fontDescription.computedSize());
+ const FontPlatformData* pdata = new FontPlatformData(desc, desc.family().family());
+ m_smallCapsFontData = new FontData(*pdata);
+ }
+ return m_smallCapsFontData;
+}
+
+bool FontData::containsCharacters(const UChar* characters, int length) const
+{
+ for (unsigned i = 0; i < length; i++)
+ if (getGlyphIndex(characters[i]) == 0)
+ return false;
+ return true;
+}
+
+void FontData::determinePitch()
+{
+ m_treatAsFixedPitch = m_font.isFixedPitch();
+}
+
+float FontData::platformWidthForGlyph(Glyph glyph) const
+{
+ cairo_glyph_t cglyph;
+ cglyph.index = (int)glyph;
+ cairo_text_extents_t extents;
+ cairo_scaled_font_glyph_extents(m_font.m_scaledFont, &cglyph, 1, &extents);
+ float w = extents.x_advance;
+ if (w == 0)
+ w = m_spaceWidth;
+ return w;
+}
+
+void FontData::setFont(cairo_t* cr) const
+{
+ m_font.setFont(cr);
+}
+
+}
diff --git a/WebCore/platform/gdk/FontGdk.cpp b/WebCore/platform/gdk/FontGdk.cpp
new file mode 100644
index 0000000..4a60fe3
--- /dev/null
+++ b/WebCore/platform/gdk/FontGdk.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "Font.h"
+
+#include "FontData.h"
+#include "GraphicsContext.h"
+#include <cairo.h>
+
+namespace WebCore {
+
+void Font::drawGlyphs(GraphicsContext* graphicsContext, const FontData* font, const GlyphBuffer& glyphBuffer,
+ int from, int numGlyphs, const FloatPoint& point) const
+{
+ cairo_t* context = graphicsContext->platformContext();
+
+ // Set the text color to use for drawing.
+ float red, green, blue, alpha;
+ Color penColor = graphicsContext->pen().color();
+ penColor.getRGBA(red, green, blue, alpha);
+ cairo_set_source_rgba(context, red, green, blue, alpha);
+
+ // Select the scaled font.
+ font->setFont(context);
+
+ GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
+
+ float offset = point.x();
+
+ for (unsigned i = 0; i < numGlyphs; i++) {
+ glyphs[i].x = offset;
+ glyphs[i].y = point.y();
+ offset += glyphBuffer.advanceAt(from + i);
+ }
+ cairo_show_glyphs(context, glyphs, numGlyphs);
+}
+
+}
diff --git a/WebCore/platform/gdk/FontPlatformData.h b/WebCore/platform/gdk/FontPlatformData.h
new file mode 100644
index 0000000..6bd2062
--- /dev/null
+++ b/WebCore/platform/gdk/FontPlatformData.h
@@ -0,0 +1,74 @@
+/*
+ * This file is part of the internal font implementation. It should not be included by anyone other than
+ * FontMac.cpp, FontWin.cpp and Font.cpp.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef FontPlatformData_H
+#define FontPlatformData_H
+
+#include "GlyphBuffer.h"
+#include "FontDescription.h"
+#include <cairo.h>
+#include <cairo-ft.h>
+#include <fontconfig/fcfreetype.h>
+
+namespace WebCore {
+
+class FontPlatformData {
+public:
+ class Deleted {};
+ FontPlatformData(Deleted) : m_pattern((FcPattern*)-1) { }
+
+ FontPlatformData() : m_pattern(0) { }
+
+ FontPlatformData(const FontDescription&, const AtomicString& family);
+ ~FontPlatformData();
+
+ static bool init();
+
+ static cairo_font_face_t** list(FontDescription&, const AtomicString& familyName, int* length);
+ Glyph index(unsigned ucs4) const;
+
+ bool isFixedPitch();
+
+ void setFont(cairo_t*) const;
+
+ unsigned hash() const
+ {
+ return StringImpl::computeHash((UChar*)&m_fontDescription, sizeof(FontDescription) / sizeof(UChar));
+ }
+
+ bool operator==(const FontPlatformData&) const;
+
+ FcPattern* m_pattern;
+ FontDescription m_fontDescription;
+ cairo_matrix_t* m_fontMatrix;
+ cairo_font_face_t* m_fontFace;
+ cairo_font_options_t* m_options;
+ cairo_scaled_font_t* m_scaledFont;
+
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/FontPlatformDataGdk.cpp b/WebCore/platform/gdk/FontPlatformDataGdk.cpp
new file mode 100644
index 0000000..865775b
--- /dev/null
+++ b/WebCore/platform/gdk/FontPlatformDataGdk.cpp
@@ -0,0 +1,188 @@
+/*
+ * This file is part of the internal font implementation. It should not be included by anyone other than
+ * FontMac.cpp, FontWin.cpp and Font.cpp.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "FontPlatformData.h"
+
+#include "PlatformString.h"
+#include "DeprecatedString.h"
+#include "FontDescription.h"
+#include "cairo-ft.h"
+#include "cairo.h"
+#include <fontconfig/fcfreetype.h>
+#include <assert.h>
+
+namespace WebCore {
+
+FontPlatformData::FontPlatformData(const FontDescription& fontDescription, const AtomicString& familyName)
+ : m_fontDescription(fontDescription)
+{
+ init();
+
+ FcChar8* family = (FcChar8*)((const char*)(familyName.deprecatedString().utf8()));
+ int fcslant = FC_SLANT_ROMAN;
+ int fcweight = FC_WEIGHT_NORMAL;
+ int fcsize = (int)fontDescription.computedSize();
+ if (fontDescription.italic())
+ fcslant = FC_SLANT_ITALIC;
+ if (fontDescription.weight() == cBoldWeight)
+ fcweight = FC_WEIGHT_BOLD;
+
+ int type = fontDescription.genericFamily();
+ switch (type) {
+ case FontDescription::SerifFamily:
+ family = (FcChar8*)"sans-serif";
+ break;
+ case FontDescription::SansSerifFamily:
+ family = (FcChar8*)"sans-serif";
+ break;
+ case FontDescription::NoFamily:
+ case FontDescription::StandardFamily:
+ default:
+ family = (FcChar8*)"sans-serif";
+ }
+ FcPattern* pattern = FcPatternCreate();
+ assert(pattern != 0);
+ if (!FcPatternAddString(pattern, FC_FAMILY, family))
+ goto freePattern;
+ if (!FcPatternAddInteger(pattern, FC_SLANT, fcslant))
+ goto freePattern;
+ if (!FcPatternAddInteger(pattern, FC_WEIGHT, fcweight))
+ goto freePattern;
+ if (!FcPatternAddInteger(pattern, FC_PIXEL_SIZE, fcsize))
+ goto freePattern;
+
+
+ FcConfigSubstitute(NULL, pattern, FcMatchPattern);
+ FcDefaultSubstitute(pattern);
+
+ FcResult fcresult;
+ m_pattern = FcFontMatch(NULL, pattern, &fcresult);
+ if (!m_pattern)
+ goto freePattern;
+
+ m_fontFace = cairo_ft_font_face_create_for_pattern(m_pattern);
+ m_fontMatrix = (cairo_matrix_t*)malloc(sizeof(cairo_matrix_t));
+ cairo_matrix_t ctm;
+ cairo_font_extents_t font_extents;
+ cairo_text_extents_t text_extents;
+ cairo_matrix_init_scale(m_fontMatrix, m_fontDescription.computedPixelSize(), m_fontDescription.computedPixelSize());
+ cairo_matrix_init_identity(&ctm);
+ m_options = cairo_font_options_create();
+ m_scaledFont = cairo_scaled_font_create(m_fontFace, m_fontMatrix, &ctm, m_options);
+
+ assert(m_scaledFont != 0);
+
+freePattern:
+ FcPatternDestroy(pattern);
+}
+
+bool FontPlatformData::init()
+{
+ static FcBool FCInitialized;
+ if (FCInitialized)
+ return true;
+ FCInitialized = FcTrue;
+ if (!FcInit()) {
+ fprintf(stderr, "Can't init font config library\n");
+ return false;
+ }
+ return true;
+}
+
+FontPlatformData::~FontPlatformData()
+{
+ FcPatternDestroy(m_pattern);
+ cairo_font_face_destroy(m_fontFace);
+ cairo_scaled_font_destroy(m_scaledFont);
+ cairo_font_options_destroy(m_options);
+}
+
+bool FontPlatformData::isFixedPitch()
+{
+ int spacing;
+ if (FcPatternGetInteger(m_pattern, FC_SPACING, 0, &spacing) == FcResultMatch)
+ return spacing == FC_MONO;
+ return false;
+}
+
+// length is a out value giving the length of the list
+cairo_font_face_t** FontPlatformData::list(FontDescription& fontDescription, const AtomicString& familyName, int* length)
+{
+ init();
+
+ FcPattern* pattern = FcPatternCreate();
+ if (!pattern)
+ return NULL;
+
+ FcObjectSet* os = FcObjectSetCreate();
+ FcObjectSetAdd(os, FC_FAMILY);
+ FcObjectSetAdd(os, FC_STYLE);
+ FcFontSet* fs = FcFontList(0, pattern, os);
+ if (length)
+ *length = fs->nfont;
+ if (pattern)
+ FcPatternDestroy (pattern);
+ if (os)
+ FcObjectSetDestroy (os);
+ cairo_font_face_t** result = (cairo_font_face_t**)malloc((fs->nfont + 1) * sizeof(cairo_font_face_t*));
+ for (int i = 0; i < fs->nfont; i++) {
+ FcChar8* font = FcNameUnparse(fs->fonts[i]);
+ printf("%s\n", font);
+ result[i] = cairo_ft_font_face_create_for_pattern(fs->fonts[i]);
+ }
+ result[fs->nfont] = NULL;
+ return result;
+}
+
+Glyph FontPlatformData::index(unsigned ucs4) const
+{
+ ucs4 = (0xff & ucs4);
+ FT_Face face = cairo_ft_scaled_font_lock_face(m_scaledFont);
+ assert(face != 0);
+ int index = FcFreeTypeCharIndex(face, ucs4);
+ cairo_ft_scaled_font_unlock_face(m_scaledFont);
+ return index;
+}
+
+
+void FontPlatformData::setFont(cairo_t* cr) const
+{
+ cairo_set_font_face(cr, m_fontFace);
+ cairo_set_font_matrix(cr, m_fontMatrix);
+ cairo_set_font_options(cr, m_options);
+}
+
+bool FontPlatformData::operator==(const FontPlatformData& other) const
+{
+ if (m_pattern == other.m_pattern)
+ return true;
+ if (m_pattern == 0 || m_pattern == (FcPattern*)-1
+ || other.m_pattern == 0 || other.m_pattern == (FcPattern*)-1)
+ return false;
+ return FcPatternEqual(m_pattern, other.m_pattern);
+}
+
+}
diff --git a/WebCore/platform/gdk/FrameGdk.cpp b/WebCore/platform/gdk/FrameGdk.cpp
new file mode 100644
index 0000000..e24c1e1
--- /dev/null
+++ b/WebCore/platform/gdk/FrameGdk.cpp
@@ -0,0 +1,364 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "FrameGdk.h"
+#include "Element.h"
+#include "RenderObject.h"
+#include "RenderWidget.h"
+#include "RenderLayer.h"
+#include "Page.h"
+#include "Document.h"
+#include "DOMWindow.h"
+#include "DOMImplementation.h"
+#include "BrowserExtensionGdk.h"
+#include "Document.h"
+#include "KWQKHTMLSettings.h"
+#include "Plugin.h"
+#include "FramePrivate.h"
+#include "GraphicsContext.h"
+#include "HTMLDocument.h"
+#include "TransferJob.h"
+#include "PlatformMouseEvent.h"
+#include "PlatformKeyboardEvent.h"
+#include "PlatformWheelEvent.h"
+#include "MouseEventWithHitTestResults.h"
+#include "SelectionController.h"
+#include "TypingCommand.h"
+#include "KWQKSSLKeyGen.h"
+#include "KeyboardCodes.h"
+#include <gdk/gdk.h>
+
+DeprecatedStringList KSSLKeyGen::supportedKeySizes(){return DeprecatedStringList();};
+DeprecatedString KSSLKeyGen::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const DeprecatedString &challengeString, const KURL &url){return DeprecatedString();};
+
+// This function loads resources from WebKit
+// This does not belong here and I'm not sure where
+// it should go
+// I don't know what the plans or design is
+// for none code resources
+Vector<char> loadResourceIntoArray(const char* resourceName)
+{
+ Vector<char> resource;
+ //if (strcmp(resourceName,"missingImage") == 0) {
+ //}
+ return resource;
+}
+
+namespace WebCore {
+
+
+static void doScroll(const RenderObject* r, bool isHorizontal, int multiplier)
+{
+ // FIXME: The scrolling done here should be done in the default handlers
+ // of the elements rather than here in the part.
+ if (!r)
+ return;
+
+ //broken since it calls scroll on scrollbars
+ //and we have none now
+ //r->scroll(direction, KWQScrollWheel, multiplier);
+ if (!r->layer())
+ return;
+ int x = r->layer()->scrollXOffset();
+ int y = r->layer()->scrollYOffset();
+ if (isHorizontal)
+ x += multiplier;
+ else
+ y += multiplier;
+ r->layer()->scrollToOffset(x, y, true, true);
+}
+
+bool FrameView::isFrameView() const
+{
+ return true;
+}
+
+FrameGdk::FrameGdk(GdkDrawable* gdkdrawable)
+ : Frame(new Page, 0), m_drawable(gdkdrawable)
+{
+ d->m_extension = new BrowserExtensionGdk(this);
+ KHTMLSettings* settings = new KHTMLSettings;
+ settings->setAutoLoadImages(true);
+ settings->setMinFontSize(5);
+ settings->setMinLogicalFontSize(5);
+ settings->setShouldPrintBackgrounds(true);
+
+ settings->setMediumFixedFontSize(14);
+ settings->setMediumFontSize(14);
+ settings->setSerifFontName("Times New Roman");
+ settings->setSansSerifFontName("Arial");
+ settings->setFixedFontName("Courier");
+ settings->setStdFontName("Arial");
+ setSettings(settings);
+ page()->setMainFrame(this);
+ FrameView* view = new FrameView(this);
+ setView(view);
+ IntRect geom = frameGeometry();
+ view->resize(geom.width(), geom.height());
+ view->ScrollView::setDrawable(gdkdrawable);
+}
+
+FrameGdk::FrameGdk(Page* page, RenderPart* renderPart, FrameGdkClient* client)
+ : Frame(page, renderPart)
+{
+ d->m_extension = new BrowserExtensionGdk(this);
+ KHTMLSettings* settings = new KHTMLSettings;
+ settings->setAutoLoadImages(true);
+ setSettings(settings);
+}
+
+FrameGdk::~FrameGdk()
+{
+}
+
+bool FrameGdk::openURL(const KURL& url)
+{
+ didOpenURL(url);
+ begin(url);
+ TransferJob* job = new TransferJob(this, "GET", url);
+ job->start(document()->docLoader());
+ return true;
+}
+
+void FrameGdk::submitForm(const ResourceRequest&)
+{
+}
+
+void FrameGdk::urlSelected(const ResourceRequest& request)
+{
+ //need to potentially updateLocationBar(str.ascii()); or notify sys of new url mybe event or callback
+ const KURL url = request.url();
+ printf("------------------> LOADING NEW URL %s \n", url.url().ascii());
+ didOpenURL(url);
+ begin(url);
+ TransferJob* job = new TransferJob(this, "GET", url);
+ job->start(document()->docLoader());
+}
+
+String FrameGdk::userAgent() const
+{
+ return "Mozilla/5.0 (PC; U; Intel; Linux; en) AppleWebKit/420+ (KHTML, like Gecko)";
+}
+
+void FrameGdk::runJavaScriptAlert(String const& message)
+{
+}
+
+bool FrameGdk::runJavaScriptConfirm(String const& message)
+{
+ return true;
+}
+
+void FrameGdk::setTitle(const String &title)
+{
+}
+
+void FrameGdk::handleGdkEvent(GdkEvent* event)
+{
+ switch (event->type) {
+ case GDK_EXPOSE: {
+ GdkRectangle clip;
+ gdk_region_get_clipbox(event->expose.region, &clip);
+ gdk_window_begin_paint_region (event->any.window, event->expose.region);
+ cairo_t* cr = gdk_cairo_create (event->any.window);
+ GraphicsContext* ctx = new GraphicsContext(cr);
+ paint(ctx, IntRect(clip.x, clip.y, clip.width, clip.height));
+ delete ctx;
+ gdk_window_end_paint (event->any.window);
+ break;
+ }
+ case GDK_SCROLL: {
+ PlatformWheelEvent wheelEvent(event);
+ view()->handleWheelEvent(wheelEvent);
+ if (wheelEvent.isAccepted()) {
+ return;
+ }
+ RenderObject::NodeInfo nodeInfo(true, true);
+ renderer()->layer()->hitTest(nodeInfo, wheelEvent.pos());
+ Node* node = nodeInfo.innerNode();
+ if (!node)
+ return;
+ //Default to scrolling the page
+ //not sure why its null
+ //broke anyway when its not null
+ doScroll(renderer(), wheelEvent.isHorizontal(), wheelEvent.delta());
+ break;
+ }
+ case GDK_DRAG_ENTER:
+ case GDK_DRAG_LEAVE:
+ case GDK_DRAG_MOTION:
+ case GDK_DRAG_STATUS:
+ case GDK_DROP_START:
+ case GDK_DROP_FINISHED: {
+ //bool updateDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+ //void cancelDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+ //bool performDragAndDrop(const PlatformMouseEvent&, Clipboard*);
+ break;
+ }
+ case GDK_MOTION_NOTIFY:
+ view()->handleMouseMoveEvent(event);
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ view()->handleMousePressEvent(event);
+ break;
+ case GDK_BUTTON_RELEASE:
+ view()->handleMouseReleaseEvent(event);
+ break;
+ case GDK_KEY_PRESS:
+ case GDK_KEY_RELEASE: {
+ PlatformKeyboardEvent kevent(event);
+ bool handled = false;
+ if (!kevent.isKeyUp()) {
+ Node* start = selection().start().node();
+ if (start && start->isContentEditable()) {
+ switch(kevent.WindowsKeyCode()) {
+ case VK_BACK:
+ TypingCommand::deleteKeyPressed(document());
+ break;
+ case VK_DELETE:
+ TypingCommand::forwardDeleteKeyPressed(document());
+ break;
+ case VK_LEFT:
+ selection().modify(SelectionController::MOVE, SelectionController::LEFT, CharacterGranularity);
+ break;
+ case VK_RIGHT:
+ selection().modify(SelectionController::MOVE, SelectionController::RIGHT, CharacterGranularity);
+ break;
+ case VK_UP:
+ selection().modify(SelectionController::MOVE, SelectionController::BACKWARD, ParagraphGranularity);
+ break;
+ case VK_DOWN:
+ selection().modify(SelectionController::MOVE, SelectionController::FORWARD, ParagraphGranularity);
+ break;
+ default:
+ TypingCommand::insertText(document(), kevent.text(), false);
+
+ }
+ handled = true;
+ }
+ if (!handled) {
+ switch (kevent.WindowsKeyCode()) {
+ case VK_LEFT:
+ doScroll(renderer(), true, -120);
+ break;
+ case VK_RIGHT:
+ doScroll(renderer(), true, 120);
+ break;
+ case VK_UP:
+ doScroll(renderer(), false, -120);
+ break;
+ case VK_PRIOR:
+ //return SB_PAGEUP;
+ break;
+ case VK_NEXT:
+ //return SB_PAGEDOWN;
+ break;
+ case VK_DOWN:
+ doScroll(renderer(), false, 120);
+ break;
+ case VK_HOME:
+ renderer()->layer()->scrollToOffset(0, 0, true, true);
+ doScroll(renderer(), false, 120);
+ break;
+ case VK_END:
+ renderer()->layer()->scrollToOffset(0,
+ renderer()->height(), true, true);
+ break;
+ case VK_SPACE:
+ if (kevent.shiftKey())
+ doScroll(renderer(), false, -120);
+ else
+ doScroll(renderer(), false, 120);
+ break;
+ }
+
+ }
+ }
+ }
+ default:
+ break;
+ }
+}
+
+void FrameGdk::receivedData(TransferJob* job, const char* data, int length)
+{
+ write(data, length);
+}
+
+void FrameGdk::receivedAllData(TransferJob* job, PlatformData data)
+{
+ end();
+}
+
+void FrameGdk::setFrameGeometry(const IntRect &r)
+{
+ if (!m_drawable || !GDK_IS_WINDOW(m_drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(m_drawable);
+ gdk_window_move_resize(window, r.x(), r.y(), r.width(), r.height());
+}
+
+IntRect FrameGdk::frameGeometry() const
+{
+ gint x, y, width, height, depth;
+ if (!m_drawable)
+ return IntRect();
+
+ if (!GDK_IS_WINDOW(m_drawable)) {
+ gdk_drawable_get_size(m_drawable, &width, &height);
+ return IntRect(0, 0, width, height);
+ }
+
+ GdkWindow* window = GDK_WINDOW(m_drawable);
+ gdk_window_get_geometry(window, &x, &y, &width, &height, &depth);
+ return IntRect(x, y, width, height);
+}
+
+bool FrameGdk::passWheelEventToChildWidget(Node* node)
+{
+ if (!node)
+ return false;
+ RenderObject* renderer = node->renderer();
+ if (!renderer || !renderer->isWidget())
+ return false;
+ Widget* widget = static_cast<RenderWidget*>(renderer)->widget();
+ if (!widget)
+ return false;
+ return true;
+}
+
+bool FrameGdk::passSubframeEventToSubframe(MouseEventWithHitTestResults& mev, Frame*)
+{
+ if (mev.targetNode() == 0)
+ return true;
+ return false;
+}
+
+}
diff --git a/WebCore/platform/gdk/FrameGdk.h b/WebCore/platform/gdk/FrameGdk.h
new file mode 100644
index 0000000..4f14dbb
--- /dev/null
+++ b/WebCore/platform/gdk/FrameGdk.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 FrameGdk_H_
+#define FrameGdk_H_
+
+#include "Frame.h"
+#include "TransferJobClient.h"
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+class FrameGdkClient {
+public:
+ virtual void openURL(const DeprecatedString&) = 0;
+};
+
+class FrameGdk : public Frame, TransferJobClient {
+public:
+ FrameGdk(Page*, RenderPart*, FrameGdkClient*);
+ FrameGdk(GdkDrawable*);
+ ~FrameGdk();
+
+ void handleGdkEvent(GdkEvent*);
+ virtual bool openURL(const KURL&);
+ virtual void openURLRequest(const ResourceRequest&);
+ virtual void submitForm(const ResourceRequest&);
+ virtual void urlSelected(const ResourceRequest&);
+
+ virtual void setTitle(const String&);
+
+ virtual ObjectContentType objectContentType(const KURL&, const String& mimeType);
+ virtual Plugin* createPlugin(Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&);
+ virtual Frame* createFrame(const KURL&, const String& name, RenderPart*, const String& referrer);
+
+ virtual void scheduleClose();
+
+ virtual void unfocusWindow();
+
+ virtual void focusWindow();
+
+ virtual void saveDocumentState();
+ virtual void restoreDocumentState();
+
+ virtual void addMessageToConsole(const String& message, unsigned lineNumber, const String& sourceID);
+
+ virtual void runJavaScriptAlert(const String& message);
+ virtual bool runJavaScriptConfirm(const String& message);
+ virtual bool runJavaScriptPrompt(const String& message, const String& defaultValue, String& result);
+ virtual bool locationbarVisible();
+ virtual bool menubarVisible();
+ virtual bool personalbarVisible();
+ virtual bool statusbarVisible();
+ virtual bool toolbarVisible();
+
+ virtual void createEmptyDocument();
+ virtual Range* markedTextRange() const;
+
+ virtual String incomingReferrer() const;
+ virtual String userAgent() const;
+
+ virtual String mimeTypeForFileName(const String&) const;
+
+ virtual void markMisspellingsInAdjacentWords(const VisiblePosition&);
+ virtual void markMisspellings(const SelectionController&);
+
+ virtual bool lastEventIsMouseUp() const;
+
+ virtual bool passSubframeEventToSubframe(MouseEventWithHitTestResults &, Frame* subframe = 0);
+ virtual bool passWheelEventToChildWidget(Node*);
+
+ virtual String overrideMediaType() const;
+
+ virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*);
+ virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
+ virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
+
+ virtual void registerCommandForUndo(const EditCommandPtr&);
+ virtual void registerCommandForRedo(const EditCommandPtr&);
+ virtual void clearUndoRedoOperations();
+ virtual void issueUndoCommand();
+ virtual void issueRedoCommand();
+ virtual void issueCutCommand();
+ virtual void issueCopyCommand();
+ virtual void issuePasteCommand();
+ virtual void issuePasteAndMatchStyleCommand();
+ virtual void issueTransposeCommand();
+ virtual void respondToChangedSelection(const SelectionController& oldSelection, bool closeTyping);
+ virtual void respondToChangedContents();
+ virtual bool shouldChangeSelection(const SelectionController& oldSelection, const SelectionController& newSelection, EAffinity affinity, bool stillSelecting) const;
+ virtual void partClearedInBegin();
+
+ virtual bool canGoBackOrForward(int distance) const;
+ virtual void handledOnloadEvents();
+
+ virtual bool canPaste() const;
+ virtual bool canRedo() const;
+ virtual bool canUndo() const;
+ virtual void print();
+ virtual bool shouldInterruptJavaScript();
+
+ bool keyPress(const PlatformKeyboardEvent&);
+
+ virtual void receivedData(TransferJob*, const char*, int);
+ virtual void receivedAllData(TransferJob*,PlatformData);
+
+ IntRect frameGeometry() const;
+ void setFrameGeometry(const IntRect&);
+
+private:
+ virtual bool passMouseDownEventToWidget(Widget*);
+ FrameGdkClient* m_client;
+ GdkDrawable* m_drawable;
+};
+
+inline FrameGdk* Win(Frame* frame) { return static_cast<FrameGdk*>(frame); }
+inline const FrameGdk* Win(const Frame* frame) { return static_cast<const FrameGdk*>(frame); }
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/GlyphMapGdk.cpp b/WebCore/platform/gdk/GlyphMapGdk.cpp
new file mode 100644
index 0000000..c77d64b
--- /dev/null
+++ b/WebCore/platform/gdk/GlyphMapGdk.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 Computer, 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 "GlyphMap.h"
+
+#include "FontData.h"
+
+namespace WebCore {
+
+bool GlyphMap::fillPage(GlyphPage* page, UChar* buffer, unsigned bufferLength, const FontData* fontData)
+{
+ for (unsigned i = 0; i < bufferLength; i++)
+ page->setGlyphDataForIndex(i, fontData->getGlyphIndex(buffer[i]), fontData);
+ return true;
+}
+
+}
diff --git a/WebCore/platform/gdk/KeyEventGdk.cpp b/WebCore/platform/gdk/KeyEventGdk.cpp
new file mode 100644
index 0000000..e7cdd06
--- /dev/null
+++ b/WebCore/platform/gdk/KeyEventGdk.cpp
@@ -0,0 +1,479 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "PlatformKeyboardEvent.h"
+
+#include "DeprecatedString.h"
+#include "KeyboardCodes.h"
+#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
+
+namespace WebCore {
+
+// FIXME: This is incomplete. We should change this to mirror
+// more like what Firefox does, and generate these switch statements
+// at build time.
+static String keyIdentifierForGdkKeyCode(guint keyCode)
+{
+ switch (keyCode) {
+ case GDK_Menu:
+ case GDK_Alt_L:
+ case GDK_Alt_R:
+ return "Alt";
+ case GDK_Clear:
+ return "Clear";
+ case GDK_Down:
+ return "Down";
+ // "End"
+ case GDK_End:
+ return "End";
+ // "Enter"
+ case GDK_ISO_Enter:
+ case GDK_KP_Enter:
+ return "Enter";
+ case GDK_Execute:
+ return "Execute";
+ case GDK_F1:
+ return "F1";
+ case GDK_F2:
+ return "F2";
+ case GDK_F3:
+ return "F3";
+ case GDK_F4:
+ return "F4";
+ case GDK_F5:
+ return "F5";
+ case GDK_F6:
+ return "F6";
+ case GDK_F7:
+ return "F7";
+ case GDK_F8:
+ return "F8";
+ case GDK_F9:
+ return "F9";
+ case GDK_F10:
+ return "F10";
+ case GDK_F11:
+ return "F11";
+ case GDK_F12:
+ return "F12";
+ case GDK_F13:
+ return "F13";
+ case GDK_F14:
+ return "F14";
+ case GDK_F15:
+ return "F15";
+ case GDK_F16:
+ return "F16";
+ case GDK_F17:
+ return "F17";
+ case GDK_F18:
+ return "F18";
+ case GDK_F19:
+ return "F19";
+ case GDK_F20:
+ return "F20";
+ case GDK_F21:
+ return "F21";
+ case GDK_F22:
+ return "F22";
+ case GDK_F23:
+ return "F23";
+ case GDK_F24:
+ return "F24";
+ case GDK_Help:
+ return "Help";
+ case GDK_Home:
+ return "Home";
+ case GDK_Insert:
+ return "Insert";
+ case GDK_Left:
+ return "Left";
+ case GDK_Page_Down:
+ return "PageDown";
+ case GDK_Page_Up:
+ return "PageUp";
+ case GDK_Pause:
+ return "Pause";
+ case GDK_3270_PrintScreen:
+ return "PrintScreen";
+ case GDK_Right:
+ return "Right";
+ case GDK_Select:
+ return "Select";
+ case GDK_Up:
+ return "Up";
+ // Standard says that DEL becomes U+00007F.
+ case GDK_Delete:
+ return "U+00007F";
+ default:
+ return String::sprintf("U+%06X", toupper(keyCode));
+ }
+}
+
+static int windowsKeyCodeForKeyEvent(unsigned int keycode)
+{
+ switch (keycode) {
+ case GDK_KP_0:
+ return VK_NUMPAD0;// (60) Numeric keypad 0 key
+ case GDK_KP_1:
+ return VK_NUMPAD1;// (61) Numeric keypad 1 key
+ case GDK_KP_2:
+ return VK_NUMPAD2; // (62) Numeric keypad 2 key
+ case GDK_KP_3:
+ return VK_NUMPAD3; // (63) Numeric keypad 3 key
+ case GDK_KP_4:
+ return VK_NUMPAD4; // (64) Numeric keypad 4 key
+ case GDK_KP_5:
+ return VK_NUMPAD5; //(65) Numeric keypad 5 key
+ case GDK_KP_6:
+ return VK_NUMPAD6; // (66) Numeric keypad 6 key
+ case GDK_KP_7:
+ return VK_NUMPAD7; // (67) Numeric keypad 7 key
+ case GDK_KP_8:
+ return VK_NUMPAD8; // (68) Numeric keypad 8 key
+ case GDK_KP_9:
+ return VK_NUMPAD9; // (69) Numeric keypad 9 key
+ case GDK_KP_Multiply:
+ return VK_MULTIPLY; // (6A) Multiply key
+ case GDK_KP_Add:
+ return VK_ADD; // (6B) Add key
+ case GDK_KP_Subtract:
+ return VK_SUBTRACT; // (6D) Subtract key
+ case GDK_KP_Decimal:
+ return VK_DECIMAL; // (6E) Decimal key
+ case GDK_KP_Divide:
+ return VK_DIVIDE; // (6F) Divide key
+
+ case GDK_BackSpace:
+ return VK_BACK; // (08) BACKSPACE key
+ case GDK_Tab:
+ return VK_TAB; // (09) TAB key
+ case GDK_Clear:
+ return VK_CLEAR; // (0C) CLEAR key
+ case GDK_Return:
+ return VK_RETURN; //(0D) Return key
+ case GDK_Shift_L:
+ case GDK_Shift_R:
+ return VK_SHIFT; // (10) SHIFT key
+ case GDK_Control_L:
+ case GDK_Control_R:
+ return VK_CONTROL; // (11) CTRL key
+ case GDK_Menu:
+ case GDK_Alt_L:
+ case GDK_Alt_R:
+ return VK_MENU; // (12) ALT key
+
+ case GDK_Pause:
+ return VK_PAUSE; // (13) PAUSE key
+ case GDK_Caps_Lock:
+ return VK_CAPITAL; // (14) CAPS LOCK key
+ case GDK_Kana_Lock:
+ case GDK_Kana_Shift:
+ return VK_KANA; // (15) Input Method Editor (IME) Kana mode
+ case GDK_Hangul:
+ return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode
+ // VK_JUNJA (17) IME Junja mode
+ // VK_FINAL (18) IME final mode
+ case GDK_Hangul_Hanja:
+ return VK_HANJA; // (19) IME Hanja mode
+ case GDK_Kanji:
+ return VK_KANJI; // (19) IME Kanji mode
+ case GDK_Escape:
+ return VK_ESCAPE; // (1B) ESC key
+ // VK_CONVERT (1C) IME convert
+ // VK_NONCONVERT (1D) IME nonconvert
+ // VK_ACCEPT (1E) IME accept
+ // VK_MODECHANGE (1F) IME mode change request
+ case GDK_space:
+ return VK_SPACE; // (20) SPACEBAR
+ case GDK_Page_Up:
+ return VK_PRIOR; // (21) PAGE UP key
+ case GDK_Page_Down:
+ return VK_NEXT; // (22) PAGE DOWN key
+ case GDK_End:
+ return VK_END; // (23) END key
+ case GDK_Home:
+ return VK_HOME; // (24) HOME key
+ case GDK_Left:
+ return VK_LEFT; // (25) LEFT ARROW key
+ case GDK_Up:
+ return VK_UP; // (26) UP ARROW key
+ case GDK_Right:
+ return VK_RIGHT; // (27) RIGHT ARROW key
+ case GDK_Down:
+ return VK_DOWN; // (28) DOWN ARROW key
+ case GDK_Select:
+ return VK_SELECT; // (29) SELECT key
+ case GDK_Print:
+ return VK_PRINT; // (2A) PRINT key
+ case GDK_Execute:
+ return VK_EXECUTE;// (2B) EXECUTE key
+ //dunno on this
+ //case GDK_PrintScreen:
+ // return VK_SNAPSHOT; // (2C) PRINT SCREEN key
+ case GDK_Insert:
+ return VK_INSERT; // (2D) INS key
+ case GDK_Delete:
+ return VK_DELETE; // (2E) DEL key
+ case GDK_Help:
+ return VK_HELP; // (2F) HELP key
+ case GDK_0:
+ case GDK_parenleft:
+ return VK_0; // (30) 0) key
+ case GDK_1:
+ return VK_1; // (31) 1 ! key
+ case GDK_2:
+ case GDK_at:
+ return VK_2; // (32) 2 & key
+ case GDK_3:
+ case GDK_numbersign:
+ return VK_3; //case '3': case '#';
+ case GDK_4:
+ case GDK_dollar: // (34) 4 key '$';
+ return VK_4;
+ case GDK_5:
+ case GDK_percent:
+ return VK_5; // (35) 5 key '%'
+ case GDK_6:
+ case GDK_asciicircum:
+ return VK_6; // (36) 6 key '^'
+ case GDK_7:
+ case GDK_ampersand:
+ return VK_7; // (37) 7 key case '&'
+ case GDK_8:
+ case GDK_asterisk:
+ return VK_8; // (38) 8 key '*'
+ case GDK_9:
+ case GDK_parenright:
+ return VK_9; // (39) 9 key '('
+ case GDK_a:
+ case GDK_A:
+ return VK_A; // (41) A key case 'a': case 'A': return 0x41;
+ case GDK_b:
+ case GDK_B:
+ return VK_B; // (42) B key case 'b': case 'B': return 0x42;
+ case GDK_c:
+ case GDK_C:
+ return VK_C; // (43) C key case 'c': case 'C': return 0x43;
+ case GDK_d:
+ case GDK_D:
+ return VK_D; // (44) D key case 'd': case 'D': return 0x44;
+ case GDK_e:
+ case GDK_E:
+ return VK_E; // (45) E key case 'e': case 'E': return 0x45;
+ case GDK_f:
+ case GDK_F:
+ return VK_F; // (46) F key case 'f': case 'F': return 0x46;
+ case GDK_g:
+ case GDK_G:
+ return VK_G; // (47) G key case 'g': case 'G': return 0x47;
+ case GDK_h:
+ case GDK_H:
+ return VK_H; // (48) H key case 'h': case 'H': return 0x48;
+ case GDK_i:
+ case GDK_I:
+ return VK_I; // (49) I key case 'i': case 'I': return 0x49;
+ case GDK_j:
+ case GDK_J:
+ return VK_J; // (4A) J key case 'j': case 'J': return 0x4A;
+ case GDK_k:
+ case GDK_K:
+ return VK_K; // (4B) K key case 'k': case 'K': return 0x4B;
+ case GDK_l:
+ case GDK_L:
+ return VK_L; // (4C) L key case 'l': case 'L': return 0x4C;
+ case GDK_m:
+ case GDK_M:
+ return VK_M; // (4D) M key case 'm': case 'M': return 0x4D;
+ case GDK_n:
+ case GDK_N:
+ return VK_N; // (4E) N key case 'n': case 'N': return 0x4E;
+ case GDK_o:
+ case GDK_O:
+ return VK_O; // (4F) O key case 'o': case 'O': return 0x4F;
+ case GDK_p:
+ case GDK_P:
+ return VK_P; // (50) P key case 'p': case 'P': return 0x50;
+ case GDK_q:
+ case GDK_Q:
+ return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51;
+ case GDK_r:
+ case GDK_R:
+ return VK_R; // (52) R key case 'r': case 'R': return 0x52;
+ case GDK_s:
+ case GDK_S:
+ return VK_S; // (53) S key case 's': case 'S': return 0x53;
+ case GDK_t:
+ case GDK_T:
+ return VK_T; // (54) T key case 't': case 'T': return 0x54;
+ case GDK_u:
+ case GDK_U:
+ return VK_U; // (55) U key case 'u': case 'U': return 0x55;
+ case GDK_v:
+ case GDK_V:
+ return VK_V; // (56) V key case 'v': case 'V': return 0x56;
+ case GDK_w:
+ case GDK_W:
+ return VK_W; // (57) W key case 'w': case 'W': return 0x57;
+ case GDK_x:
+ case GDK_X:
+ return VK_X; // (58) X key case 'x': case 'X': return 0x58;
+ case GDK_y:
+ case GDK_Y:
+ return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59;
+ case GDK_z:
+ case GDK_Z:
+ return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
+ case GDK_Meta_L:
+ return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
+ case GDK_Meta_R:
+ return VK_RWIN; // (5C) Right Windows key (Natural keyboard)
+ // VK_APPS (5D) Applications key (Natural keyboard)
+ // VK_SLEEP (5F) Computer Sleep key
+ // VK_SEPARATOR (6C) Separator key
+ // VK_SUBTRACT (6D) Subtract key
+ // VK_DECIMAL (6E) Decimal key
+ // VK_DIVIDE (6F) Divide key
+ // handled by key code above
+
+ case GDK_Num_Lock:
+ return VK_NUMLOCK; // (90) NUM LOCK key
+
+ case GDK_Scroll_Lock:
+ return VK_SCROLL; // (91) SCROLL LOCK key
+
+ // VK_LSHIFT (A0) Left SHIFT key
+ // VK_RSHIFT (A1) Right SHIFT key
+ // VK_LCONTROL (A2) Left CONTROL key
+ // VK_RCONTROL (A3) Right CONTROL key
+ // VK_LMENU (A4) Left MENU key
+ // VK_RMENU (A5) Right MENU key
+ // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
+ // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
+ // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
+ // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
+ // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
+ // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
+ // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
+ // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
+ // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
+ // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
+ // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
+ // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
+ // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
+ // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
+ // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
+ // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
+ // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
+ // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
+
+ // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
+ case GDK_semicolon:
+ case GDK_colon:
+ return VK_OEM_1; //case ';': case ':': return 0xBA;
+ // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
+ case GDK_plus:
+ case GDK_equal:
+ return VK_OEM_PLUS; //case '=': case '+': return 0xBB;
+ // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
+ case GDK_comma:
+ case GDK_less:
+ return VK_OEM_COMMA; //case ',': case '<': return 0xBC;
+ // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
+ case GDK_minus:
+ case GDK_underscore:
+ return VK_OEM_MINUS; //case '-': case '_': return 0xBD;
+ // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
+ case GDK_period:
+ case GDK_greater:
+ return VK_OEM_PERIOD; //case '.': case '>': return 0xBE;
+ // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
+ case GDK_slash:
+ case GDK_question:
+ return VK_OEM_2; //case '/': case '?': return 0xBF;
+ // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
+ case GDK_asciitilde:
+ case GDK_quoteleft:
+ return VK_OEM_3; //case '`': case '~': return 0xC0;
+ // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
+ case GDK_bracketleft:
+ case GDK_braceleft:
+ return VK_OEM_4; //case '[': case '{': return 0xDB;
+ // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
+ case GDK_backslash:
+ case GDK_bar:
+ return VK_OEM_5; //case '\\': case '|': return 0xDC;
+ // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
+ case GDK_bracketright:
+ case GDK_braceright:
+ return VK_OEM_6; // case ']': case '}': return 0xDD;
+ // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
+ case GDK_quoteright:
+ case GDK_quotedbl:
+ return VK_OEM_7; // case '\'': case '"': return 0xDE;
+ // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
+ // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
+ // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
+ // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
+ // VK_ATTN (F6) Attn key
+ // VK_CRSEL (F7) CrSel key
+ // VK_EXSEL (F8) ExSel key
+ // VK_EREOF (F9) Erase EOF key
+ // VK_PLAY (FA) Play key
+ // VK_ZOOM (FB) Zoom key
+ // VK_NONAME (FC) Reserved for future use
+ // VK_PA1 (FD) PA1 key
+ // VK_OEM_CLEAR (FE) Clear key
+ default:
+ return 0;
+ }
+
+}
+
+PlatformKeyboardEvent::PlatformKeyboardEvent(GdkEvent* event)
+{
+ m_isKeyUp = event->type == GDK_KEY_RELEASE;
+ m_shiftKey = event->key.state & GDK_SHIFT_MASK != 0;
+ m_ctrlKey = event->key.state & GDK_CONTROL_MASK != 0;
+ m_altKey = event->key.state & GDK_MOD1_MASK != 0;
+ m_metaKey = event->key.state & GDK_MOD2_MASK != 0;
+ m_text = event->key.string;
+ m_unmodifiedText = event->key.string;
+ m_keyIdentifier = keyIdentifierForGdkKeyCode(event->key.keyval);
+ m_WindowsKeyCode = windowsKeyCodeForKeyEvent(event->key.keyval);
+ m_autoRepeat = false;
+ m_isKeypad = false;
+
+ if (!m_shiftKey) {
+ UChar character = tolower(m_text[0]);
+ m_text = String(&character, 1);
+ }
+}
+
+}
diff --git a/WebCore/platform/gdk/KeyboardCodes.h b/WebCore/platform/gdk/KeyboardCodes.h
new file mode 100644
index 0000000..60c589d
--- /dev/null
+++ b/WebCore/platform/gdk/KeyboardCodes.h
@@ -0,0 +1,543 @@
+/*
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 KeyboardCodes_H
+#define KeyboardCodes_H
+
+namespace WebCore {
+
+// VK_LBUTTON (01) Left mouse button
+// VK_RBUTTON (02) Right mouse button
+// VK_CANCEL (03) Control-break processing
+// VK_MBUTTON (04) Middle mouse button (three-button mouse)
+// VK_XBUTTON1 (05)
+// VK_XBUTTON2 (06)
+
+// VK_BACK (08) BACKSPACE key
+const int VK_BACK = 0x08;
+
+// VK_TAB (09) TAB key
+const int VK_TAB = 0x09;
+
+// VK_CLEAR (0C) CLEAR key
+const int VK_CLEAR = 0x0C;
+
+// VK_RETURN (0D)
+const int VK_RETURN = 0x0D;
+
+// VK_SHIFT (10) SHIFT key
+const int VK_SHIFT = 0x10;
+
+// VK_CONTROL (11) CTRL key
+const int VK_CONTROL = 0x11;
+
+// VK_MENU (12) ALT key
+const int VK_MENU = 0x12;
+
+// VK_PAUSE (13) PAUSE key
+const int VK_PAUSE = 0x13;
+
+// VK_CAPITAL (14) CAPS LOCK key
+const int VK_CAPITAL = 0x14;
+
+// VK_KANA (15) Input Method Editor (IME) Kana mode
+const int VK_KANA = 0x15;
+
+// VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL)
+// VK_HANGUL (15) IME Hangul mode
+const int VK_HANGUL = 0x15;
+
+// VK_JUNJA (17) IME Junja mode
+const int VK_JUNJA = 0x17;
+
+// VK_FINAL (18) IME final mode
+const int VK_FINAL = 0x18;
+
+// VK_HANJA (19) IME Hanja mode
+const int VK_HANJA = 0x19;
+
+// VK_KANJI (19) IME Kanji mode
+const int VK_KANJI = 0x19;
+
+// VK_ESCAPE (1B) ESC key
+const int VK_ESCAPE = 0x1B;
+
+// VK_CONVERT (1C) IME convert
+const int VK_CONVERT = 0x1C;
+
+// VK_NONCONVERT (1D) IME nonconvert
+const int VK_NONCONVERT = 0x1D;
+
+// VK_ACCEPT (1E) IME accept
+const int VK_ACCEPT = 0x1E;
+
+// VK_MODECHANGE (1F) IME mode change request
+const int VK_MODECHANGE = 0x1F;
+
+// VK_SPACE (20) SPACEBAR
+const int VK_SPACE = 0x20;
+
+// VK_PRIOR (21) PAGE UP key
+const int VK_PRIOR = 0x21;
+
+// VK_NEXT (22) PAGE DOWN key
+const int VK_NEXT = 0x22;
+
+// VK_END (23) END key
+const int VK_END = 0x23;
+
+// VK_HOME (24) HOME key
+const int VK_HOME = 0x24;
+
+// VK_LEFT (25) LEFT ARROW key
+const int VK_LEFT = 0x25;
+
+// VK_UP (26) UP ARROW key
+const int VK_UP = 0x26;
+
+// VK_RIGHT (27) RIGHT ARROW key
+const int VK_RIGHT = 0x27;
+
+// VK_DOWN (28) DOWN ARROW key
+const int VK_DOWN = 0x28;
+
+// VK_SELECT (29) SELECT key
+const int VK_SELECT = 0x29;
+
+// VK_PRINT (2A) PRINT key
+const int VK_PRINT = 0x2A;
+
+// VK_EXECUTE (2B) EXECUTE key
+const int VK_EXECUTE = 0x2B;
+
+// VK_SNAPSHOT (2C) PRINT SCREEN key
+const int VK_SNAPSHOT = 0x2C;
+
+// VK_INSERT (2D) INS key
+const int VK_INSERT = 0x2D;
+
+// VK_DELETE (2E) DEL key
+const int VK_DELETE = 0x2E;
+
+// VK_HELP (2F) HELP key
+const int VK_HELP = 0x2F;
+
+// (30) 0 key
+const int VK_0 = 0x30;
+
+// (31) 1 key
+const int VK_1 = 0x31;
+
+// (32) 2 key
+const int VK_2 = 0x32;
+
+// (33) 3 key
+const int VK_3 = 0x33;
+
+// (34) 4 key
+const int VK_4 = 0x34;
+
+// (35) 5 key;
+
+const int VK_5 = 0x35;
+
+// (36) 6 key
+const int VK_6 = 0x36;
+
+// (37) 7 key
+const int VK_7 = 0x37;
+
+// (38) 8 key
+const int VK_8 = 0x38;
+
+// (39) 9 key
+const int VK_9 = 0x39;
+
+// (41) A key
+const int VK_A = 0x41;
+
+// (42) B key
+const int VK_B = 0x42;
+
+// (43) C key
+const int VK_C = 0x43;
+
+// (44) D key
+const int VK_D = 0x44;
+
+// (45) E key
+const int VK_E = 0x45;
+
+// (46) F key
+const int VK_F = 0x46;
+
+// (47) G key
+const int VK_G = 0x47;
+
+// (48) H key
+const int VK_H = 0x48;
+
+// (49) I key
+const int VK_I = 0x49;
+
+// (4A) J key
+const int VK_J = 0x4A;
+
+// (4B) K key
+const int VK_K = 0x4B;
+
+// (4C) L key
+const int VK_L = 0x4C;
+
+// (4D) M key
+const int VK_M = 0x4D;
+
+// (4E) N key
+const int VK_N = 0x4E;
+
+// (4F) O key
+const int VK_O = 0x4F;
+
+// (50) P key
+const int VK_P = 0x50;
+
+// (51) Q key
+const int VK_Q = 0x51;
+
+// (52) R key
+const int VK_R = 0x52;
+
+// (53) S key
+const int VK_S = 0x53;
+
+// (54) T key
+const int VK_T = 0x54;
+
+// (55) U key
+const int VK_U = 0x55;
+
+// (56) V key
+const int VK_V = 0x56;
+
+// (57) W key
+const int VK_W = 0x57;
+
+// (58) X key
+const int VK_X = 0x58;
+
+// (59) Y key
+const int VK_Y = 0x59;
+
+// (5A) Z key
+const int VK_Z = 0x5A;
+
+// VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard)
+const int VK_LWIN = 0x5B;
+
+// VK_RWIN (5C) Right Windows key (Natural keyboard)
+const int VK_RWIN = 0x5C;
+
+// VK_APPS (5D) Applications key (Natural keyboard)
+const int VK_APPS = 0x5D;
+
+// VK_SLEEP (5F) Computer Sleep key
+const int VK_SLEEP = 0x5F;
+
+// VK_NUMPAD0 (60) Numeric keypad 0 key
+const int VK_NUMPAD0 = 0x60;
+
+// VK_NUMPAD1 (61) Numeric keypad 1 key
+const int VK_NUMPAD1 = 0x61;
+
+// VK_NUMPAD2 (62) Numeric keypad 2 key
+const int VK_NUMPAD2 = 0x62;
+
+// VK_NUMPAD3 (63) Numeric keypad 3 key
+const int VK_NUMPAD3 = 0x63;
+
+// VK_NUMPAD4 (64) Numeric keypad 4 key
+const int VK_NUMPAD4 = 0x64;
+
+// VK_NUMPAD5 (65) Numeric keypad 5 key
+const int VK_NUMPAD5 = 0x65;
+
+// VK_NUMPAD6 (66) Numeric keypad 6 key
+const int VK_NUMPAD6 = 0x66;
+
+// VK_NUMPAD7 (67) Numeric keypad 7 key
+const int VK_NUMPAD7 = 0x67;
+
+// VK_NUMPAD8 (68) Numeric keypad 8 key
+const int VK_NUMPAD8 = 0x68;
+
+// VK_NUMPAD9 (69) Numeric keypad 9 key
+const int VK_NUMPAD9 = 0x69;
+
+// VK_MULTIPLY (6A) Multiply key
+const int VK_MULTIPLY = 0x6A;
+
+// VK_ADD (6B) Add key
+const int VK_ADD = 0x6B;
+
+// VK_SEPARATOR (6C) Separator key
+const int VK_SEPARATOR = 0x6C;
+
+// VK_SUBTRACT (6D) Subtract key
+const int VK_SUBTRACT = 0x6D;
+
+// VK_DECIMAL (6E) Decimal key
+const int VK_DECIMAL = 0x6E;
+
+// VK_DIVIDE (6F) Divide key
+const int VK_DIVIDE = 0x6F;
+
+// VK_F1 (70) F1 key
+const int VK_F1 = 0x70;
+
+// VK_F2 (71) F2 key
+const int VK_F2 = 0x71;
+
+// VK_F3 (72) F3 key
+const int VK_F3 = 0x72;
+
+// VK_F4 (73) F4 key
+const int VK_F4 = 0x73;
+
+// VK_F5 (74) F5 key
+const int VK_F5 = 0x74;
+
+// VK_F6 (75) F6 key
+const int VK_F6 = 0x75;
+
+// VK_F7 (76) F7 key
+const int VK_F7 = 0x76;
+
+// VK_F8 (77) F8 key
+const int VK_F8 = 0x77;
+
+// VK_F9 (78) F9 key
+const int VK_F9 = 0x78;
+
+// VK_F10 (79) F10 key
+const int VK_F10 = 0x79;
+
+// VK_F11 (7A) F11 key
+const int VK_F11 = 0x7A;
+
+// VK_F12 (7B) F12 key
+const int VK_F12 = 0x7B;
+
+// VK_F13 (7C) F13 key
+const int VK_F13 = 0x7C;
+
+// VK_F14 (7D) F14 key
+const int VK_F14 = 0x7D;
+
+// VK_F15 (7E) F15 key
+const int VK_F15 = 0x7E;
+
+// VK_F16 (7F) F16 key
+const int VK_F16 = 0x7F;
+
+// VK_F17 (80H) F17 key
+const int VK_F17 = 0x80;
+
+// VK_F18 (81H) F18 key
+const int VK_F18 = 0x81;
+
+// VK_F19 (82H) F19 key
+const int VK_F19 = 0x82;
+
+// VK_F20 (83H) F20 key
+const int VK_F20 = 0x83;
+
+// VK_F21 (84H) F21 key
+const int VK_F21 = 0x84;
+
+// VK_F22 (85H) F22 key
+const int VK_F22 = 0x85;
+
+// VK_F23 (86H) F23 key
+const int VK_F23 = 0x86;
+
+// VK_F24 (87H) F24 key
+const int VK_F24 = 0x87;
+
+// VK_NUMLOCK (90) NUM LOCK key
+const int VK_NUMLOCK = 0x90;
+
+// VK_SCROLL (91) SCROLL LOCK key
+const int VK_SCROLL = 0x91;
+
+// VK_LSHIFT (A0) Left SHIFT key
+const int VK_LSHIFT = 0xA0;
+
+// VK_RSHIFT (A1) Right SHIFT key
+const int VK_RSHIFT = 0xA1;
+
+// VK_LCONTROL (A2) Left CONTROL key
+const int VK_LCONTROL = 0xA2;
+
+// VK_RCONTROL (A3) Right CONTROL key
+const int VK_RCONTROL = 0xA3;
+
+// VK_LMENU (A4) Left MENU key
+const int VK_LMENU = 0xA4;
+
+// VK_RMENU (A5) Right MENU key
+const int VK_RMENU = 0xA5;
+
+// VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key
+const int VK_BROWSER_BACK = 0xA6;
+
+// VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key
+const int VK_BROWSER_FORWARD = 0xA7;
+
+// VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key
+const int VK_BROWSER_REFRESH = 0xA8;
+
+// VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key
+const int VK_BROWSER_STOP = 0xA9;
+
+// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
+const int VK_BROWSER_SEARCH = 0xAA;
+
+// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
+const int VK_BROWSER_FAVORITES = 0xAB;
+
+// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
+const int VK_BROWSER_HOME = 0xAC;
+
+// VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
+const int VK_VOLUME_MUTE = 0xAD;
+
+// VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
+const int VK_VOLUME_DOWN = 0xAE;
+
+// VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
+const int VK_VOLUME_UP = 0xAF;
+
+// VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
+const int VK_MEDIA_NEXT_TRACK = 0xB0;
+
+// VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
+const int VK_MEDIA_PREV_TRACK = 0xB1;
+
+// VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
+const int VK_MEDIA_STOP = 0xB2;
+
+// VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
+const int VK_MEDIA_PLAY_PAUSE = 0xB3;
+
+// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
+const int VK_MEDIA_LAUNCH_MAIL = 0xB4;
+
+// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
+const int VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5;
+
+// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
+const int VK_MEDIA_LAUNCH_APP1 = 0xB6;
+
+// VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key
+const int VK_MEDIA_LAUNCH_APP2 = 0xB7;
+
+// VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key
+const int VK_OEM_1 = 0xBA;
+
+// VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
+const int VK_OEM_PLUS = 0xBB;
+
+// VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
+const int VK_OEM_COMMA = 0xBC;
+
+// VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
+const int VK_OEM_MINUS = 0xBD;
+
+// VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
+const int VK_OEM_PERIOD = 0xBE;
+
+// VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key
+const int VK_OEM_2 = 0xBF;
+
+// VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key
+const int VK_OEM_3 = 0xC0;
+
+// VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key
+const int VK_OEM_4 = 0xDB;
+
+// VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key
+const int VK_OEM_5 = 0xDC;
+
+// VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key
+const int VK_OEM_6 = 0xDD;
+
+// VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
+const int VK_OEM_7 = 0xDE;
+
+// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
+const int VK_OEM_8 = 0xDF;
+
+// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
+const int VK_OEM_102 = 0xE2;
+
+// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
+const int VK_PROCESSKEY = 0xE5;
+
+// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
+const int VK_PACKET = 0xE7;
+
+// VK_ATTN (F6) Attn key
+const int VK_ATTN = 0xF6;
+
+// VK_CRSEL (F7) CrSel key
+const int VK_CRSEL = 0xF7;
+
+// VK_EXSEL (F8) ExSel key
+const int VK_EXSEL = 0xF8;
+
+// VK_EREOF (F9) Erase EOF key
+const int VK_EREOF = 0xF9;
+
+// VK_PLAY (FA) Play key
+const int VK_PLAY = 0xFA;
+
+// VK_ZOOM (FB) Zoom key
+const int VK_ZOOM = 0xFB;
+
+// VK_NONAME (FC) Reserved for future use
+const int VK_NONAME = 0xFC;
+
+// VK_PA1 (FD) PA1 key
+const int VK_PA1 = 0xFD;
+
+// VK_OEM_CLEAR (FE) Clear key
+const int VK_OEM_CLEAR = 0xFE;
+
+const int VK_UNKNOWN = 0;
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/MouseEventGdk.cpp b/WebCore/platform/gdk/MouseEventGdk.cpp
new file mode 100644
index 0000000..93ee934
--- /dev/null
+++ b/WebCore/platform/gdk/MouseEventGdk.cpp
@@ -0,0 +1,83 @@
+/*
+* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+* All rights reserved.
+*
+* 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.
+*/
+
+#include "config.h"
+#include "PlatformMouseEvent.h"
+
+#include <assert.h>
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+// FIXME: Would be even better to figure out which modifier is Alt instead of always using GDK_MOD1_MASK.
+
+PlatformMouseEvent::PlatformMouseEvent(GdkEvent* event)
+{
+ switch (event->type) {
+ case GDK_MOTION_NOTIFY:
+ m_position = IntPoint((int)event->motion.x, (int)event->motion.y);
+ m_globalPosition = IntPoint((int)event->motion.x_root, (int)event->motion.y_root);
+ m_button = (MouseButton)(-1);
+ m_clickCount = 0;
+ m_shiftKey = event->motion.state & GDK_SHIFT_MASK != 0;
+ m_ctrlKey = event->motion.state & GDK_CONTROL_MASK != 0;
+ m_altKey = event->motion.state & GDK_MOD1_MASK != 0;
+ m_metaKey = event->motion.state & GDK_MOD2_MASK != 0;
+ break;
+
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ if (event->type == GDK_BUTTON_PRESS)
+ m_clickCount = 1;
+ else if (event->type == GDK_2BUTTON_PRESS)
+ m_clickCount = 2;
+ else if (event->type == GDK_3BUTTON_PRESS)
+ m_clickCount = 3;
+
+ if (event->button.button == 1)
+ m_button = LeftButton;
+ else if (event->button.button == 2)
+ m_button = MiddleButton;
+ else if (event->button.button == 3)
+ m_button = RightButton;
+
+ m_position = IntPoint((int)event->button.x, (int)event->button.y);
+ m_globalPosition = IntPoint((int)event->button.x_root, (int)event->button.y_root);
+ m_shiftKey = event->button.state & GDK_SHIFT_MASK != 0;
+ m_ctrlKey = event->button.state & GDK_CONTROL_MASK != 0;
+ m_altKey = event->button.state & GDK_MOD1_MASK != 0;
+ m_metaKey = event->button.state & GDK_MOD2_MASK != 0;
+ break;
+
+ default:
+ fprintf(stderr, "Unknown mouse event\n");
+ assert(0);
+ }
+}
+
+}
diff --git a/WebCore/platform/gdk/PageGdk.cpp b/WebCore/platform/gdk/PageGdk.cpp
new file mode 100644
index 0000000..d261fd1
--- /dev/null
+++ b/WebCore/platform/gdk/PageGdk.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "Page.h"
+
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include <gdk/gdk.h>
+
+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/RenderThemeGdk.cpp b/WebCore/platform/gdk/RenderThemeGdk.cpp
new file mode 100644
index 0000000..5a9703b
--- /dev/null
+++ b/WebCore/platform/gdk/RenderThemeGdk.cpp
@@ -0,0 +1,158 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "RenderThemeGdk.h"
+
+#include "GraphicsContext.h"
+#include <cairo.h>
+
+#define THEME_COLOR 204
+#define THEME_FONT 210
+
+// Generic state constants
+#define TS_NORMAL 1
+#define TS_HOVER 2
+#define TS_ACTIVE 3
+#define TS_DISABLED 4
+#define TS_FOCUSED 5
+
+// Button constants
+#define BP_BUTTON 1
+#define BP_RADIO 2
+#define BP_CHECKBOX 3
+
+// Textfield constants
+#define TFP_TEXTFIELD 1
+#define TFS_READONLY 6
+
+namespace WebCore {
+
+RenderTheme* theme()
+{
+ static RenderThemeGdk gdkTheme;
+ return &gdkTheme;
+}
+
+RenderThemeGdk::RenderThemeGdk()
+{
+}
+
+RenderThemeGdk::~RenderThemeGdk()
+{
+}
+
+void RenderThemeGdk::close()
+{
+}
+
+void RenderThemeGdk::addIntrinsicMargins(RenderStyle* style) const
+{
+ // Cut out the intrinsic margins completely if we end up using a small font size
+ if (style->fontSize() < 11)
+ return;
+
+ // Intrinsic margin value.
+ const int m = 2;
+
+ // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed.
+ if (style->width().isIntrinsicOrAuto()) {
+ if (style->marginLeft().quirk())
+ style->setMarginLeft(Length(m, Fixed));
+ if (style->marginRight().quirk())
+ style->setMarginRight(Length(m, Fixed));
+ }
+
+ if (style->height().isAuto()) {
+ if (style->marginTop().quirk())
+ style->setMarginTop(Length(m, Fixed));
+ if (style->marginBottom().quirk())
+ style->setMarginBottom(Length(m, Fixed));
+ }
+}
+
+bool RenderThemeGdk::supportsFocus(EAppearance appearance)
+{
+ switch (appearance) {
+ case PushButtonAppearance:
+ case ButtonAppearance:
+ case TextFieldAppearance:
+ return true;
+ default:
+ return false;
+ }
+
+ return false;
+}
+
+unsigned RenderThemeGdk::determineState(RenderObject* o)
+{
+ unsigned result = TS_NORMAL;
+ if (!isEnabled(o))
+ result = TS_DISABLED;
+ else if (isReadOnlyControl(o))
+ result = TFS_READONLY; // Readonly is supported on textfields.
+ else if (supportsFocus(o->style()->appearance()) && isFocused(o))
+ result = TS_FOCUSED;
+ else if (isHovered(o))
+ result = TS_HOVER;
+ else if (isPressed(o))
+ result = TS_ACTIVE;
+ if (isChecked(o))
+ result += 4; // 4 unchecked states, 4 checked states.
+ return result;
+}
+
+ThemeData RenderThemeGdk::getThemeData(RenderObject* o)
+{
+ ThemeData result;
+ switch (o->style()->appearance()) {
+ case PushButtonAppearance:
+ case ButtonAppearance:
+ result.m_part = BP_BUTTON;
+ result.m_state = determineState(o);
+ break;
+ case CheckboxAppearance:
+ result.m_part = BP_CHECKBOX;
+ result.m_state = determineState(o);
+ break;
+ case RadioAppearance:
+ result.m_part = BP_RADIO;
+ result.m_state = determineState(o);
+ break;
+ case TextFieldAppearance:
+ result.m_part = TFP_TEXTFIELD;
+ result.m_state = determineState(o);
+ break;
+ }
+
+ return result;
+}
+
+void RenderThemeGdk::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, WebCore::Element* e) const
+{
+ addIntrinsicMargins(style);
+}
+
+}
diff --git a/WebCore/platform/gdk/RenderThemeGdk.h b/WebCore/platform/gdk/RenderThemeGdk.h
new file mode 100644
index 0000000..dfc40de
--- /dev/null
+++ b/WebCore/platform/gdk/RenderThemeGdk.h
@@ -0,0 +1,73 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderThemeGdk_H_
+#define RenderThemeGdk_H_
+
+#include "RenderTheme.h"
+
+namespace WebCore {
+
+struct ThemeData {
+ ThemeData() : m_part(0), m_state(0) {}
+
+ unsigned m_part;
+ unsigned m_state;
+};
+
+class RenderThemeGdk : public RenderTheme {
+public:
+ RenderThemeGdk();
+ ~RenderThemeGdk();
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle* style) const { return true; }
+
+ virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+ { return paintButton(o, i, r); }
+ virtual void setCheckboxSize(RenderStyle* style) const;
+
+ virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+ { return paintButton(o, i, r); }
+ virtual void setRadioSize(RenderStyle* style) const;
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+private:
+ void addIntrinsicMargins(RenderStyle*) const;
+ void close();
+
+ unsigned determineState(RenderObject*);
+ bool supportsFocus(EAppearance);
+
+ ThemeData getThemeData(RenderObject*);
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/ScreenGdk.cpp b/WebCore/platform/gdk/ScreenGdk.cpp
new file mode 100644
index 0000000..4461c46
--- /dev/null
+++ b/WebCore/platform/gdk/ScreenGdk.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "Screen.h"
+
+#include "FloatRect.h"
+#include "Widget.h"
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+FloatRect screenRect(Widget* widget)
+{
+ GdkDrawable* drawable = widget->drawable();
+ 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));
+}
+
+int screenDepth(Widget* widget)
+{
+ GdkDrawable* drawable = widget->drawable();
+ if (!drawable)
+ return 32;
+ return gdk_drawable_get_depth(drawable);
+}
+
+FloatRect usableScreenRect(Widget* widget)
+{
+ return screenRect(widget);
+}
+
+}
diff --git a/WebCore/platform/gdk/ScrollViewGdk.cpp b/WebCore/platform/gdk/ScrollViewGdk.cpp
new file mode 100644
index 0000000..ba72ff1
--- /dev/null
+++ b/WebCore/platform/gdk/ScrollViewGdk.cpp
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "ScrollView.h"
+
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "RenderLayer.h"
+#include "assert.h"
+#include <algorithm>
+#include <gdk/gdk.h>
+
+using namespace std;
+
+namespace WebCore {
+
+const int scrollbarSize = 10;
+
+class ScrollView::ScrollViewPrivate
+{
+public:
+ ScrollViewPrivate()
+ : hasStaticBackground(false), suppressScrollBars(false)
+ , vScrollBarMode(ScrollBarAuto), hScrollBarMode(ScrollBarAuto)
+ { }
+
+ IntSize scrollOffset;
+ IntSize contentsSize;
+ bool hasStaticBackground;
+ bool suppressScrollBars;
+ ScrollBarMode vScrollBarMode;
+ ScrollBarMode hScrollBarMode;
+ IntRect visibleContentArea;
+ IntRect viewportArea;
+ IntRect scrollViewArea;
+};
+
+
+ScrollView::ScrollView()
+ : m_data(new ScrollViewPrivate)
+{}
+
+ScrollView::~ScrollView()
+{
+ delete m_data;
+}
+
+void ScrollView::updateView(const IntRect& updateRect, bool now)
+{
+ GdkRectangle rect = { updateRect.x(), updateRect.y(), updateRect.width(), updateRect.height() };
+ GdkDrawable* gdkdrawable = Widget::drawable();
+ if (GDK_IS_WINDOW(gdkdrawable)) {
+ GdkWindow* window = GDK_WINDOW(gdkdrawable);
+ gdk_window_invalidate_rect(window, &rect, true);
+ if (now)
+ gdk_window_process_updates(window, true);
+ }
+}
+
+void ScrollView::updateContents(const IntRect& updateRect, bool now)
+{
+ IntRect adjustedDirtyRect(updateRect);
+ adjustedDirtyRect.move(-m_data->scrollOffset);
+ updateView(adjustedDirtyRect, now);
+}
+
+int ScrollView::visibleWidth() const
+{
+ return m_data->viewportArea.width();
+}
+
+int ScrollView::visibleHeight() const
+{
+ return m_data->viewportArea.height();
+}
+
+// Region of the content currently visible in the viewport in the content view's coordinate system.
+FloatRect ScrollView::visibleContentRect() const
+{
+ FloatRect contentRect = FloatRect(m_data->viewportArea);
+ contentRect.move(m_data->scrollOffset);
+ return contentRect;
+}
+
+void ScrollView::setContentsPos(int newX, int newY)
+{
+ int dx = newX - contentsX();
+ int dy = newY - contentsY();
+ scrollBy(dx, dy);
+}
+
+void ScrollView::resizeContents(int w, int h)
+{
+ IntSize newSize(w, h);
+ if (m_data->contentsSize != newSize) {
+ m_data->contentsSize = newSize;
+ updateScrollBars();
+ }
+}
+
+int ScrollView::contentsX() const
+{
+ return scrollOffset().width();
+}
+
+int ScrollView::contentsY() const
+{
+ return scrollOffset().height();
+}
+
+int ScrollView::contentsWidth() const
+{
+ return m_data->contentsSize.width();
+}
+
+int ScrollView::contentsHeight() const
+{
+ return m_data->contentsSize.height();
+}
+
+IntPoint ScrollView::viewportToContents(const IntPoint& contentsPoint)
+{
+ return contentsPoint + scrollOffset();
+}
+
+IntPoint ScrollView::contentsToViewport(const IntPoint& viewportPoint)
+{
+ return IntPoint(viewportPoint) - scrollOffset();
+}
+
+IntSize ScrollView::scrollOffset() const
+{
+ return m_data->scrollOffset;
+}
+
+IntSize ScrollView::maximumScroll() const
+{
+ IntSize delta = m_data->contentsSize - m_data->scrollOffset;
+ delta.clampNegativeToZero();
+ return delta;
+
+}
+void ScrollView::scrollBy(int dx, int dy)
+{
+ IntSize scrollOffset = m_data->scrollOffset;
+ IntSize maxScroll = maximumScroll();
+ IntSize newScrollOffset = scrollOffset + IntSize(dx, dy);
+ newScrollOffset.clampNegativeToZero();
+ newScrollOffset = newScrollOffset.shrunkTo(maxScroll);
+
+ if (newScrollOffset != scrollOffset) {
+ m_data->scrollOffset = newScrollOffset;
+ updateScrollBars();
+ // ScrollBar updates can fail, so we check the final delta before scrolling
+ IntSize scrollDelta = m_data->scrollOffset - scrollOffset;
+ if (scrollDelta == IntSize())
+ return;
+ if (isFrameView()) {
+ FrameView* f = static_cast<FrameView*>(this);
+ f->frame()->renderer()->layer()->scrollToOffset
+ (newScrollOffset.width(), newScrollOffset.height(), true, true);
+ } else {
+ printf("FIXME ScrollViewGdk Unsupported Scroll operation !!!\n");
+ updateView(m_data->viewportArea, true);
+ }
+ }
+}
+
+ScrollBarMode ScrollView::hScrollBarMode() const
+{
+ return m_data->hScrollBarMode;
+}
+
+ScrollBarMode ScrollView::vScrollBarMode() const
+{
+ return m_data->vScrollBarMode;
+}
+
+void ScrollView::suppressScrollBars(bool suppressed, bool repaintOnSuppress)
+{
+ m_data->suppressScrollBars = suppressed;
+ if (repaintOnSuppress)
+ updateScrollBars();
+}
+
+void ScrollView::setHScrollBarMode(ScrollBarMode newMode)
+{
+ if (m_data->hScrollBarMode != newMode) {
+ m_data->hScrollBarMode = newMode;
+ updateScrollBars();
+ }
+}
+
+void ScrollView::setVScrollBarMode(ScrollBarMode newMode)
+{
+ if (m_data->vScrollBarMode != newMode) {
+ m_data->vScrollBarMode = newMode;
+ updateScrollBars();
+ }
+}
+
+void ScrollView::setScrollBarsMode(ScrollBarMode newMode)
+{
+ m_data->hScrollBarMode = m_data->vScrollBarMode = newMode;
+ updateScrollBars();
+}
+
+void ScrollView::setStaticBackground(bool flag)
+{
+ m_data->hasStaticBackground = flag;
+}
+
+void ScrollView::setFrameGeometry(const IntRect& r)
+{
+ Widget::setFrameGeometry(r);
+ m_data->scrollViewArea = IntRect(0, 0, r.width(), r.height());
+ m_data->viewportArea = IntRect(0, 0, r.width() - scrollbarSize, r.height() - scrollbarSize);
+}
+
+void ScrollView::setDrawable(GdkDrawable* gdkdrawable)
+{
+ Widget::setDrawable(gdkdrawable);
+ if (!GDK_IS_WINDOW(gdkdrawable)) {
+ LOG_ERROR("image scrollview not supported");
+ return;
+ }
+ GdkWindow* frame = GDK_WINDOW(gdkdrawable);
+ gint x, y, width, height, depth;
+ gdk_window_get_geometry(frame, &x, &y, &width, &height, &depth);
+ m_data->scrollViewArea = IntRect(0, 0, width, height);
+ m_data->viewportArea = IntRect(0, 0, width - SCROLLBAR_SIZE, height - SCROLLBAR_SIZE);
+}
+
+}
diff --git a/WebCore/platform/gdk/SharedTimerLinux.cpp b/WebCore/platform/gdk/SharedTimerLinux.cpp
new file mode 100644
index 0000000..f317858
--- /dev/null
+++ b/WebCore/platform/gdk/SharedTimerLinux.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "SharedTimer.h"
+
+#include "SystemTime.h"
+#include <wtf/Assertions.h>
+#include <glib.h>
+
+namespace WebCore {
+
+static guint sharedTimer;
+static void (*sharedTimerFiredFunction)();
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+ sharedTimerFiredFunction = f;
+}
+
+static gboolean timeout_cb(gpointer)
+{
+ if (sharedTimerFiredFunction)
+ sharedTimerFiredFunction();
+ return FALSE;
+}
+
+void setSharedTimerFireTime(double fireTime)
+{
+ ASSERT(sharedTimerFiredFunction);
+
+ double interval = fireTime - currentTime();
+ guint intervalInMS;
+ if (interval < 0)
+ intervalInMS = 0;
+ else {
+ interval *= 1000;
+ intervalInMS = (guint)interval;
+ }
+
+ stopSharedTimer();
+ if (intervalInMS == 0)
+ sharedTimer = g_idle_add_full(G_PRIORITY_DEFAULT, timeout_cb, NULL, NULL);
+ else
+ sharedTimer = g_timeout_add_full(G_PRIORITY_DEFAULT, intervalInMS, timeout_cb, NULL, NULL);
+}
+
+void stopSharedTimer()
+{
+ if (sharedTimer == 0)
+ return;
+
+ gboolean s = g_source_remove(sharedTimer);
+ ASSERT(s);
+ sharedTimer = 0;
+}
+
+}
diff --git a/WebCore/platform/gdk/SystemTimeLinux.cpp b/WebCore/platform/gdk/SystemTimeLinux.cpp
new file mode 100644
index 0000000..cbdba91
--- /dev/null
+++ b/WebCore/platform/gdk/SystemTimeLinux.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "SystemTime.h"
+
+#include <time.h>
+
+namespace WebCore {
+
+double currentTime()
+{
+ time_t ttime;
+ time(&ttime);
+ return (double)ttime;
+}
+
+}
diff --git a/WebCore/platform/gdk/TemporaryLinkStubs.cpp b/WebCore/platform/gdk/TemporaryLinkStubs.cpp
new file mode 100644
index 0000000..635b6c8
--- /dev/null
+++ b/WebCore/platform/gdk/TemporaryLinkStubs.cpp
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#define WIN32_COMPILE_HACK
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "Node.h"
+#include "KWQLineEdit.h"
+#include "Font.h"
+#include "KWQFileButton.h"
+#include "KWQTextEdit.h"
+#include "KWQComboBox.h"
+#include "IntPoint.h"
+#include "Widget.h"
+#include "GraphicsContext.h"
+#include "KWQSlider.h"
+#include "Cursor.h"
+#include "loader.h"
+#include "FrameView.h"
+#include "KURL.h"
+#include "KWQScrollBar.h"
+#include "JavaAppletWidget.h"
+#include "KWQScrollBar.h"
+#include "Path.h"
+#include "PlatformMouseEvent.h"
+#include "CookieJar.h"
+#include "Screen.h"
+#include "History.h"
+#include "Language.h"
+#include "LocalizedStrings.h"
+#include "PlugInInfoStore.h"
+#include "RenderTheme.h"
+#include "FrameGdk.h"
+#include "BrowserExtensionGdk.h"
+#include "TransferJob.h"
+#include "RenderThemeGdk.h"
+#include "TextBoundaries.h"
+#include "AccessibilityObjectCache.h"
+
+using namespace WebCore;
+
+static void notImplemented() { puts("Not yet implemented"); }
+
+
+void FrameView::updateBorder() { notImplemented(); }
+//bool FrameView::isFrameView() const { notImplemented(); return 0; }
+
+QTextEdit::QTextEdit(Widget*) { notImplemented(); }
+QTextEdit::~QTextEdit() { notImplemented(); }
+String QTextEdit::textWithHardLineBreaks() const { notImplemented(); return String(); }
+IntSize QTextEdit::sizeWithColumnsAndRows(int, int) const { notImplemented(); return IntSize(); }
+void QTextEdit::setText(String const&) { notImplemented(); }
+void QTextEdit::setColors(Color const&, Color const&) { notImplemented(); }
+void QTextEdit::setFont(WebCore::Font const&) { notImplemented(); }
+void QTextEdit::setWritingDirection(enum WebCore::TextDirection) { notImplemented(); }
+bool QTextEdit::checksDescendantsForFocus() const { notImplemented(); return false; }
+int QTextEdit::selectionStart() { notImplemented(); return 0; }
+bool QTextEdit::hasSelectedText() const { notImplemented(); return 0; }
+int QTextEdit::selectionEnd() { notImplemented(); return 0; }
+void QTextEdit::setScrollBarModes(ScrollBarMode, ScrollBarMode) { notImplemented(); }
+void QTextEdit::setReadOnly(bool) { notImplemented(); }
+void QTextEdit::selectAll() { notImplemented(); }
+void QTextEdit::setDisabled(bool) { notImplemented(); }
+void QTextEdit::setLineHeight(int) { notImplemented(); }
+void QTextEdit::setSelectionStart(int) { notImplemented(); }
+void QTextEdit::setCursorPosition(int, int) { notImplemented(); }
+String QTextEdit::text() const { notImplemented(); return String(); }
+void QTextEdit::setWordWrap(QTextEdit::WrapStyle) { notImplemented(); }
+void QTextEdit::setAlignment(HorizontalAlignment) { notImplemented(); }
+void QTextEdit::setSelectionEnd(int) { notImplemented(); }
+void QTextEdit::getCursorPosition(int*, int*) const { notImplemented(); }
+void QTextEdit::setSelectionRange(int, int) { notImplemented(); }
+
+Widget::FocusPolicy QComboBox::focusPolicy() const { notImplemented(); return NoFocus; }
+void QComboBox::populate() { notImplemented(); }
+
+void Widget::enableFlushDrawing() { notImplemented(); }
+bool Widget::isEnabled() const { notImplemented(); return 0; }
+Widget::FocusPolicy Widget::focusPolicy() const { notImplemented(); return NoFocus; }
+void Widget::disableFlushDrawing() { notImplemented(); }
+GraphicsContext* Widget::lockDrawingFocus() { notImplemented(); return 0; }
+void Widget::unlockDrawingFocus(GraphicsContext*) { notImplemented(); }
+
+JavaAppletWidget::JavaAppletWidget(IntSize const&, Element*, WTF::HashMap<String, String> const&) { notImplemented(); }
+
+void QLineEdit::selectAll() { notImplemented(); }
+void QLineEdit::addSearchResult() { notImplemented(); }
+int QLineEdit::selectionStart() const { notImplemented(); return 0; }
+bool QLineEdit::hasSelectedText() const { notImplemented(); return 0; }
+String QLineEdit::selectedText() const { notImplemented(); return String(); }
+void QLineEdit::setAutoSaveName(String const&) { notImplemented(); }
+bool QLineEdit::checksDescendantsForFocus() const { notImplemented(); return false; }
+void QLineEdit::setSelection(int, int) { notImplemented(); }
+void QLineEdit::setMaxResults(int) { notImplemented(); }
+bool QLineEdit::edited() const { notImplemented(); return 0; }
+
+QSlider::QSlider() { notImplemented(); }
+IntSize QSlider::sizeHint() const { notImplemented(); return IntSize(); }
+void QSlider::setValue(double) { notImplemented(); }
+void QSlider::setMaxValue(double) { notImplemented(); }
+void QSlider::setMinValue(double) { notImplemented(); }
+QSlider::~QSlider() { notImplemented(); }
+void QSlider::setFont(WebCore::Font const&) { notImplemented(); }
+double QSlider::value() const { notImplemented(); return 0; }
+
+void QListBox::setSelected(int, bool) { notImplemented(); }
+IntSize QListBox::sizeForNumberOfLines(int) const { notImplemented(); return IntSize(); }
+bool QListBox::isSelected(int) const { notImplemented(); return 0; }
+void QListBox::appendItem(DeprecatedString const&, KWQListBoxItemType, bool) { notImplemented(); }
+void QListBox::doneAppendingItems() { notImplemented(); }
+void QListBox::setWritingDirection(TextDirection) { notImplemented(); }
+void QListBox::setEnabled(bool) { notImplemented(); }
+void QListBox::clear() { notImplemented(); }
+bool QListBox::checksDescendantsForFocus() const { notImplemented(); return 0; }
+
+KWQFileButton::KWQFileButton(Frame*) { notImplemented(); }
+void KWQFileButton::click(bool) { notImplemented(); }
+IntSize KWQFileButton::sizeForCharacterWidth(int) const { notImplemented(); return IntSize(); }
+Widget::FocusPolicy KWQFileButton::focusPolicy() const { notImplemented(); return NoFocus; }
+WebCore::IntRect KWQFileButton::frameGeometry() const { notImplemented(); return IntRect(); }
+void KWQFileButton::setFilename(DeprecatedString const&) { notImplemented(); }
+int KWQFileButton::baselinePosition(int) const { notImplemented(); return 0; }
+void KWQFileButton::setFrameGeometry(WebCore::IntRect const&) { notImplemented(); }
+void KWQFileButton::setDisabled(bool) { notImplemented(); }
+
+Widget::FocusPolicy QTextEdit::focusPolicy() const { notImplemented(); return NoFocus; }
+Widget::FocusPolicy QSlider::focusPolicy() const { notImplemented(); return NoFocus; }
+Widget::FocusPolicy QListBox::focusPolicy() const { notImplemented(); return NoFocus; }
+Widget::FocusPolicy QLineEdit::focusPolicy() const { notImplemented(); return NoFocus; }
+
+Cursor::Cursor(Image*) { notImplemented(); }
+
+PlatformMouseEvent::PlatformMouseEvent() { notImplemented(); }
+String WebCore::searchableIndexIntroduction() { notImplemented(); return String(); }
+
+int WebCore::findNextSentenceFromIndex(UChar const*, int, int, bool) { notImplemented(); return 0; }
+void WebCore::findSentenceBoundary(UChar const*, int, int, int*, int*) { notImplemented(); }
+int WebCore::findNextWordFromIndex(UChar const*, int, int, bool) { notImplemented(); return 0; }
+
+DeprecatedArray<char> KWQServeSynchronousRequest(Loader*, DocLoader*, TransferJob*, KURL&, DeprecatedString&) { notImplemented(); return 0; }
+
+void FrameGdk::focusWindow() { notImplemented(); }
+void FrameGdk::unfocusWindow() { notImplemented(); }
+bool FrameGdk::locationbarVisible() { notImplemented(); return 0; }
+void FrameGdk::issueRedoCommand(void) { notImplemented(); }
+KJS::Bindings::Instance* FrameGdk::getObjectInstanceForWidget(Widget *) { notImplemented(); return 0; }
+KJS::Bindings::Instance* FrameGdk::getEmbedInstanceForWidget(Widget *) { notImplemented(); return 0; }
+bool FrameGdk::canRedo() const { notImplemented(); return 0; }
+bool FrameGdk::canUndo() const { notImplemented(); return 0; }
+void FrameGdk::registerCommandForRedo(WebCore::EditCommandPtr const&) { notImplemented(); }
+bool FrameGdk::runJavaScriptPrompt(String const&, String const&, String &) { notImplemented(); return 0; }
+bool FrameGdk::shouldInterruptJavaScript() { notImplemented(); return false; }
+//bool FrameWin::openURL(KURL const&) { notImplemented(); return 0; }
+void FrameGdk::print() { notImplemented(); }
+KJS::Bindings::Instance* FrameGdk::getAppletInstanceForWidget(Widget*) { notImplemented(); return 0; }
+bool FrameGdk::passMouseDownEventToWidget(Widget*) { notImplemented(); return 0; }
+void FrameGdk::issueCutCommand() { notImplemented(); }
+void FrameGdk::issueCopyCommand() { notImplemented(); }
+void FrameGdk::openURLRequest(struct WebCore::ResourceRequest const&) { notImplemented(); }
+//bool FrameWin::passWheelEventToChildWidget(Node*) { notImplemented(); return 0; }
+void FrameGdk::issueUndoCommand() { notImplemented(); }
+String FrameGdk::mimeTypeForFileName(String const&) const { notImplemented(); return String(); }
+void FrameGdk::issuePasteCommand() { notImplemented(); }
+void FrameGdk::scheduleClose() { notImplemented(); }
+void FrameGdk::markMisspellings(WebCore::SelectionController const&) { notImplemented(); }
+bool FrameGdk::menubarVisible() { notImplemented(); return 0; }
+bool FrameGdk::personalbarVisible() { notImplemented(); return 0; }
+bool FrameGdk::statusbarVisible() { notImplemented(); return 0; }
+bool FrameGdk::toolbarVisible() { notImplemented(); return 0; }
+void FrameGdk::issueTransposeCommand() { notImplemented(); }
+bool FrameGdk::canPaste() const { notImplemented(); return 0; }
+enum WebCore::ObjectContentType FrameGdk::objectContentType(KURL const&, String const&) { notImplemented(); return (ObjectContentType)0; }
+bool FrameGdk::canGoBackOrForward(int) const { notImplemented(); return 0; }
+void FrameGdk::issuePasteAndMatchStyleCommand() { notImplemented(); }
+Plugin* FrameGdk::createPlugin(Element*, KURL const&, const Vector<String>&, const Vector<String>&, String const&) { notImplemented(); return 0; }
+
+bool BrowserExtensionGdk::canRunModal() { notImplemented(); return 0; }
+void BrowserExtensionGdk::createNewWindow(struct WebCore::ResourceRequest const&, struct WebCore::WindowArgs const&, Frame*&) { notImplemented(); }
+bool BrowserExtensionGdk::canRunModalNow() { notImplemented(); return 0; }
+void BrowserExtensionGdk::runModal() { notImplemented(); }
+void BrowserExtensionGdk::goBackOrForward(int) { notImplemented(); }
+KURL BrowserExtensionGdk::historyURL(int distance) { notImplemented(); return KURL(); }
+void BrowserExtensionGdk::createNewWindow(struct WebCore::ResourceRequest const&) { notImplemented(); }
+
+int WebCore::screenDepthPerComponent(Widget*) { notImplemented(); return 0; }
+bool WebCore::screenIsMonochrome(Widget*) { notImplemented(); return false; }
+
+/********************************************************/
+/* Completely empty stubs (mostly to allow DRT to run): */
+/********************************************************/
+static Cursor localCursor;
+const Cursor& WebCore::moveCursor() { return localCursor; }
+
+bool AccessibilityObjectCache::gAccessibilityEnabled = false;
+
+bool WebCore::historyContains(DeprecatedString const&) { return false; }
+String WebCore::submitButtonDefaultLabel() { return "Submit"; }
+String WebCore::inputElementAltText() { return DeprecatedString(); }
+String WebCore::resetButtonDefaultLabel() { return "Reset"; }
+String WebCore::defaultLanguage() { return "en"; }
+
+void WebCore::findWordBoundary(UChar const* str, int len, int position, int* start, int* end) {*start = position; *end = position; }
+
+PluginInfo*PlugInInfoStore::createPluginInfoForPluginAtIndex(unsigned) { return 0;}
+unsigned PlugInInfoStore::pluginCount() const { return 0; }
+bool WebCore::PlugInInfoStore::supportsMIMEType(const WebCore::String&) { return false; }
+void WebCore::refreshPlugins(bool) { }
+
+void WebCore::TransferJob::assembleResponseHeaders() const { }
+void WebCore::TransferJob::retrieveCharset() const { }
+
+void FrameGdk::restoreDocumentState() { }
+void FrameGdk::partClearedInBegin() { }
+void FrameGdk::createEmptyDocument() { }
+String FrameGdk::overrideMediaType() const { return String(); }
+void FrameGdk::handledOnloadEvents() { }
+Range* FrameGdk::markedTextRange() const { return 0; }
+bool FrameGdk::lastEventIsMouseUp() const { return false; }
+void FrameGdk::addMessageToConsole(String const&, unsigned int, String const&) { }
+bool FrameGdk::shouldChangeSelection(SelectionController const&, SelectionController const&, WebCore::EAffinity, bool) const { return true; }
+void FrameGdk::respondToChangedSelection(WebCore::SelectionController const&, bool) { }
+static int frameNumber = 0;
+Frame* FrameGdk::createFrame(KURL const&, String const&, RenderPart*, String const&) { return 0; }
+void FrameGdk::saveDocumentState() { }
+void FrameGdk::registerCommandForUndo(WebCore::EditCommandPtr const&) { }
+void FrameGdk::clearUndoRedoOperations(void) { }
+String FrameGdk::incomingReferrer() const { return String(); }
+void FrameGdk::markMisspellingsInAdjacentWords(WebCore::VisiblePosition const&) { }
+void FrameGdk::respondToChangedContents() { }
+
+BrowserExtensionGdk::BrowserExtensionGdk(WebCore::Frame*) { }
+void BrowserExtensionGdk::setTypedIconURL(KURL const&, const String&) { }
+void BrowserExtensionGdk::setIconURL(KURL const&) { }
+int BrowserExtensionGdk::getHistoryLength() { return 0; }
+
+bool KWQCheckIfReloading(WebCore::DocLoader*) { return false; }
+void KWQCheckCacheObjectStatus(DocLoader*, CachedObject*) { }
+
+void Widget::setEnabled(bool) { }
+void Widget::paint(GraphicsContext*, IntRect const&) { }
+void Widget::setIsSelected(bool) { }
+
+void ScrollView::addChild(Widget*, int, int) { }
+void ScrollView::removeChild(Widget*) { }
+void ScrollView::scrollPointRecursively(int x, int y) { }
+bool ScrollView::inWindow() const { return true; }
+void ScrollView::updateScrollBars() { }
+int ScrollView::updateScrollInfo(short type, int current, int max, int pageSize) { return 0; }
+
+void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
+ const IntSize& bottomLeft, const IntSize& bottomRight) { notImplemented(); }
+void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { notImplemented(); }
+void GraphicsContext::setShadow(IntSize const&, int, Color const&) { }
+void GraphicsContext::clearShadow() { }
+void GraphicsContext::beginTransparencyLayer(float) { }
+void GraphicsContext::endTransparencyLayer() { }
+void GraphicsContext::clearRect(const FloatRect&) { }
+void GraphicsContext::strokeRect(const FloatRect&, float) { }
+void GraphicsContext::setLineWidth(float) { }
+void GraphicsContext::setLineCap(LineCap) { }
+void GraphicsContext::setLineJoin(LineJoin) { }
+void GraphicsContext::setMiterLimit(float) { }
+void GraphicsContext::setAlpha(float) { }
+void GraphicsContext::setCompositeOperation(CompositeOperator) { }
+void GraphicsContext::clip(const Path&) { }
+void GraphicsContext::translate(const FloatSize&) { }
+void GraphicsContext::rotate(float) { }
+void GraphicsContext::scale(const FloatSize&) { }
+
+Path::Path(){ }
+Path::~Path(){ }
+Path::Path(const Path&){ }
+bool Path::contains(const FloatPoint&) const{ return false; }
+void Path::translate(const FloatSize&){ }
+FloatRect Path::boundingRect() const { return FloatRect(); }
+Path& Path::operator=(const Path&){ return * this; }
+void Path::clear() { }
+void Path::moveTo(const FloatPoint&) { }
+void Path::addLineTo(const FloatPoint&) { }
+void Path::addQuadCurveTo(const FloatPoint&, const FloatPoint&) { }
+void Path::addBezierCurveTo(const FloatPoint&, const FloatPoint&, const FloatPoint&) { }
+void Path::addArcTo(const FloatPoint&, const FloatPoint&, float) { }
+void Path::closeSubpath() { }
+void Path::addArc(const FloatPoint&, float, float, float, bool) { }
+void Path::addRect(const FloatRect&) { }
+void Path::addEllipse(const FloatRect&) { }
+
+QLineEdit::QLineEdit(QLineEdit::Type) { }
+QLineEdit::~QLineEdit() { }
+void QLineEdit::setFont(WebCore::Font const&) { }
+void QLineEdit::setAlignment(HorizontalAlignment) { }
+void QLineEdit::setWritingDirection(TextDirection) { }
+int QLineEdit::maxLength() const { return 0; }
+void QLineEdit::setMaxLength(int) { }
+String QLineEdit::text() const { return String(); }
+void QLineEdit::setText(String const&) { }
+int QLineEdit::cursorPosition() const { return 0; }
+void QLineEdit::setCursorPosition(int) { }
+void QLineEdit::setEdited(bool) { }
+void QLineEdit::setReadOnly(bool) { }
+void QLineEdit::setPlaceholderString(String const&) { }
+void QLineEdit::setColors(Color const&, Color const&) { }
+IntSize QLineEdit::sizeForCharacterWidth(int) const { return IntSize(); }
+int QLineEdit::baselinePosition(int) const { return 0; }
+void QLineEdit::setLiveSearch(bool) { }
+
+QComboBox::QComboBox() { }
+QComboBox::~QComboBox() { }
+void QComboBox::setFont(WebCore::Font const&) { }
+int QComboBox::baselinePosition(int) const { return 0; }
+void QComboBox::setWritingDirection(TextDirection) { }
+void QComboBox::clear() { }
+void QComboBox::appendItem(DeprecatedString const&, KWQListBoxItemType, bool) { }
+void QComboBox::setCurrentItem(int) { }
+IntSize QComboBox::sizeHint() const { return IntSize(); }
+IntRect QComboBox::frameGeometry() const { return IntRect(); }
+void QComboBox::setFrameGeometry(IntRect const&) { }
+
+QScrollBar::QScrollBar(ScrollBarOrientation) { }
+QScrollBar::~QScrollBar() { }
+void QScrollBar::setSteps(int, int) { }
+bool QScrollBar::scroll(KWQScrollDirection, KWQScrollGranularity, float) { return 0; }
+bool QScrollBar::setValue(int) { return 0; }
+void QScrollBar::setKnobProportion(int, int) { }
+
+QListBox::QListBox() { }
+QListBox::~QListBox() { }
+void QListBox::setSelectionMode(QListBox::SelectionMode) { }
+void QListBox::setFont(WebCore::Font const&) { }
+
+Color WebCore::focusRingColor() { return 0xFF0000FF; }
+void WebCore::setFocusRingColorChangeFunction(void (*)()) { }
+
+void Frame::setNeedsReapplyStyles() { }
+
+void Image::drawTiled(GraphicsContext*, const FloatRect&, const FloatRect&, TileRule, TileRule) { }
+
+void RenderThemeGdk::setCheckboxSize(RenderStyle*) const { }
+bool RenderThemeGdk::paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; }
+void RenderThemeGdk::setRadioSize(RenderStyle*) const { }
+void RenderThemeGdk::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element* e) const {}
+bool RenderThemeGdk::paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return false; }
+
+FloatRect Font::selectionRectForComplexText(const TextRun&, const TextStyle&, const IntPoint&, int) const { return FloatRect(); }
+void Font::drawComplexText(GraphicsContext*, const TextRun&, const TextStyle&, const FloatPoint&) const { notImplemented(); }
+float Font::floatWidthForComplexText(const TextRun&, const TextStyle&) const { notImplemented(); return 0; }
+int Font::offsetForPositionForComplexText(const TextRun&, const TextStyle&, int, bool) const { notImplemented(); return 0; }
diff --git a/WebCore/platform/gdk/TransferJobCurl.cpp b/WebCore/platform/gdk/TransferJobCurl.cpp
new file mode 100644
index 0000000..c8271a9
--- /dev/null
+++ b/WebCore/platform/gdk/TransferJobCurl.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "TransferJob.h"
+
+#include "DocLoader.h"
+#include "TransferJobInternal.h"
+#include "TransferJobManager.h"
+
+namespace WebCore {
+
+TransferJobInternal::~TransferJobInternal()
+{
+}
+
+TransferJob::~TransferJob()
+{
+ cancel();
+}
+
+bool TransferJob::start(DocLoader* docLoader)
+{
+ TransferJobManager::get()->add(this);
+ return true;
+}
+
+void TransferJob::cancel()
+{
+ TransferJobManager::get()->cancel(this);
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/gdk/TransferJobManager.cpp b/WebCore/platform/gdk/TransferJobManager.cpp
new file mode 100644
index 0000000..18e4527
--- /dev/null
+++ b/WebCore/platform/gdk/TransferJobManager.cpp
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "TransferJobManager.h"
+
+#include "TransferJob.h"
+#include "TransferJobInternal.h"
+
+namespace WebCore {
+
+const int selectTimeoutMS = 5;
+const double pollTimeSeconds = 0.05;
+
+TransferJobManager::TransferJobManager()
+ : m_useSimple(false)
+ , jobs(new HashSet<TransferJob*>)
+ , m_downloadTimer(this, &TransferJobManager::downloadTimerCallback)
+{
+ curl_global_init(CURL_GLOBAL_ALL);
+ curlMultiHandle = curl_multi_init();
+}
+
+TransferJobManager* TransferJobManager::get()
+{
+ static TransferJobManager* singleton;
+ if (!singleton)
+ singleton = new TransferJobManager;
+ return singleton;
+}
+
+void TransferJobManager::useSimpleTransfer(bool useSimple)
+{
+ m_useSimple = useSimple;
+}
+
+static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* obj)
+{
+ TransferJob* job = static_cast<TransferJob*>(obj);
+ TransferJobInternal* d = job->getInternal();
+ int totalSize = size * nmemb;
+ d->client->receivedData(job, static_cat<char*>ptr, totalSize);
+ return totalSize;
+}
+
+static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data)
+{
+ int totalSize = size * nmemb;
+ return totalSize;
+}
+
+void TransferJobManager::downloadTimerCallback(Timer<TransferJobManager>* timer)
+{
+ if (jobs->isEmpty()) {
+ m_downloadTimer.stop();
+ return;
+ }
+
+ if (m_useSimple) {
+ for (HashSet<TransferJob*>::iterator it = jobs->begin(); it != jobs->end(); ++it) {
+ TransferJob* job = *it;
+ TransferJobInternal* d = job->getInternal();
+ CURLcode res = curl_easy_perform(d->m_handle);
+ if (res != CURLE_OK)
+ printf("Error WITH JOB %d\n", res);
+ d->client->receivedAllData(job, 0);
+ d->client->receivedAllData(job);
+ curl_easy_cleanup(d->m_handle);
+ d->m_handle = 0;
+ }
+ jobs->clear();
+ m_downloadTimer.stop();
+ } else {
+ FD_ZERO(&fdread);
+ FD_ZERO(&fdwrite);
+ FD_ZERO(&fdexcep);
+ curl_multi_fdset(curlMultiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);
+ int nrunning;
+ struct timeval timeout;
+ int retval;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = selectTimeoutMS * 1000; // select waits microseconds
+ retval = ::select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
+ switch (retval) {
+ case -1: // select error
+#ifndef NDEBUG
+ printf("%s, select error(?)\n", __PRETTY_FUNCTION__);
+#endif
+ /* fallthrough*/
+ case 0: // select timeout
+ printf("%s, select timout\n", __PRETTY_FUNCTION__);
+ /* fallthrough. this can be the first perform to be made */
+ default: // 1+ descriptors have data
+ while (CURLM_CALL_MULTI_PERFORM == curl_multi_perform(curlMultiHandle, &nrunning))
+ { }
+ }
+
+ // check the curl messages indicating completed transfers
+ // and free their resources
+ TransferJob* job;
+ int nmsgs;
+ while (CURLMsg* msg = curl_multi_info_read(curlMultiHandle, &nmsgs)) {
+ if (msg->msg == CURLMSG_DONE) {
+ // find the node which has same d->m_handle as completed transfer
+ CURL* chandle = msg->easy_handle;
+ assert(chandle);
+ TransferJob *job;
+ curl_easy_getinfo(chandle, CURLINFO_PRIVATE, &job);
+ assert(job); //fixme: assert->if ?
+ // if found, delete it
+ if (job) {
+ TransferJobInternal *d = job->getInternal();
+ switch (msg->data.result) {
+ case CURLE_OK: {
+ // use this to authenticate
+ int respCode = -1;
+ curl_easy_getinfo(d->m_handle, CURLINFO_RESPONSE_CODE, &respCode);
+ remove(job);
+ break;
+ }
+ default:
+ printf("Curl ERROR %s\n", curl_easy_strerror(msg->data.result));
+ job->setError(msg->data.result);
+ remove(job);
+ break;
+ }
+ } else {
+ printf("CurlRequest not found, eventhough curl d->m_handle finished\n");
+ assert(0);
+ }
+ }
+
+ if (!jobs->isEmpty())
+ m_downloadTimer.startOneShot(pollTimeSeconds);
+ }
+ }
+}
+
+void TransferJobManager::remove(TransferJob* job)
+{
+ TransferJobInternal* d = job->getInternal();
+ if (!d->m_handle)
+ return;
+ if (jobs->contains(job))
+ jobs->remove(job);
+ if (jobs->isEmpty())
+ m_downloadTimer.stop();
+ d->client->receivedAllData(job, 0);
+ d->client->receivedAllData(job);
+ if (d->m_handle) {
+ curl_multi_remove_handle(curlMultiHandle, d->m_handle);
+ curl_easy_cleanup(d->m_handle);
+ d->m_handle = NULL;
+ }
+}
+
+void TransferJobManager::add(TransferJob* job)
+{
+ bool startTimer = jobs->isEmpty();
+ TransferJobInternal* d = job->getInternal();
+ DeprecatedString url = d->URL.url();
+ d->m_handle = curl_easy_init();
+ curl_easy_setopt(d->m_handle, CURLOPT_PRIVATE, job);
+ curl_easy_setopt(d->m_handle, CURLOPT_ERRORBUFFER, error_buffer);
+ curl_easy_setopt(d->m_handle, CURLOPT_WRITEFUNCTION, writeCallback);
+ curl_easy_setopt(d->m_handle, CURLOPT_WRITEDATA, job);
+ curl_easy_setopt(d->m_handle, CURLOPT_HEADERFUNCTION, headerCallback);
+ curl_easy_setopt(d->m_handle, CURLOPT_WRITEHEADER, job);
+ curl_easy_setopt(d->m_handle, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(d->m_handle, CURLOPT_MAXREDIRS, 10);
+ curl_easy_setopt(d->m_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ // url ptr must remain valid through the request
+ curl_easy_setopt(d->m_handle, CURLOPT_URL, url.ascii());
+
+ if (m_useSimple)
+ jobs->add(job);
+ else {
+ CURLMcode ret = curl_multi_add_handle(curlMultiHandle, d->m_handle);
+ // don't call perform, because events must be async
+ // timeout will occur and do curl_multi_perform
+ if (ret && ret != CURLM_CALL_MULTI_PERFORM) {
+ printf("Error %d starting job %s\n", ret, d->URL.url().ascii());
+ cancel(job);
+ } else
+ jobs->add(job);
+ }
+ if (!jobs->isEmpty())
+ m_downloadTimer.startOneShot(pollTimeSeconds);
+}
+
+void TransferJobManager::cancel(TransferJob* job)
+{
+ remove(job);
+ job->setError(1);
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/gdk/TransferJobManager.h b/WebCore/platform/gdk/TransferJobManager.h
new file mode 100644
index 0000000..e607a2e
--- /dev/null
+++ b/WebCore/platform/gdk/TransferJobManager.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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 TransferJobManager_H_
+#define TransferJobManager_H_
+
+#include "Frame.h"
+#include "Timer.h"
+#include "TransferJobClient.h"
+#include <curl/curl.h>
+
+namespace WebCore {
+
+class TransferJobManager {
+public:
+ static TransferJobManager* get();
+ void add(TransferJob*);
+ void cancel(TransferJob*);
+
+ // If true, don't multiplex downloads: download completely one at a time.
+ void useSimpleTransfer(bool useSimple);
+
+private:
+ TransferJobManager();
+ void downloadTimerCallback(Timer<TransferJobManager>*);
+ void remove(TransferJob*);
+
+ bool m_useSimple;
+ HashSet<TransferJob*>* jobs;
+ Timer<TransferJobManager> m_downloadTimer;
+ CURLM* curlMultiHandle; // not freed
+
+ // curl filehandles to poll with select
+ fd_set fdread;
+ fd_set fdwrite;
+ fd_set fdexcep;
+
+ int maxfd;
+ char error_buffer[CURL_ERROR_SIZE];
+
+ // NULL-terminated list of supported protocols
+ const char* const* curl_protocols; // not freed
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/gdk/WheelEventGdk.cpp b/WebCore/platform/gdk/WheelEventGdk.cpp
new file mode 100644
index 0000000..f280553
--- /dev/null
+++ b/WebCore/platform/gdk/WheelEventGdk.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "PlatformWheelEvent.h"
+
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+PlatformWheelEvent::PlatformWheelEvent(GdkEvent* event)
+{
+ if (event->scroll.direction == GDK_SCROLL_UP) {
+ m_delta = -120;
+ m_isHorizontal = false;
+ } else if (event->scroll.direction == GDK_SCROLL_LEFT) {
+ m_delta = -120;
+ m_isHorizontal = true;
+ } else if (event->scroll.direction == GDK_SCROLL_RIGHT) {
+ m_delta = 120;
+ m_isHorizontal = true;
+ } else {
+ m_delta = 120;
+ m_isHorizontal = false;
+ }
+
+ m_position = IntPoint((int)event->scroll.x, (int)event->scroll.y);
+ m_globalPosition = IntPoint((int)event->scroll.x_root, (int)event->scroll.y_root);
+ m_isAccepted = false;
+ m_shiftKey = event->button.state & GDK_SHIFT_MASK;
+ m_ctrlKey = event->button.state & GDK_CONTROL_MASK;
+ m_altKey = event->button.state & GDK_MOD1_MASK;
+ m_metaKey = event->button.state & GDK_MOD2_MASK;
+}
+
+}
diff --git a/WebCore/platform/gdk/WidgetGdk.cpp b/WebCore/platform/gdk/WidgetGdk.cpp
new file mode 100644
index 0000000..97b6844
--- /dev/null
+++ b/WebCore/platform/gdk/WidgetGdk.cpp
@@ -0,0 +1,178 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include "config.h"
+#include "Widget.h"
+
+#include "Cursor.h"
+#include "Font.h"
+#include "FrameGdk.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "RenderObject.h"
+#include <gdk/gdk.h>
+
+namespace WebCore {
+
+class WidgetPrivate {
+public:
+ GdkDrawable* drawable;
+ WidgetClient* client;
+ IntRect geometry;
+ Font font;
+};
+
+Widget::Widget()
+ : data(new WidgetPrivate)
+{
+ data->drawable = 0;
+}
+
+Widget::Widget(GdkDrawable* drawable)
+ : data(new WidgetPrivate)
+{
+ setDrawable(drawable);
+}
+
+GdkDrawable* Widget::drawable() const
+{
+ return data->drawable;
+}
+
+void Widget::setDrawable(GdkDrawable* drawable)
+{
+ data->drawable = drawable;
+}
+
+Widget::~Widget()
+{
+ delete data;
+}
+
+void Widget::setClient(WidgetClient* c)
+{
+ data->client = c;
+}
+
+WidgetClient* Widget::client() const
+{
+ return data->client;
+}
+
+IntRect Widget::frameGeometry() const
+{
+ return data->geometry;
+}
+
+bool Widget::hasFocus() const
+{
+ return false;
+}
+
+void Widget::setFocus()
+{
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gdk_window_focus(window, GDK_CURRENT_TIME);
+}
+
+void Widget::clearFocus()
+{
+}
+
+const Font& Widget::font() const
+{
+ return data->font;
+}
+
+void Widget::setFont(const Font& font)
+{
+ data->font = font;
+}
+
+void Widget::setCursor(const Cursor& cursor)
+{
+ GdkCursor* pcur = cursor.impl();
+ if (!pcur)
+ return;
+
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gdk_window_set_cursor(window, pcur);
+
+}
+
+void Widget::show()
+{
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gdk_window_show(window);
+}
+
+void Widget::hide()
+{
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gdk_window_hide(window);
+}
+
+void Widget::setFrameGeometry(const IntRect& r)
+{
+ data->geometry = r;
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gdk_window_move_resize(window, r.x(), r.y(), r.width(), r.height());
+}
+
+IntPoint Widget::mapFromGlobal(const IntPoint& p) const
+{
+ GdkDrawable* drawable = data->drawable;
+ if (!drawable || !GDK_IS_WINDOW(drawable))
+ return p;
+ GdkWindow* window = GDK_WINDOW(drawable);
+ gint x, y;
+ gdk_window_get_origin(window, &x, &y);
+ return IntPoint(p.x() - x, p.y() - y);
+}
+
+float Widget::scaleFactor() const
+{
+ return 1.0f;
+
+}
+
+}
diff --git a/WebCore/platform/gdk/gdk-encodings.txt b/WebCore/platform/gdk/gdk-encodings.txt
new file mode 100644
index 0000000..0b9bfc7
--- /dev/null
+++ b/WebCore/platform/gdk/gdk-encodings.txt
@@ -0,0 +1,12 @@
+# The items on the left are names of TextEncodingID values
+# The items on the right are IANA character set names. Names listed in character-sets.txt are not
+# repeated here; mentioning any one character set from a group in there pulls in all the aliases in
+# that group.
+
+WinLatin1Encoding: windows-1252, winlatin1, xansi
+Latin1Encoding: ISO-8859-1, 88591
+ASCIIEncoding: US-ASCII, isoir6us
+UTF16Encoding: ISO-10646-UCS-2, ucs2, unicode, utf16
+UTF16Encoding, BigEndian: UTF-16BE, unicodefffe
+UTF16Encoding, LittleEndian: UTF-16LE, unicodefeff
+UTF8Encoding: UTF-8, unicode11utf8, unicode20utf8, xunicode20utf8