summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/qt
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:52 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:52 -0800
commit8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (patch)
tree11425ea0b299d6fb89c6d3618a22d97d5bf68d0f /WebCore/platform/qt
parent648161bb0edfc3d43db63caed5cc5213bc6cb78f (diff)
downloadexternal_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.zip
external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.gz
external_webkit-8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/platform/qt')
-rw-r--r--WebCore/platform/qt/ClipboardQt.cpp305
-rw-r--r--WebCore/platform/qt/ClipboardQt.h87
-rw-r--r--WebCore/platform/qt/ContextMenuItemQt.cpp117
-rw-r--r--WebCore/platform/qt/ContextMenuQt.cpp82
-rw-r--r--WebCore/platform/qt/CookieJarQt.cpp119
-rw-r--r--WebCore/platform/qt/CursorQt.cpp372
-rw-r--r--WebCore/platform/qt/DragDataQt.cpp142
-rw-r--r--WebCore/platform/qt/DragImageQt.cpp63
-rw-r--r--WebCore/platform/qt/EventLoopQt.cpp32
-rw-r--r--WebCore/platform/qt/FileChooserQt.cpp37
-rw-r--r--WebCore/platform/qt/FileSystemQt.cpp175
-rw-r--r--WebCore/platform/qt/KURLQt.cpp102
-rw-r--r--WebCore/platform/qt/KeyboardCodes.h553
-rw-r--r--WebCore/platform/qt/Localizations.cpp352
-rw-r--r--WebCore/platform/qt/LoggingQt.cpp90
-rw-r--r--WebCore/platform/qt/MIMETypeRegistryQt.cpp82
-rw-r--r--WebCore/platform/qt/MenuEventProxy.h54
-rw-r--r--WebCore/platform/qt/PasteboardQt.cpp172
-rw-r--r--WebCore/platform/qt/PlatformKeyboardEventQt.cpp478
-rw-r--r--WebCore/platform/qt/PlatformMouseEventQt.cpp94
-rw-r--r--WebCore/platform/qt/PlatformScreenQt.cpp77
-rw-r--r--WebCore/platform/qt/PopupMenuQt.cpp122
-rw-r--r--WebCore/platform/qt/QWebPopup.cpp73
-rw-r--r--WebCore/platform/qt/QWebPopup.h49
-rw-r--r--WebCore/platform/qt/RenderThemeQt.cpp947
-rw-r--r--WebCore/platform/qt/RenderThemeQt.h174
-rw-r--r--WebCore/platform/qt/ScreenQt.cpp99
-rw-r--r--WebCore/platform/qt/ScrollViewQt.cpp62
-rw-r--r--WebCore/platform/qt/ScrollbarQt.cpp95
-rw-r--r--WebCore/platform/qt/ScrollbarThemeQt.cpp244
-rw-r--r--WebCore/platform/qt/ScrollbarThemeQt.h55
-rw-r--r--WebCore/platform/qt/SearchPopupMenuQt.cpp45
-rw-r--r--WebCore/platform/qt/SharedBufferQt.cpp52
-rw-r--r--WebCore/platform/qt/SharedTimerQt.cpp58
-rw-r--r--WebCore/platform/qt/SharedTimerQt.h91
-rw-r--r--WebCore/platform/qt/SoundQt.cpp43
-rw-r--r--WebCore/platform/qt/SystemTimeQt.cpp46
-rw-r--r--WebCore/platform/qt/TemporaryLinkStubs.cpp117
-rw-r--r--WebCore/platform/qt/WebCoreResources.qrc5
-rw-r--r--WebCore/platform/qt/WheelEventQt.cpp59
-rw-r--r--WebCore/platform/qt/WidgetQt.cpp112
-rw-r--r--WebCore/platform/qt/html4-adjustments-qt.css96
42 files changed, 6229 insertions, 0 deletions
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp
new file mode 100644
index 0000000..b0a1402
--- /dev/null
+++ b/WebCore/platform/qt/ClipboardQt.cpp
@@ -0,0 +1,305 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "ClipboardQt.h"
+
+#include "CachedImage.h"
+#include "CSSHelper.h"
+#include "Document.h"
+#include "Element.h"
+#include "Frame.h"
+#include "HTMLNames.h"
+#include "Image.h"
+#include "IntPoint.h"
+#include "KURL.h"
+#include "markup.h"
+#include "PlatformString.h"
+#include "Range.h"
+#include "RenderImage.h"
+#include "StringHash.h"
+#include <QList>
+#include <QMimeData>
+#include <QStringList>
+#include <QUrl>
+#include <QApplication>
+#include <QClipboard>
+#include <qdebug.h>
+
+#define methodDebug() qDebug("ClipboardQt: %s", __FUNCTION__)
+
+namespace WebCore {
+
+ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, const QMimeData* readableClipboard)
+ : Clipboard(policy, true)
+ , m_readableData(readableClipboard)
+ , m_writableData(0)
+{
+ Q_ASSERT(policy == ClipboardReadable || policy == ClipboardTypesReadable);
+}
+
+ClipboardQt::ClipboardQt(ClipboardAccessPolicy policy, bool forDragging)
+ : Clipboard(policy, forDragging)
+ , m_readableData(0)
+ , m_writableData(0)
+{
+ Q_ASSERT(policy == ClipboardReadable || policy == ClipboardWritable || policy == ClipboardNumb);
+
+#ifndef QT_NO_CLIPBOARD
+ if (policy != ClipboardWritable) {
+ Q_ASSERT(!forDragging);
+ m_readableData = QApplication::clipboard()->mimeData();
+ }
+#endif
+}
+
+ClipboardQt::~ClipboardQt()
+{
+ if (m_writableData && !isForDragging())
+ m_writableData = 0;
+ else
+ delete m_writableData;
+ m_readableData = 0;
+}
+
+void ClipboardQt::clearData(const String& type)
+{
+ if (policy() != ClipboardWritable)
+ return;
+
+ if (m_writableData) {
+#if QT_VERSION >= 0x040400
+ m_writableData->removeFormat(type);
+#else
+ const QString toClearType = type;
+ QMap<QString, QByteArray> formats;
+ foreach (QString format, m_writableData->formats()) {
+ if (format != toClearType)
+ formats[format] = m_writableData->data(format);
+ }
+
+ m_writableData->clear();
+ QMap<QString, QByteArray>::const_iterator it, end = formats.constEnd();
+ for (it = formats.begin(); it != end; ++it)
+ m_writableData->setData(it.key(), it.value());
+#endif
+ if (m_writableData->formats().isEmpty()) {
+ if (isForDragging())
+ delete m_writableData;
+ m_writableData = 0;
+ }
+ }
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+}
+
+void ClipboardQt::clearAllData()
+{
+ if (policy() != ClipboardWritable)
+ return;
+
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(0);
+ else
+#endif
+ delete m_writableData;
+ m_writableData = 0;
+}
+
+String ClipboardQt::getData(const String& type, bool& success) const
+{
+
+ if (policy() != ClipboardReadable) {
+ success = false;
+ return String();
+ }
+
+ ASSERT(m_readableData);
+ QByteArray data = m_readableData->data(QString(type));
+ success = !data.isEmpty();
+ return String(data.data(), data.size());
+}
+
+bool ClipboardQt::setData(const String& type, const String& data)
+{
+ if (policy() != ClipboardWritable)
+ return false;
+
+ if (!m_writableData)
+ m_writableData = new QMimeData;
+ QByteArray array(reinterpret_cast<const char*>(data.characters()),
+ data.length()*2);
+ m_writableData->setData(QString(type), array);
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+ return true;
+}
+
+// extensions beyond IE's API
+HashSet<String> ClipboardQt::types() const
+{
+ if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
+ return HashSet<String>();
+
+ ASSERT(m_readableData);
+ HashSet<String> result;
+ QStringList formats = m_readableData->formats();
+ for (int i = 0; i < formats.count(); ++i)
+ result.add(formats.at(i));
+ return result;
+}
+
+void ClipboardQt::setDragImage(CachedImage* image, const IntPoint& point)
+{
+ setDragImage(image, 0, point);
+}
+
+void ClipboardQt::setDragImageElement(Node* node, const IntPoint& point)
+{
+ setDragImage(0, node, point);
+}
+
+void ClipboardQt::setDragImage(CachedImage* image, Node *node, const IntPoint &loc)
+{
+ if (policy() != ClipboardImageWritable && policy() != ClipboardWritable)
+ return;
+
+ if (m_dragImage)
+ m_dragImage->removeClient(this);
+ m_dragImage = image;
+ if (m_dragImage)
+ m_dragImage->addClient(this);
+
+ m_dragLoc = loc;
+ m_dragImageElement = node;
+}
+
+DragImageRef ClipboardQt::createDragImage(IntPoint& dragLoc) const
+{
+ if (!m_dragImage)
+ return 0;
+ dragLoc = m_dragLoc;
+ return m_dragImage->image()->nativeImageForCurrentFrame();
+}
+
+
+static CachedImage* getCachedImage(Element* element)
+{
+ // Attempt to pull CachedImage from element
+ ASSERT(element);
+ RenderObject* renderer = element->renderer();
+ if (!renderer || !renderer->isImage())
+ return 0;
+
+ RenderImage* image = static_cast<RenderImage*>(renderer);
+ if (image->cachedImage() && !image->cachedImage()->errorOccurred())
+ return image->cachedImage();
+
+ return 0;
+}
+
+void ClipboardQt::declareAndWriteDragImage(Element* element, const KURL& url, const String& title, Frame* frame)
+{
+ ASSERT(frame);
+ Q_UNUSED(url);
+ Q_UNUSED(title);
+
+ //WebCore::writeURL(m_writableDataObject.get(), url, title, true, false);
+ if (!m_writableData)
+ m_writableData = new QMimeData;
+
+ CachedImage* cachedImage = getCachedImage(element);
+ if (!cachedImage || !cachedImage->image() || !cachedImage->isLoaded())
+ return;
+ QPixmap *pixmap = cachedImage->image()->nativeImageForCurrentFrame();
+ if (pixmap)
+ m_writableData->setImageData(pixmap);
+
+ AtomicString imageURL = element->getAttribute(HTMLNames::srcAttr);
+ if (imageURL.isEmpty())
+ return;
+
+ KURL fullURL = frame->document()->completeURL(parseURL(imageURL));
+ if (fullURL.isEmpty())
+ return;
+
+ QList<QUrl> urls;
+ urls.append(fullURL);
+
+ m_writableData->setUrls(urls);
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+}
+
+void ClipboardQt::writeURL(const KURL& url, const String&, Frame* frame)
+{
+ ASSERT(frame);
+
+ QList<QUrl> urls;
+ urls.append(frame->document()->completeURL(url.string()));
+ if (!m_writableData)
+ m_writableData = new QMimeData;
+ m_writableData->setUrls(urls);
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+}
+
+void ClipboardQt::writeRange(Range* range, Frame* frame)
+{
+ ASSERT(range);
+ ASSERT(frame);
+
+ if (!m_writableData)
+ m_writableData = new QMimeData;
+ QString text = frame->selectedText();
+ text.replace(QChar(0xa0), QLatin1Char(' '));
+ m_writableData->setText(text);
+ m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange));
+#ifndef QT_NO_CLIPBOARD
+ if (!isForDragging())
+ QApplication::clipboard()->setMimeData(m_writableData);
+#endif
+}
+
+bool ClipboardQt::hasData()
+{
+ const QMimeData *data = m_readableData ? m_readableData : m_writableData;
+ if (!data)
+ return false;
+ return data->formats().count() > 0;
+}
+
+}
diff --git a/WebCore/platform/qt/ClipboardQt.h b/WebCore/platform/qt/ClipboardQt.h
new file mode 100644
index 0000000..caf040f
--- /dev/null
+++ b/WebCore/platform/qt/ClipboardQt.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. 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 ClipboardQt_h
+#define ClipboardQt_h
+
+#include "Clipboard.h"
+#include "CachedResourceClient.h"
+
+QT_BEGIN_NAMESPACE
+class QMimeData;
+QT_END_NAMESPACE
+
+namespace WebCore {
+
+ class CachedImage;
+
+ // State available during IE's events for drag and drop and copy/paste
+ class ClipboardQt : public Clipboard, public CachedResourceClient {
+ public:
+ static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, const QMimeData* readableClipboard)
+ {
+ return adoptRef(new ClipboardQt(policy, readableClipboard));
+ }
+ static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, bool forDragging = false)
+ {
+ return adoptRef(new ClipboardQt(policy, forDragging));
+ }
+ virtual ~ClipboardQt();
+
+ void clearData(const String& type);
+ void clearAllData();
+ String getData(const String& type, bool& success) const;
+ bool setData(const String& type, const String& data);
+
+ // extensions beyond IE's API
+ HashSet<String> types() const;
+
+ void setDragImage(CachedImage*, const IntPoint&);
+ void setDragImageElement(Node*, const IntPoint&);
+
+ virtual DragImageRef createDragImage(IntPoint& dragLoc) const;
+ virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*);
+ virtual void writeURL(const KURL&, const String&, Frame*);
+ virtual void writeRange(Range*, Frame*);
+
+ virtual bool hasData();
+
+ QMimeData* clipboardData() const { return m_writableData; }
+ void invalidateWritableData() { m_writableData = 0; }
+
+ private:
+ ClipboardQt(ClipboardAccessPolicy, const QMimeData* readableClipboard);
+
+ // Clipboard is writable so it will create its own QMimeData object
+ ClipboardQt(ClipboardAccessPolicy, bool forDragging);
+
+ void setDragImage(CachedImage*, Node*, const IntPoint& loc);
+
+ const QMimeData* m_readableData;
+ QMimeData* m_writableData;
+ };
+}
+
+#endif // ClipboardQt_h
diff --git a/WebCore/platform/qt/ContextMenuItemQt.cpp b/WebCore/platform/qt/ContextMenuItemQt.cpp
new file mode 100644
index 0000000..c71eacd
--- /dev/null
+++ b/WebCore/platform/qt/ContextMenuItemQt.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ *
+ * 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 "ContextMenuItem.h"
+#include "ContextMenu.h"
+
+namespace WebCore {
+
+ContextMenuItem::ContextMenuItem(ContextMenu* subMenu)
+{
+ m_platformDescription.type = SubmenuType;
+ m_platformDescription.action = ContextMenuItemTagNoAction;
+ if (subMenu)
+ setSubMenu(subMenu);
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action,
+ const String& title, ContextMenu* subMenu)
+{
+ m_platformDescription.type = type;
+ m_platformDescription.action = action;
+ m_platformDescription.title = title;
+ if (subMenu)
+ setSubMenu(subMenu);
+}
+
+ContextMenuItem::~ContextMenuItem()
+{
+}
+
+PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription()
+{
+ return m_platformDescription;
+}
+
+ContextMenuItemType ContextMenuItem::type() const
+{
+ return m_platformDescription.type;
+}
+
+void ContextMenuItem::setType(ContextMenuItemType type)
+{
+ m_platformDescription.type = type;
+}
+
+ContextMenuAction ContextMenuItem::action() const
+{
+ return m_platformDescription.action;
+}
+
+void ContextMenuItem::setAction(ContextMenuAction action)
+{
+ m_platformDescription.action = action;
+}
+
+String ContextMenuItem::title() const
+{
+ return m_platformDescription.title;
+}
+
+void ContextMenuItem::setTitle(const String& title)
+{
+ m_platformDescription.title = title;
+}
+
+
+PlatformMenuDescription ContextMenuItem::platformSubMenu() const
+{
+ return &m_platformDescription.subMenuItems;
+}
+
+void ContextMenuItem::setSubMenu(ContextMenu* menu)
+{
+ m_platformDescription.subMenuItems = *menu->platformDescription();
+}
+
+void ContextMenuItem::setChecked(bool on)
+{
+ m_platformDescription.checked = on;
+}
+
+void ContextMenuItem::setEnabled(bool on)
+{
+ m_platformDescription.enabled = on;
+}
+
+bool ContextMenuItem::enabled() const
+{
+ return m_platformDescription.enabled;
+}
+
+}
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ContextMenuQt.cpp b/WebCore/platform/qt/ContextMenuQt.cpp
new file mode 100644
index 0000000..3e093b1
--- /dev/null
+++ b/WebCore/platform/qt/ContextMenuQt.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ *
+ * 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 "ContextMenu.h"
+#include "MenuEventProxy.h"
+
+#include <wtf/Assertions.h>
+
+#include <QAction>
+
+#include <Document.h>
+#include <Frame.h>
+#include <FrameView.h>
+
+namespace WebCore {
+
+ContextMenu::ContextMenu(const HitTestResult& result)
+ : m_hitTestResult(result)
+{
+}
+
+ContextMenu::~ContextMenu()
+{
+}
+
+void ContextMenu::appendItem(ContextMenuItem& item)
+{
+ m_items.append(item);
+}
+
+unsigned ContextMenu::itemCount() const
+{
+ return m_items.count();
+}
+
+void ContextMenu::insertItem(unsigned position, ContextMenuItem& item)
+{
+ m_items.insert(position, item);
+}
+
+void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
+{
+ // doesn't make sense
+}
+
+PlatformMenuDescription ContextMenu::platformDescription() const
+{
+ return &m_items;
+}
+
+PlatformMenuDescription ContextMenu::releasePlatformDescription()
+{
+ return PlatformMenuDescription();
+}
+
+
+}
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp
new file mode 100644
index 0000000..43be75a
--- /dev/null
+++ b/WebCore/platform/qt/CookieJarQt.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *
+ * 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 "KURL.h"
+#include "PlatformString.h"
+
+#if QT_VERSION >= 0x040400
+#include "Document.h"
+#include "qwebpage.h"
+#include "qwebframe.h"
+#include "FrameLoaderClientQt.h"
+#include <QNetworkAccessManager>
+#include <QNetworkCookie>
+#else
+#include <qcookiejar.h>
+#endif
+
+namespace WebCore {
+
+#if QT_VERSION >= 0x040400
+static QNetworkCookieJar *cookieJar(const Document *document)
+{
+ Frame *frame = document->frame();
+ if (!frame)
+ return 0;
+ FrameLoader *loader = frame->loader();
+ if (!loader)
+ return 0;
+ QWebFrame* webFrame = static_cast<FrameLoaderClientQt*>(loader->client())->webFrame();
+ QWebPage* page = webFrame->page();
+ QNetworkAccessManager* manager = page->networkAccessManager();
+ QNetworkCookieJar* jar = manager->cookieJar();
+ return jar;
+}
+#endif
+
+void setCookies(Document* document, const KURL& url, const KURL& policyURL, const String& value)
+{
+ QUrl u(url);
+ QUrl p(policyURL);
+#if QT_VERSION >= 0x040400
+ QNetworkCookieJar* jar = cookieJar(document);
+ if (!jar)
+ return;
+
+ QList<QNetworkCookie> cookies = QNetworkCookie::parseCookies(QString(value).toAscii());
+ jar->setCookiesFromUrl(cookies, p);
+#else
+ QCookieJar::cookieJar()->setCookies(u, p, (QString)value);
+#endif
+}
+
+String cookies(const Document* document, const KURL& url)
+{
+ QUrl u(url);
+#if QT_VERSION >= 0x040400
+ QNetworkCookieJar* jar = cookieJar(document);
+ if (!jar)
+ return String();
+
+ QList<QNetworkCookie> cookies = jar->cookiesForUrl(u);
+ if (cookies.isEmpty())
+ return String();
+
+ QStringList resultCookies;
+ foreach (QNetworkCookie networkCookie, cookies)
+ resultCookies.append(QString::fromAscii(
+ networkCookie.toRawForm(QNetworkCookie::NameAndValueOnly).constData()));
+
+ return resultCookies.join(QLatin1String("; "));
+#else
+ QString cookies = QCookieJar::cookieJar()->cookies(u);
+ int idx = cookies.indexOf(QLatin1Char(';'));
+ if (idx > 0)
+ cookies = cookies.left(idx);
+ return cookies;
+#endif
+}
+
+bool cookiesEnabled(const Document* document)
+{
+#if QT_VERSION >= 0x040400
+ QNetworkCookieJar* jar = cookieJar(document);
+ return (jar != 0);
+#else
+ return QCookieJar::cookieJar()->isEnabled();
+#endif
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/CursorQt.cpp b/WebCore/platform/qt/CursorQt.cpp
new file mode 100644
index 0000000..0d7e100
--- /dev/null
+++ b/WebCore/platform/qt/CursorQt.cpp
@@ -0,0 +1,372 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Charles Samuels <charles@kde.org>
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ *
+ * 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 "Image.h"
+#include "IntPoint.h"
+
+#include "NotImplemented.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#undef CopyCursor
+
+namespace WebCore {
+
+Cursor::Cursor(PlatformCursor p)
+ : m_impl(p)
+{
+}
+
+Cursor::Cursor(const Cursor& other)
+ : m_impl(other.m_impl)
+{
+}
+
+Cursor::~Cursor()
+{
+}
+
+Cursor::Cursor(Image* image, const IntPoint& hotspot)
+#ifndef QT_NO_CURSOR
+ : m_impl(*(image->nativeImageForCurrentFrame()), hotspot.x(), hotspot.y())
+#endif
+{
+}
+
+Cursor& Cursor::operator=(const Cursor& other)
+{
+ m_impl = other.m_impl;
+ return *this;
+}
+
+namespace {
+
+// FIXME: static deleter
+class Cursors {
+protected:
+ Cursors()
+#ifndef QT_NO_CURSOR
+ : CrossCursor(Qt::CrossCursor)
+ , MoveCursor(Qt::SizeAllCursor)
+ , PointerCursor(Qt::ArrowCursor)
+ , PointingHandCursor(Qt::PointingHandCursor)
+ , IBeamCursor(Qt::IBeamCursor)
+ , WaitCursor(Qt::WaitCursor)
+ , WhatsThisCursor(Qt::WhatsThisCursor)
+ , SizeHorCursor(Qt::SizeHorCursor)
+ , SizeVerCursor(Qt::SizeVerCursor)
+ , SizeFDiagCursor(Qt::SizeFDiagCursor)
+ , SizeBDiagCursor(Qt::SizeBDiagCursor)
+ , SplitHCursor(Qt::SplitHCursor)
+ , SplitVCursor(Qt::SplitVCursor)
+ , NoDropCursor(Qt::ForbiddenCursor)
+ , BlankCursor(Qt::BlankCursor)
+ , ZoomInCursor(QPixmap(QLatin1String(":/webkit/resources/zoomInCursor.png")))
+ , ZoomOutCursor(QPixmap(QLatin1String(":/webkit/resources/zoomOutCursor.png")))
+ , VerticalTextCursor(QPixmap(QLatin1String(":/webkit/resources/verticalTextCursor.png")))
+ , CellCursor(QPixmap(QLatin1String(":/webkit/resources/cellCursor.png")))
+ , ContextMenuCursor(QPixmap(QLatin1String(":/webkit/resources/contextMenuCursor.png")))
+ , CopyCursor(QPixmap(QLatin1String(":/webkit/resources/copyCursor.png")))
+ , ProgressCursor(QPixmap(QLatin1String(":/webkit/resources/progressCursor.png")))
+ , AliasCursor(QPixmap(QLatin1String(":/webkit/resources/aliasCursor.png")))
+
+#endif
+ {
+ }
+
+ ~Cursors()
+ {
+ }
+
+public:
+ static Cursors* self();
+ static Cursors* s_self;
+
+ Cursor CrossCursor;
+ Cursor MoveCursor;
+ Cursor PointerCursor;
+ Cursor PointingHandCursor;
+ Cursor IBeamCursor;
+ Cursor WaitCursor;
+ Cursor WhatsThisCursor;
+ Cursor SizeHorCursor;
+ Cursor SizeVerCursor;
+ Cursor SizeFDiagCursor;
+ Cursor SizeBDiagCursor;
+ Cursor SplitHCursor;
+ Cursor SplitVCursor;
+ Cursor NoDropCursor;
+ Cursor BlankCursor;
+ Cursor ZoomInCursor;
+ Cursor ZoomOutCursor;
+ Cursor VerticalTextCursor;
+ Cursor CellCursor;
+ Cursor ContextMenuCursor;
+ Cursor CopyCursor;
+ Cursor ProgressCursor;
+ Cursor AliasCursor;
+};
+
+Cursors* Cursors::s_self = 0;
+
+Cursors* Cursors::self()
+{
+ if (!s_self)
+ s_self = new Cursors();
+
+ return s_self;
+}
+
+}
+
+const Cursor& pointerCursor()
+{
+ return Cursors::self()->PointerCursor;
+}
+
+const Cursor& moveCursor()
+{
+ return Cursors::self()->MoveCursor;
+}
+
+const Cursor& crossCursor()
+{
+ return Cursors::self()->CrossCursor;
+}
+
+const Cursor& handCursor()
+{
+ return Cursors::self()->PointingHandCursor;
+}
+
+const Cursor& iBeamCursor()
+{
+ return Cursors::self()->IBeamCursor;
+}
+
+const Cursor& waitCursor()
+{
+ return Cursors::self()->WaitCursor;
+}
+
+const Cursor& helpCursor()
+{
+ return Cursors::self()->WhatsThisCursor;
+}
+
+const Cursor& eastResizeCursor()
+{
+ return Cursors::self()->SizeHorCursor;
+}
+
+const Cursor& northResizeCursor()
+{
+ return Cursors::self()->SizeVerCursor;
+}
+
+const Cursor& northEastResizeCursor()
+{
+ return Cursors::self()->SizeBDiagCursor;
+}
+
+const Cursor& northWestResizeCursor()
+{
+ return Cursors::self()->SizeFDiagCursor;
+}
+
+const Cursor& southResizeCursor()
+{
+ return Cursors::self()->SizeVerCursor;
+}
+
+const Cursor& southEastResizeCursor()
+{
+ return Cursors::self()->SizeFDiagCursor;
+}
+
+const Cursor& southWestResizeCursor()
+{
+ return Cursors::self()->SizeBDiagCursor;
+}
+
+const Cursor& westResizeCursor()
+{
+ return Cursors::self()->SizeHorCursor;
+}
+
+const Cursor& northSouthResizeCursor()
+{
+ return Cursors::self()->SizeVerCursor;
+}
+
+const Cursor& eastWestResizeCursor()
+{
+ return Cursors::self()->SizeHorCursor;
+}
+
+const Cursor& northEastSouthWestResizeCursor()
+{
+ return Cursors::self()->SizeBDiagCursor;
+}
+
+const Cursor& northWestSouthEastResizeCursor()
+{
+ return Cursors::self()->SizeFDiagCursor;
+}
+
+const Cursor& columnResizeCursor()
+{
+ return Cursors::self()->SplitHCursor;
+}
+
+const Cursor& rowResizeCursor()
+{
+ return Cursors::self()->SplitVCursor;
+}
+
+const Cursor& middlePanningCursor()
+{
+ return moveCursor();
+}
+
+const Cursor& eastPanningCursor()
+{
+ return eastResizeCursor();
+}
+
+const Cursor& northPanningCursor()
+{
+ return northResizeCursor();
+}
+
+const Cursor& northEastPanningCursor()
+{
+ return northEastResizeCursor();
+}
+
+const Cursor& northWestPanningCursor()
+{
+ return northWestResizeCursor();
+}
+
+const Cursor& southPanningCursor()
+{
+ return southResizeCursor();
+}
+
+const Cursor& southEastPanningCursor()
+{
+ return southEastResizeCursor();
+}
+
+const Cursor& southWestPanningCursor()
+{
+ return southWestResizeCursor();
+}
+
+const Cursor& westPanningCursor()
+{
+ return westResizeCursor();
+}
+
+const Cursor& verticalTextCursor()
+{
+ return Cursors::self()->VerticalTextCursor;
+}
+
+const Cursor& cellCursor()
+{
+ return Cursors::self()->CellCursor;
+}
+
+const Cursor& contextMenuCursor()
+{
+ return Cursors::self()->ContextMenuCursor;
+}
+
+const Cursor& noDropCursor()
+{
+ return Cursors::self()->NoDropCursor;
+}
+
+const Cursor& copyCursor()
+{
+ return Cursors::self()->CopyCursor;
+}
+
+const Cursor& progressCursor()
+{
+ return Cursors::self()->ProgressCursor;
+}
+
+const Cursor& aliasCursor()
+{
+ return Cursors::self()->AliasCursor;
+}
+
+const Cursor& noneCursor()
+{
+ return Cursors::self()->BlankCursor;
+}
+
+const Cursor& notAllowedCursor()
+{
+ return Cursors::self()->NoDropCursor;
+}
+
+const Cursor& zoomInCursor()
+{
+ return Cursors::self()->ZoomInCursor;
+}
+
+const Cursor& zoomOutCursor()
+{
+ return Cursors::self()->ZoomOutCursor;
+}
+
+const Cursor& grabCursor()
+{
+ notImplemented();
+ return Cursors::self()->PointerCursor;
+}
+
+const Cursor& grabbingCursor()
+{
+ notImplemented();
+ return Cursors::self()->PointerCursor;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/DragDataQt.cpp b/WebCore/platform/qt/DragDataQt.cpp
new file mode 100644
index 0000000..9d95373
--- /dev/null
+++ b/WebCore/platform/qt/DragDataQt.cpp
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. 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 "DragData.h"
+
+#include "ClipboardQt.h"
+#include "Document.h"
+#include "DocumentFragment.h"
+#include "markup.h"
+#include "NotImplemented.h"
+
+#include <QList>
+#include <QMimeData>
+#include <QUrl>
+#include <QColor>
+
+namespace WebCore {
+
+bool DragData::canSmartReplace() const
+{
+ return false;
+}
+
+bool DragData::containsColor() const
+{
+ if (!m_platformDragData)
+ return false;
+ return m_platformDragData->hasColor();
+}
+
+bool DragData::containsFiles() const
+{
+ if (!m_platformDragData)
+ return false;
+ QList<QUrl> urls = m_platformDragData->urls();
+ foreach(const QUrl &url, urls) {
+ if (!url.toLocalFile().isEmpty())
+ return true;
+ }
+ return false;
+}
+
+void DragData::asFilenames(Vector<String>& result) const
+{
+ if (!m_platformDragData)
+ return;
+ QList<QUrl> urls = m_platformDragData->urls();
+ foreach(const QUrl &url, urls) {
+ QString file = url.toLocalFile();
+ if (!file.isEmpty())
+ result.append(file);
+ }
+}
+
+bool DragData::containsPlainText() const
+{
+ if (!m_platformDragData)
+ return false;
+ return m_platformDragData->hasText() || m_platformDragData->hasUrls();
+}
+
+String DragData::asPlainText() const
+{
+ if (!m_platformDragData)
+ return String();
+ String text = m_platformDragData->text();
+ if (!text.isEmpty())
+ return text;
+
+ // FIXME: Should handle rich text here
+
+ return asURL(0);
+}
+
+Color DragData::asColor() const
+{
+ if (!m_platformDragData)
+ return Color();
+ return qvariant_cast<QColor>(m_platformDragData->colorData());
+}
+
+PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const
+{
+ return ClipboardQt::create(policy, m_platformDragData);
+}
+
+bool DragData::containsCompatibleContent() const
+{
+ if (!m_platformDragData)
+ return false;
+ return containsColor() || containsURL() || m_platformDragData->hasHtml() || m_platformDragData->hasText();
+}
+
+bool DragData::containsURL() const
+{
+ if (!m_platformDragData)
+ return false;
+ return m_platformDragData->hasUrls();
+}
+
+String DragData::asURL(String* title) const
+{
+ if (!m_platformDragData)
+ return String();
+ QList<QUrl> urls = m_platformDragData->urls();
+ return urls.first().toString();
+}
+
+
+PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const
+{
+ if (m_platformDragData && m_platformDragData->hasHtml())
+ return createFragmentFromMarkup(doc, m_platformDragData->html(), "");
+
+ return 0;
+}
+
+}
+
diff --git a/WebCore/platform/qt/DragImageQt.cpp b/WebCore/platform/qt/DragImageQt.cpp
new file mode 100644
index 0000000..c9cdd8d
--- /dev/null
+++ b/WebCore/platform/qt/DragImageQt.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 Apple Inc. 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 "DragImage.h"
+
+#include "CachedImage.h"
+#include "Image.h"
+
+namespace WebCore {
+
+IntSize dragImageSize(DragImageRef)
+{
+ return IntSize(0, 0);
+}
+
+void deleteDragImage(DragImageRef)
+{
+}
+
+DragImageRef scaleDragImage(DragImageRef image, FloatSize)
+{
+ return image;
+}
+
+DragImageRef dissolveDragImageToFraction(DragImageRef image, float)
+{
+ return image;
+}
+
+DragImageRef createDragImageFromImage(Image*)
+{
+ return 0;
+}
+
+DragImageRef createDragImageIconForCachedImage(CachedImage*)
+{
+ return 0;
+}
+
+}
diff --git a/WebCore/platform/qt/EventLoopQt.cpp b/WebCore/platform/qt/EventLoopQt.cpp
new file mode 100644
index 0000000..39bb54c
--- /dev/null
+++ b/WebCore/platform/qt/EventLoopQt.cpp
@@ -0,0 +1,32 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "EventLoop.h"
+
+#include <QCoreApplication>
+
+namespace WebCore {
+
+void EventLoop::cycle()
+{
+ QCoreApplication::processEvents();
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/FileChooserQt.cpp b/WebCore/platform/qt/FileChooserQt.cpp
new file mode 100644
index 0000000..b468dbe
--- /dev/null
+++ b/WebCore/platform/qt/FileChooserQt.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "FileChooser.h"
+
+#include "Font.h"
+#include <QFontMetrics>
+
+namespace WebCore {
+
+String FileChooser::basenameForWidth(const Font& f, int width) const
+{
+ QFontMetrics fm(f.font());
+ return fm.elidedText(m_filenames[0], Qt::ElideLeft, width);
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp
new file mode 100644
index 0000000..6b56070
--- /dev/null
+++ b/WebCore/platform/qt/FileSystemQt.cpp
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2007 Staikos Computing Services Inc.
+ * Copyright (C) 2007 Holger Hans Peter Freyther
+ * Copyright (C) 2008 Apple, Inc. All rights reserved.
+ * Copyright (C) 2008 Collabora, Ltd. 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 "FileSystem.h"
+
+#include "CString.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+#include <QDateTime>
+#include <QFile>
+#include <QTemporaryFile>
+#include <QFileInfo>
+#include <QDateTime>
+#include <QDir>
+
+namespace WebCore {
+
+bool fileExists(const String& path)
+{
+ return QFile::exists(path);
+}
+
+
+bool deleteFile(const String& path)
+{
+ return QFile::remove(path);
+}
+
+bool deleteEmptyDirectory(const String& path)
+{
+ return QDir::root().rmdir(path);
+}
+
+bool getFileSize(const String& path, long long& result)
+{
+ QFileInfo info(path);
+ result = info.size();
+ return info.exists();
+}
+
+bool getFileModificationTime(const String& path, time_t& result)
+{
+ QFileInfo info(path);
+ result = info.lastModified().toTime_t();
+ return info.exists();
+}
+
+bool makeAllDirectories(const String& path)
+{
+ return QDir::root().mkpath(path);
+}
+
+String pathByAppendingComponent(const String& path, const String& component)
+{
+ return QDir(path).filePath(component);
+}
+
+String homeDirectoryPath()
+{
+ return QDir::homePath();
+}
+
+String pathGetFileName(const String& path)
+{
+ return QFileInfo(path).fileName();
+}
+
+String directoryName(const String& path)
+{
+ return String(QFileInfo(path).baseName());
+}
+
+Vector<String> listDirectory(const String& path, const String& filter)
+{
+ Vector<String> entries;
+
+ QStringList nameFilters;
+ if (!filter.isEmpty())
+ nameFilters.append(filter);
+ QFileInfoList fileInfoList = QDir(path).entryInfoList(nameFilters, QDir::AllEntries | QDir::NoDotAndDotDot);
+ foreach (const QFileInfo fileInfo, fileInfoList) {
+ String entry = String(fileInfo.canonicalFilePath());
+ entries.append(entry);
+ }
+
+ return entries;
+}
+
+CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
+{
+ QFile *temp = new QTemporaryFile(QString(prefix));
+ if (temp->open(QIODevice::ReadWrite)) {
+ handle = temp;
+ return String(temp->fileName()).utf8();
+ }
+ handle = invalidPlatformFileHandle;
+ return 0;
+}
+
+void closeFile(PlatformFileHandle& handle)
+{
+ if (handle) {
+ handle->close();
+ delete handle;
+ }
+}
+
+int writeToFile(PlatformFileHandle handle, const char* data, int length)
+{
+ if (handle && handle->exists() && handle->isWritable())
+ return handle->write(data, length);
+
+ return 0;
+}
+
+#if defined(Q_WS_X11) || defined(Q_WS_QWS)
+bool unloadModule(PlatformModule module)
+{
+ if (module->unload()) {
+ delete module;
+ return true;
+ }
+
+ return false;
+}
+#endif
+
+#if defined(Q_WS_MAC)
+bool unloadModule(PlatformModule module)
+{
+ CFRelease(module);
+ return true;
+}
+#endif
+
+#if defined(Q_OS_WIN32)
+bool unloadModule(PlatformModule module)
+{
+ return ::FreeLibrary(module);
+}
+#endif
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/KURLQt.cpp b/WebCore/platform/qt/KURLQt.cpp
new file mode 100644
index 0000000..cdc4f48
--- /dev/null
+++ b/WebCore/platform/qt/KURLQt.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "KURL.h"
+#include "CString.h"
+
+#include "NotImplemented.h"
+#include "qurl.h"
+
+namespace WebCore {
+
+#if QT_VERSION < 0x040500
+static const char hexnumbers[] = "0123456789ABCDEF";
+static inline char toHex(char c)
+{
+ return hexnumbers[c & 0xf];
+}
+#endif
+
+KURL::KURL(const QUrl& url)
+{
+ *this = KURL(url.toEncoded().constData());
+}
+
+KURL::operator QUrl() const
+{
+#if QT_VERSION < 0x040500
+ unsigned length = m_string.length();
+
+ QByteArray ba;
+ ba.reserve(length);
+
+ int path = -1;
+ int host = m_string.find("://");
+ if (host != -1) {
+ host += 3;
+
+ path = m_string.find('/', host);
+ }
+
+ for (unsigned i = 0; i < length; ++i) {
+ const char chr = static_cast<char>(m_string[i]);
+
+ switch (chr) {
+ encode:
+ case '{':
+ case '}':
+ case '|':
+ case '\\':
+ case '^':
+ case '`':
+ ba.append('%');
+ ba.append(toHex((chr & 0xf0) >> 4));
+ ba.append(toHex(chr & 0xf));
+ break;
+ case '[':
+ case ']':
+ // special case: if this is the host part, don't encode
+ // otherwise, encode
+ if (host == -1 || (path != -1 && i >= path))
+ goto encode;
+ // fall through
+ default:
+ ba.append(chr);
+ break;
+ }
+ }
+#else
+ // Qt 4.5 or later
+ // No need for special encoding
+ QByteArray ba = m_string.utf8().data();
+#endif
+
+ QUrl url = QUrl::fromEncoded(ba);
+ return url;
+}
+
+String KURL::fileSystemPath() const
+{
+ notImplemented();
+ return String();
+}
+
+}
+
diff --git a/WebCore/platform/qt/KeyboardCodes.h b/WebCore/platform/qt/KeyboardCodes.h
new file mode 100644
index 0000000..21d3c67
--- /dev/null
+++ b/WebCore/platform/qt/KeyboardCodes.h
@@ -0,0 +1,553 @@
+/*
+ * 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
+
+#include <wtf/Platform.h>
+
+namespace WebCore {
+
+#if !PLATFORM(WIN_OS)
+// 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;
+
+#endif // PLATFORM(WIN_OS)
+
+// (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;
+
+#if !PLATFORM(WIN_OS)
+
+// 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 // PLATFORM(WIN_OS)
+
+}
+
+#endif
diff --git a/WebCore/platform/qt/Localizations.cpp b/WebCore/platform/qt/Localizations.cpp
new file mode 100644
index 0000000..b49b880
--- /dev/null
+++ b/WebCore/platform/qt/Localizations.cpp
@@ -0,0 +1,352 @@
+/*
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * 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 "IntSize.h"
+#include "LocalizedStrings.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+#include <QCoreApplication>
+
+namespace WebCore {
+
+String submitButtonDefaultLabel()
+{
+ return QCoreApplication::translate("QWebPage", "Submit", "default label for Submit buttons in forms on web pages");
+}
+
+String inputElementAltText()
+{
+ return QCoreApplication::translate("QWebPage", "Submit", "Submit (input element) alt text for <input> elements with no alt, title, or value");
+}
+
+String resetButtonDefaultLabel()
+{
+ return QCoreApplication::translate("QWebPage", "Reset", "default label for Reset buttons in forms on web pages");
+}
+
+String defaultLanguage()
+{
+ return "en";
+}
+
+String searchableIndexIntroduction()
+{
+ return QCoreApplication::translate("QWebPage", "This is a searchable index. Enter search keywords: ", "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'");
+}
+
+String fileButtonChooseFileLabel()
+{
+ return QCoreApplication::translate("QWebPage", "Choose File", "title for file button used in HTML forms");
+}
+
+String fileButtonNoFileSelectedLabel()
+{
+ return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
+}
+
+String contextMenuItemTagOpenLinkInNewWindow()
+{
+ return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
+}
+
+String contextMenuItemTagDownloadLinkToDisk()
+{
+ return QCoreApplication::translate("QWebPage", "Save Link...", "Download Linked File context menu item");
+}
+
+String contextMenuItemTagCopyLinkToClipboard()
+{
+ return QCoreApplication::translate("QWebPage", "Copy Link", "Copy Link context menu item");
+}
+
+String contextMenuItemTagOpenImageInNewWindow()
+{
+ return QCoreApplication::translate("QWebPage", "Open Image", "Open Image in New Window context menu item");
+}
+
+String contextMenuItemTagDownloadImageToDisk()
+{
+ return QCoreApplication::translate("QWebPage", "Save Image", "Download Image context menu item");
+}
+
+String contextMenuItemTagCopyImageToClipboard()
+{
+ return QCoreApplication::translate("QWebPage", "Copy Image", "Copy Link context menu item");
+}
+
+String contextMenuItemTagOpenFrameInNewWindow()
+{
+ return QCoreApplication::translate("QWebPage", "Open Frame", "Open Frame in New Window context menu item");
+}
+
+String contextMenuItemTagCopy()
+{
+ return QCoreApplication::translate("QWebPage", "Copy", "Copy context menu item");
+}
+
+String contextMenuItemTagGoBack()
+{
+ return QCoreApplication::translate("QWebPage", "Go Back", "Back context menu item");
+}
+
+String contextMenuItemTagGoForward()
+{
+ return QCoreApplication::translate("QWebPage", "Go Forward", "Forward context menu item");
+}
+
+String contextMenuItemTagStop()
+{
+ return QCoreApplication::translate("QWebPage", "Stop", "Stop context menu item");
+}
+
+String contextMenuItemTagReload()
+{
+ return QCoreApplication::translate("QWebPage", "Reload", "Reload context menu item");
+}
+
+String contextMenuItemTagCut()
+{
+ return QCoreApplication::translate("QWebPage", "Cut", "Cut context menu item");
+}
+
+String contextMenuItemTagPaste()
+{
+ return QCoreApplication::translate("QWebPage", "Paste", "Paste context menu item");
+}
+
+String contextMenuItemTagNoGuessesFound()
+{
+ return QCoreApplication::translate("QWebPage", "No Guesses Found", "No Guesses Found context menu item");
+}
+
+String contextMenuItemTagIgnoreSpelling()
+{
+ return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Spelling context menu item");
+}
+
+String contextMenuItemTagLearnSpelling()
+{
+ return QCoreApplication::translate("QWebPage", "Add To Dictionary", "Learn Spelling context menu item");
+}
+
+String contextMenuItemTagSearchWeb()
+{
+ return QCoreApplication::translate("QWebPage", "Search The Web", "Search The Web context menu item");
+}
+
+String contextMenuItemTagLookUpInDictionary()
+{
+ return QCoreApplication::translate("QWebPage", "Look Up In Dictionary", "Look Up in Dictionary context menu item");
+}
+
+String contextMenuItemTagOpenLink()
+{
+ return QCoreApplication::translate("QWebPage", "Open Link", "Open Link context menu item");
+}
+
+String contextMenuItemTagIgnoreGrammar()
+{
+ return QCoreApplication::translate("QWebPage", "Ignore", "Ignore Grammar context menu item");
+}
+
+String contextMenuItemTagSpellingMenu()
+{
+ return QCoreApplication::translate("QWebPage", "Spelling", "Spelling and Grammar context sub-menu item");
+}
+
+String contextMenuItemTagShowSpellingPanel(bool show)
+{
+ return show ? QCoreApplication::translate("QWebPage", "Show Spelling and Grammar", "menu item title") :
+ QCoreApplication::translate("QWebPage", "Hide Spelling and Grammar", "menu item title");
+}
+
+String contextMenuItemTagCheckSpelling()
+{
+ return QCoreApplication::translate("QWebPage", "Check Spelling", "Check spelling context menu item");
+}
+
+String contextMenuItemTagCheckSpellingWhileTyping()
+{
+ return QCoreApplication::translate("QWebPage", "Check Spelling While Typing", "Check spelling while typing context menu item");
+}
+
+String contextMenuItemTagCheckGrammarWithSpelling()
+{
+ return QCoreApplication::translate("QWebPage", "Check Grammar With Spelling", "Check grammar with spelling context menu item");
+}
+
+String contextMenuItemTagFontMenu()
+{
+ return QCoreApplication::translate("QWebPage", "Fonts", "Font context sub-menu item");
+}
+
+String contextMenuItemTagBold()
+{
+ return QCoreApplication::translate("QWebPage", "Bold", "Bold context menu item");
+}
+
+String contextMenuItemTagItalic()
+{
+ return QCoreApplication::translate("QWebPage", "Italic", "Italic context menu item");
+}
+
+String contextMenuItemTagUnderline()
+{
+ return QCoreApplication::translate("QWebPage", "Underline", "Underline context menu item");
+}
+
+String contextMenuItemTagOutline()
+{
+ return QCoreApplication::translate("QWebPage", "Outline", "Outline context menu item");
+}
+
+String contextMenuItemTagWritingDirectionMenu()
+{
+ return QCoreApplication::translate("QWebPage", "Direction", "Writing direction context sub-menu item");
+}
+
+String contextMenuItemTagDefaultDirection()
+{
+ return QCoreApplication::translate("QWebPage", "Default", "Default writing direction context menu item");
+}
+
+String contextMenuItemTagLeftToRight()
+{
+ return QCoreApplication::translate("QWebPage", "LTR", "Left to Right context menu item");
+}
+
+String contextMenuItemTagRightToLeft()
+{
+ return QCoreApplication::translate("QWebPage", "RTL", "Right to Left context menu item");
+}
+
+String contextMenuItemTagInspectElement()
+{
+ return QCoreApplication::translate("QWebPage", "Inspect", "Inspect Element context menu item");
+}
+
+String searchMenuNoRecentSearchesText()
+{
+ return QCoreApplication::translate("QWebPage", "No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed");
+}
+
+String searchMenuRecentSearchesText()
+{
+ return QCoreApplication::translate("QWebPage", "Recent searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title");
+}
+
+String searchMenuClearRecentSearchesText()
+{
+ return QCoreApplication::translate("QWebPage", "Clear recent searches", "menu item in Recent Searches menu that empties menu's contents");
+}
+
+String AXWebAreaText()
+{
+ return String();
+}
+
+String AXLinkText()
+{
+ return String();
+}
+
+String AXListMarkerText()
+{
+ return String();
+}
+
+String AXImageMapText()
+{
+ return String();
+}
+
+String AXHeadingText()
+{
+ return String();
+}
+
+String AXDefinitionListTermText()
+{
+ return String();
+}
+
+String AXDefinitionListDefinitionText()
+{
+ return String();
+}
+
+String AXButtonActionVerb()
+{
+ return String();
+}
+
+String AXRadioButtonActionVerb()
+{
+ return String();
+}
+
+String AXTextFieldActionVerb()
+{
+ return String();
+}
+
+String AXCheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXUncheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXLinkActionVerb()
+{
+ return String();
+}
+
+String multipleFileUploadText(unsigned)
+{
+ return String();
+}
+
+String unknownFileSizeText()
+{
+ return QCoreApplication::translate("QWebPage", "Unknown", "Unknown filesize FTP directory listing item");
+}
+
+String imageTitle(const String& filename, const IntSize& size)
+{
+ return QCoreApplication::translate("QWebPage", "%1 (%2x%3 pixels)", "Title string for images").arg(filename).arg(size.width()).arg(size.height());
+}
+
+}
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/LoggingQt.cpp b/WebCore/platform/qt/LoggingQt.cpp
new file mode 100644
index 0000000..5f6720a
--- /dev/null
+++ b/WebCore/platform/qt/LoggingQt.cpp
@@ -0,0 +1,90 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "Logging.h"
+
+#include <QDebug>
+#include <QStringList>
+
+namespace WebCore {
+
+#if !defined(NDEBUG)
+static WTFLogChannel* getChannelFromName(const QString& channelName)
+{
+ if (!channelName.length() >= 2)
+ return 0;
+
+ if (channelName == QLatin1String("BackForward")) return &LogBackForward;
+ if (channelName == QLatin1String("Editing")) return &LogEditing;
+ if (channelName == QLatin1String("Events")) return &LogEvents;
+ if (channelName == QLatin1String("Frames")) return &LogFrames;
+ if (channelName == QLatin1String("FTP")) return &LogFTP;
+ if (channelName == QLatin1String("History")) return &LogHistory;
+ if (channelName == QLatin1String("IconDatabase")) return &LogIconDatabase;
+ if (channelName == QLatin1String("Loading")) return &LogLoading;
+ if (channelName == QLatin1String("Media")) return &LogMedia;
+ if (channelName == QLatin1String("Network")) return &LogNetwork;
+ if (channelName == QLatin1String("NotYetImplemented")) return &LogNotYetImplemented;
+ if (channelName == QLatin1String("PageCache")) return &LogPageCache;
+ if (channelName == QLatin1String("PlatformLeaks")) return &LogPlatformLeaks;
+ if (channelName == QLatin1String("Plugin")) return &LogPlugin;
+ if (channelName == QLatin1String("PopupBlocking")) return &LogPopupBlocking;
+ if (channelName == QLatin1String("SpellingAndGrammar")) return &LogSpellingAndGrammar;
+ if (channelName == QLatin1String("SQLDatabase")) return &LogSQLDatabase;
+ if (channelName == QLatin1String("StorageAPI")) return &LogStorageAPI;
+ if (channelName == QLatin1String("TextConversion")) return &LogTextConversion;
+ if (channelName == QLatin1String("Threading")) return &LogThreading;
+
+ return 0;
+}
+#endif
+
+void InitializeLoggingChannelsIfNecessary()
+{
+ static bool haveInitializedLoggingChannels = false;
+ if (haveInitializedLoggingChannels)
+ return;
+
+ haveInitializedLoggingChannels = true;
+
+ QString loggingEnv = qgetenv("QT_WEBKIT_LOG");
+ if (loggingEnv.isEmpty())
+ return;
+
+#if defined(NDEBUG)
+ qWarning("This is a release build. Setting QT_WEBKIT_LOG will have no effect.");
+#else
+ QStringList channels = loggingEnv.split(",");
+ QStringListIterator iter(channels);
+
+ while (iter.hasNext()) {
+ QString channelName = iter.next();
+ WTFLogChannel* channel = getChannelFromName(channelName);
+ if (!channel) continue;
+ channel->state = WTFLogChannelOn;
+ }
+
+ // By default we log calls to notImplemented(). This can be turned
+ // off by setting the environment variable DISABLE_NI_WARNING to 1
+ LogNotYetImplemented.state = WTFLogChannelOn;
+#endif
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/MIMETypeRegistryQt.cpp b/WebCore/platform/qt/MIMETypeRegistryQt.cpp
new file mode 100644
index 0000000..9f4a786
--- /dev/null
+++ b/WebCore/platform/qt/MIMETypeRegistryQt.cpp
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "MIMETypeRegistry.h"
+
+namespace WebCore {
+
+struct ExtensionMap {
+ const char* extension;
+ const char* mimeType;
+};
+
+static const ExtensionMap extensionMap [] = {
+ { "bmp", "image/bmp" },
+ { "css", "text/css" },
+ { "gif", "image/gif" },
+ { "html", "text/html" },
+ { "htm", "text/html" },
+ { "ico", "image/x-icon" },
+ { "jpeg", "image/jpeg" },
+ { "jpg", "image/jpeg" },
+ { "js", "application/x-javascript" },
+ { "mng", "video/x-mng" },
+ { "pbm", "image/x-portable-bitmap" },
+ { "pgm", "image/x-portable-graymap" },
+ { "pdf", "application/pdf" },
+ { "png", "image/png" },
+ { "ppm", "image/x-portable-pixmap" },
+ { "rss", "application/rss+xml" },
+ { "svg", "image/svg+xml" },
+ { "text", "text/plain" },
+ { "tif", "image/tiff" },
+ { "tiff", "image/tiff" },
+ { "txt", "text/plain" },
+ { "xbm", "image/x-xbitmap" },
+ { "xml", "text/xml" },
+ { "xpm", "image/x-xpm" },
+ { "xsl", "text/xsl" },
+ { "xhtml", "application/xhtml+xml" },
+ { 0, 0 }
+};
+
+String MIMETypeRegistry::getMIMETypeForExtension(const String &ext)
+{
+ String s = ext.lower();
+
+ const ExtensionMap *e = extensionMap;
+ while (e->extension) {
+ if (s == e->extension)
+ return e->mimeType;
+ ++e;
+ }
+
+ return "application/octet-stream";
+}
+
+}
diff --git a/WebCore/platform/qt/MenuEventProxy.h b/WebCore/platform/qt/MenuEventProxy.h
new file mode 100644
index 0000000..658d1ee
--- /dev/null
+++ b/WebCore/platform/qt/MenuEventProxy.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+
+#ifndef MENUEVENTPROXY_H
+#define MENUEVENTPROXY_H
+
+#include "Platform.h"
+#include <qobject.h>
+#include <qmap.h>
+#include "ContextMenu.h"
+#include "ContextMenuItem.h"
+#include "ContextMenuController.h"
+
+namespace WebCore {
+class MenuEventProxy : public QObject {
+ Q_OBJECT
+ public:
+ MenuEventProxy(WebCore::ContextMenu *m) : m_m(m) {}
+ ~MenuEventProxy() {}
+
+ void map(QAction* action, unsigned actionTag) { _map[action] = actionTag; }
+
+ public slots:
+ void trigger(QAction *action) {
+ WebCore::ContextMenuItem item(WebCore::ActionType, static_cast<WebCore::ContextMenuAction>(_map[action]), WebCore::String());
+ m_m->controller()->contextMenuItemSelected(&item);
+ }
+
+ private:
+ WebCore::ContextMenu *m_m;
+ QMap<QAction*, unsigned> _map;
+};
+
+}
+
+#endif
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp
new file mode 100644
index 0000000..b535a74
--- /dev/null
+++ b/WebCore/platform/qt/PasteboardQt.cpp
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "Pasteboard.h"
+
+#include "DocumentFragment.h"
+#include "Editor.h"
+#include "Frame.h"
+#include "Image.h"
+#include "markup.h"
+#include "RenderImage.h"
+
+#include <qdebug.h>
+#include <qclipboard.h>
+#include <qmimedata.h>
+#include <qapplication.h>
+#include <qurl.h>
+
+#define methodDebug() qDebug() << "PasteboardQt: " << __FUNCTION__;
+
+namespace WebCore {
+
+Pasteboard::Pasteboard()
+ : m_selectionMode(false)
+{
+}
+
+Pasteboard* Pasteboard::generalPasteboard()
+{
+ static Pasteboard* pasteboard = 0;
+ if (!pasteboard)
+ pasteboard = new Pasteboard();
+ return pasteboard;
+}
+
+void Pasteboard::writeSelection(Range* selectedRange, bool, Frame* frame)
+{
+ QMimeData* md = new QMimeData;
+ QString text = frame->selectedText();
+ text.replace(QChar(0xa0), QLatin1Char(' '));
+ md->setText(text);
+
+ QString html = QLatin1String("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>");
+ html += createMarkup(selectedRange, 0, AnnotateForInterchange);
+ html += QLatin1String("</body></html>");
+ md->setHtml(html);
+
+#ifndef QT_NO_CLIPBOARD
+ QApplication::clipboard()->setMimeData(md, m_selectionMode ?
+ QClipboard::Selection : QClipboard::Clipboard);
+#endif
+}
+
+bool Pasteboard::canSmartReplace()
+{
+ return false;
+}
+
+String Pasteboard::plainText(Frame*)
+{
+#ifndef QT_NO_CLIPBOARD
+ return QApplication::clipboard()->text(m_selectionMode ?
+ QClipboard::Selection : QClipboard::Clipboard);
+#else
+ return String();
+#endif
+}
+
+PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context,
+ bool allowPlainText, bool& chosePlainText)
+{
+#ifndef QT_NO_CLIPBOARD
+ const QMimeData* mimeData = QApplication::clipboard()->mimeData(
+ m_selectionMode ? QClipboard::Selection : QClipboard::Clipboard);
+
+ chosePlainText = false;
+
+ if (mimeData->hasHtml()) {
+ QString html = mimeData->html();
+ if (!html.isEmpty()) {
+ RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), html, "");
+ if (fragment)
+ return fragment.release();
+ }
+ }
+
+ if (allowPlainText && mimeData->hasText()) {
+ chosePlainText = true;
+ RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), mimeData->text());
+ if (fragment)
+ return fragment.release();
+ }
+#endif
+ return 0;
+}
+
+void Pasteboard::writeURL(const KURL& _url, const String&, Frame*)
+{
+ ASSERT(!_url.isEmpty());
+
+#ifndef QT_NO_CLIPBOARD
+ QMimeData* md = new QMimeData;
+ QString url = _url.string();
+ md->setText(url);
+ md->setUrls(QList<QUrl>() << QUrl(url));
+ QApplication::clipboard()->setMimeData(md, m_selectionMode ?
+ QClipboard::Selection : QClipboard::Clipboard);
+#endif
+}
+
+void Pasteboard::writeImage(Node* node, const KURL&, const String&)
+{
+ ASSERT(node && node->renderer() && node->renderer()->isImage());
+
+#ifndef QT_NO_CLIPBOARD
+ CachedImage* cachedImage = static_cast<RenderImage*>(node->renderer())->cachedImage();
+ ASSERT(cachedImage);
+
+ Image* image = cachedImage->image();
+ ASSERT(image);
+
+ QPixmap* pixmap = image->nativeImageForCurrentFrame();
+ ASSERT(pixmap);
+
+ QApplication::clipboard()->setPixmap(*pixmap, QClipboard::Clipboard);
+#endif
+}
+
+/* This function is called from Editor::tryDHTMLCopy before actually set the clipboard
+ * It introduce a race condition with klipper, which will try to grab the clipboard
+ * It's not required to clear it anyway, since QClipboard take care about replacing the clipboard
+ */
+void Pasteboard::clear()
+{
+}
+
+bool Pasteboard::isSelectionMode() const
+{
+ return m_selectionMode;
+}
+
+void Pasteboard::setSelectionMode(bool selectionMode)
+{
+ m_selectionMode = selectionMode;
+}
+
+}
diff --git a/WebCore/platform/qt/PlatformKeyboardEventQt.cpp b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
new file mode 100644
index 0000000..76342ab
--- /dev/null
+++ b/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
@@ -0,0 +1,478 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 "KeyboardCodes.h"
+#include "NotImplemented.h"
+
+#include <ctype.h>
+
+#include <QKeyEvent>
+
+namespace WebCore {
+
+static String keyIdentifierForQtKeyCode(int keyCode)
+{
+ switch (keyCode) {
+ case Qt::Key_Menu:
+ case Qt::Key_Alt:
+ return "Alt";
+ case Qt::Key_Clear:
+ return "Clear";
+ case Qt::Key_Down:
+ return "Down";
+ case Qt::Key_End:
+ return "End";
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ return "Enter";
+#if QT_VERSION >= 0x040200
+ case Qt::Key_Execute:
+ return "Execute";
+#endif
+ case Qt::Key_F1:
+ return "F1";
+ case Qt::Key_F2:
+ return "F2";
+ case Qt::Key_F3:
+ return "F3";
+ case Qt::Key_F4:
+ return "F4";
+ case Qt::Key_F5:
+ return "F5";
+ case Qt::Key_F6:
+ return "F6";
+ case Qt::Key_F7:
+ return "F7";
+ case Qt::Key_F8:
+ return "F8";
+ case Qt::Key_F9:
+ return "F9";
+ case Qt::Key_F10:
+ return "F10";
+ case Qt::Key_F11:
+ return "F11";
+ case Qt::Key_F12:
+ return "F12";
+ case Qt::Key_F13:
+ return "F13";
+ case Qt::Key_F14:
+ return "F14";
+ case Qt::Key_F15:
+ return "F15";
+ case Qt::Key_F16:
+ return "F16";
+ case Qt::Key_F17:
+ return "F17";
+ case Qt::Key_F18:
+ return "F18";
+ case Qt::Key_F19:
+ return "F19";
+ case Qt::Key_F20:
+ return "F20";
+ case Qt::Key_F21:
+ return "F21";
+ case Qt::Key_F22:
+ return "F22";
+ case Qt::Key_F23:
+ return "F23";
+ case Qt::Key_F24:
+ return "F24";
+ case Qt::Key_Help:
+ return "Help";
+ case Qt::Key_Home:
+ return "Home";
+ case Qt::Key_Insert:
+ return "Insert";
+ case Qt::Key_Left:
+ return "Left";
+ case Qt::Key_PageDown:
+ return "PageDown";
+ case Qt::Key_PageUp:
+ return "PageUp";
+ case Qt::Key_Pause:
+ return "Pause";
+ case Qt::Key_Print:
+ return "PrintScreen";
+ case Qt::Key_Right:
+ return "Right";
+ case Qt::Key_Select:
+ return "Select";
+ case Qt::Key_Up:
+ return "Up";
+ // Standard says that DEL becomes U+007F.
+ case Qt::Key_Delete:
+ return "U+007F";
+ case Qt::Key_Tab:
+ return "U+0009";
+ case Qt::Key_Backtab:
+ return "U+0009";
+ default:
+ return String::format("U+%04X", toupper(keyCode));
+ }
+}
+
+static int windowsKeyCodeForKeyEvent(unsigned int keycode)
+{
+ switch (keycode) {
+ /* FIXME: Need to supply a bool in this func, to determine wheter the event comes from the keypad
+ case Qt::Key_0:
+ return VK_NUMPAD0;// (60) Numeric keypad 0 key
+ case Qt::Key_1:
+ return VK_NUMPAD1;// (61) Numeric keypad 1 key
+ case Qt::Key_2:
+ return VK_NUMPAD2; // (62) Numeric keypad 2 key
+ case Qt::Key_3:
+ return VK_NUMPAD3; // (63) Numeric keypad 3 key
+ case Qt::Key_4:
+ return VK_NUMPAD4; // (64) Numeric keypad 4 key
+ case Qt::Key_5:
+ return VK_NUMPAD5; //(65) Numeric keypad 5 key
+ case Qt::Key_6:
+ return VK_NUMPAD6; // (66) Numeric keypad 6 key
+ case Qt::Key_7:
+ return VK_NUMPAD7; // (67) Numeric keypad 7 key
+ case Qt::Key_8:
+ return VK_NUMPAD8; // (68) Numeric keypad 8 key
+ case Qt::Key_9:
+ return VK_NUMPAD9; // (69) Numeric keypad 9 key
+ case Qt::Key_Asterisk:
+ return VK_MULTIPLY; // (6A) Multiply key
+ case Qt::Key_Plus:
+ return VK_ADD; // (6B) Add key
+ case Qt::Key_Minus:
+ return VK_SUBTRACT; // (6D) Subtract key
+ case Qt::Key_Period:
+ return VK_DECIMAL; // (6E) Decimal key
+ case Qt::Key_Slash:
+ return VK_DIVIDE; // (6F) Divide key
+
+ */
+ case Qt::Key_Backspace:
+ return VK_BACK; // (08) BACKSPACE key
+ case Qt::Key_Backtab:
+ case Qt::Key_Tab:
+ return VK_TAB; // (09) TAB key
+ case Qt::Key_Clear:
+ return VK_CLEAR; // (0C) CLEAR key
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ return VK_RETURN; //(0D) Return key
+ case Qt::Key_Shift:
+ return VK_SHIFT; // (10) SHIFT key
+ case Qt::Key_Control:
+ return VK_CONTROL; // (11) CTRL key
+ case Qt::Key_Menu:
+ case Qt::Key_Alt:
+ return VK_MENU; // (12) ALT key
+
+ case Qt::Key_Pause:
+ return VK_PAUSE; // (13) PAUSE key
+ case Qt::Key_CapsLock:
+ return VK_CAPITAL; // (14) CAPS LOCK key
+ case Qt::Key_Kana_Lock:
+ case Qt::Key_Kana_Shift:
+ return VK_KANA; // (15) Input Method Editor (IME) Kana mode
+ case Qt::Key_Hangul:
+ return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode
+ // VK_JUNJA (17) IME Junja mode
+ // VK_FINAL (18) IME final mode
+ case Qt::Key_Hangul_Hanja:
+ return VK_HANJA; // (19) IME Hanja mode
+ case Qt::Key_Kanji:
+ return VK_KANJI; // (19) IME Kanji mode
+ case Qt::Key_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 Qt::Key_Space:
+ return VK_SPACE; // (20) SPACEBAR
+ case Qt::Key_PageUp:
+ return VK_PRIOR; // (21) PAGE UP key
+ case Qt::Key_PageDown:
+ return VK_NEXT; // (22) PAGE DOWN key
+ case Qt::Key_End:
+ return VK_END; // (23) END key
+ case Qt::Key_Home:
+ return VK_HOME; // (24) HOME key
+ case Qt::Key_Left:
+ return VK_LEFT; // (25) LEFT ARROW key
+ case Qt::Key_Up:
+ return VK_UP; // (26) UP ARROW key
+ case Qt::Key_Right:
+ return VK_RIGHT; // (27) RIGHT ARROW key
+ case Qt::Key_Down:
+ return VK_DOWN; // (28) DOWN ARROW key
+ case Qt::Key_Select:
+ return VK_SELECT; // (29) SELECT key
+ case Qt::Key_Print:
+ return VK_PRINT; // (2A) PRINT key
+#if QT_VERSION >= 0x040200
+ case Qt::Key_Execute:
+ return VK_EXECUTE;// (2B) EXECUTE key
+#endif
+ //dunno on this
+ //case Qt::Key_PrintScreen:
+ // return VK_SNAPSHOT; // (2C) PRINT SCREEN key
+ case Qt::Key_Insert:
+ return VK_INSERT; // (2D) INS key
+ case Qt::Key_Delete:
+ return VK_DELETE; // (2E) DEL key
+ case Qt::Key_Help:
+ return VK_HELP; // (2F) HELP key
+ case Qt::Key_0:
+ case Qt::Key_ParenLeft:
+ return VK_0; // (30) 0) key
+ case Qt::Key_1:
+ return VK_1; // (31) 1 ! key
+ case Qt::Key_2:
+ case Qt::Key_At:
+ return VK_2; // (32) 2 & key
+ case Qt::Key_3:
+ case Qt::Key_NumberSign:
+ return VK_3; //case '3': case '#';
+ case Qt::Key_4:
+ case Qt::Key_Dollar: // (34) 4 key '$';
+ return VK_4;
+ case Qt::Key_5:
+ case Qt::Key_Percent:
+ return VK_5; // (35) 5 key '%'
+ case Qt::Key_6:
+ case Qt::Key_AsciiCircum:
+ return VK_6; // (36) 6 key '^'
+ case Qt::Key_7:
+ case Qt::Key_Ampersand:
+ return VK_7; // (37) 7 key case '&'
+ case Qt::Key_8:
+ case Qt::Key_Asterisk:
+ return VK_8; // (38) 8 key '*'
+ case Qt::Key_9:
+ case Qt::Key_ParenRight:
+ return VK_9; // (39) 9 key '('
+ case Qt::Key_A:
+ return VK_A; // (41) A key case 'a': case 'A': return 0x41;
+ case Qt::Key_B:
+ return VK_B; // (42) B key case 'b': case 'B': return 0x42;
+ case Qt::Key_C:
+ return VK_C; // (43) C key case 'c': case 'C': return 0x43;
+ case Qt::Key_D:
+ return VK_D; // (44) D key case 'd': case 'D': return 0x44;
+ case Qt::Key_E:
+ return VK_E; // (45) E key case 'e': case 'E': return 0x45;
+ case Qt::Key_F:
+ return VK_F; // (46) F key case 'f': case 'F': return 0x46;
+ case Qt::Key_G:
+ return VK_G; // (47) G key case 'g': case 'G': return 0x47;
+ case Qt::Key_H:
+ return VK_H; // (48) H key case 'h': case 'H': return 0x48;
+ case Qt::Key_I:
+ return VK_I; // (49) I key case 'i': case 'I': return 0x49;
+ case Qt::Key_J:
+ return VK_J; // (4A) J key case 'j': case 'J': return 0x4A;
+ case Qt::Key_K:
+ return VK_K; // (4B) K key case 'k': case 'K': return 0x4B;
+ case Qt::Key_L:
+ return VK_L; // (4C) L key case 'l': case 'L': return 0x4C;
+ case Qt::Key_M:
+ return VK_M; // (4D) M key case 'm': case 'M': return 0x4D;
+ case Qt::Key_N:
+ return VK_N; // (4E) N key case 'n': case 'N': return 0x4E;
+ case Qt::Key_O:
+ return VK_O; // (4F) O key case 'o': case 'O': return 0x4F;
+ case Qt::Key_P:
+ return VK_P; // (50) P key case 'p': case 'P': return 0x50;
+ case Qt::Key_Q:
+ return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51;
+ case Qt::Key_R:
+ return VK_R; // (52) R key case 'r': case 'R': return 0x52;
+ case Qt::Key_S:
+ return VK_S; // (53) S key case 's': case 'S': return 0x53;
+ case Qt::Key_T:
+ return VK_T; // (54) T key case 't': case 'T': return 0x54;
+ case Qt::Key_U:
+ return VK_U; // (55) U key case 'u': case 'U': return 0x55;
+ case Qt::Key_V:
+ return VK_V; // (56) V key case 'v': case 'V': return 0x56;
+ case Qt::Key_W:
+ return VK_W; // (57) W key case 'w': case 'W': return 0x57;
+ case Qt::Key_X:
+ return VK_X; // (58) X key case 'x': case 'X': return 0x58;
+ case Qt::Key_Y:
+ return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59;
+ case Qt::Key_Z:
+ return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A;
+ case Qt::Key_Meta:
+ return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)
+ //case Qt::Key_Meta_R: FIXME: What to do here?
+ // 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 Qt::Key_NumLock:
+ return VK_NUMLOCK; // (90) NUM LOCK key
+
+ case Qt::Key_ScrollLock:
+ 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 Qt::Key_Semicolon:
+ case Qt::Key_Colon:
+ return VK_OEM_1; //case ';': case ':': return 0xBA;
+ // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key
+ case Qt::Key_Plus:
+ case Qt::Key_Equal:
+ return VK_OEM_PLUS; //case '=': case '+': return 0xBB;
+ // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key
+ case Qt::Key_Comma:
+ case Qt::Key_Less:
+ return VK_OEM_COMMA; //case ',': case '<': return 0xBC;
+ // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key
+ case Qt::Key_Minus:
+ case Qt::Key_Underscore:
+ return VK_OEM_MINUS; //case '-': case '_': return 0xBD;
+ // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key
+ case Qt::Key_Period:
+ case Qt::Key_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 Qt::Key_Slash:
+ case Qt::Key_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 Qt::Key_AsciiTilde:
+ case Qt::Key_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 Qt::Key_BracketLeft:
+ case Qt::Key_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 Qt::Key_Backslash:
+ case Qt::Key_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 Qt::Key_BracketRight:
+ case Qt::Key_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 Qt::Key_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(QKeyEvent* event)
+{
+ const int state = event->modifiers();
+ m_type = (event->type() == QEvent::KeyRelease) ? KeyUp : KeyDown;
+ m_text = event->text();
+ m_unmodifiedText = event->text(); // FIXME: not correct
+ m_keyIdentifier = keyIdentifierForQtKeyCode(event->key());
+ m_autoRepeat = event->isAutoRepeat();
+ m_ctrlKey = (state & Qt::ControlModifier) != 0;
+ m_altKey = (state & Qt::AltModifier) != 0;
+ m_metaKey = (state & Qt::MetaModifier) != 0;
+ m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key());
+ m_nativeVirtualKeyCode = event->nativeVirtualKey();
+ m_isKeypad = (state & Qt::KeypadModifier) != 0;
+ m_shiftKey = (state & Qt::ShiftModifier) != 0 || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab
+ m_qtEvent = event;
+}
+
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool)
+{
+ // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions.
+ ASSERT(m_type == KeyDown);
+ m_type = type;
+
+ if (type == RawKeyDown) {
+ m_text = String();
+ m_unmodifiedText = String();
+ } else {
+ m_keyIdentifier = String();
+ m_windowsVirtualKeyCode = 0;
+ }
+}
+
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+ notImplemented();
+ return false;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/PlatformMouseEventQt.cpp b/WebCore/platform/qt/PlatformMouseEventQt.cpp
new file mode 100644
index 0000000..afc7452
--- /dev/null
+++ b/WebCore/platform/qt/PlatformMouseEventQt.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ *
+ * 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 "SystemTime.h"
+
+#include <QMouseEvent>
+
+namespace WebCore {
+
+PlatformMouseEvent::PlatformMouseEvent(QInputEvent* event, int clickCount)
+{
+ m_timestamp = WebCore::currentTime();
+
+ QMouseEvent *me = 0;
+
+ switch(event->type()) {
+ case QEvent::MouseMove:
+ m_eventType = MouseEventMoved;
+ me = static_cast<QMouseEvent *>(event);
+ break;
+ case QEvent::MouseButtonDblClick:
+ case QEvent::MouseButtonPress:
+ m_eventType = MouseEventPressed;
+ me = static_cast<QMouseEvent *>(event);
+ break;
+ case QEvent::MouseButtonRelease:
+ m_eventType = MouseEventReleased;
+ me = static_cast<QMouseEvent *>(event);
+ break;
+#ifndef QT_NO_CONTEXTMENU
+ case QEvent::ContextMenu: {
+ m_eventType = MouseEventPressed;
+ QContextMenuEvent *ce = static_cast<QContextMenuEvent *>(event);
+ m_position = IntPoint(ce->pos());
+ m_globalPosition = IntPoint(ce->globalPos());
+ m_button = RightButton;
+ break;
+ }
+#endif // QT_NO_CONTEXTMENU
+ default:
+ m_eventType = MouseEventMoved;
+ }
+
+ if (me) {
+ m_position = IntPoint(me->pos());
+ m_globalPosition = IntPoint(me->globalPos());
+
+ if (me->button() == Qt::LeftButton || (me->buttons() & Qt::LeftButton))
+ m_button = LeftButton;
+ else if (me->button() == Qt::RightButton || (me->buttons() & Qt::RightButton))
+ m_button = RightButton;
+ else if (me->button() == Qt::MidButton || (me->buttons() & Qt::MidButton))
+ m_button = MiddleButton;
+ else
+ m_button = NoButton;
+ }
+
+ m_clickCount = clickCount;
+ m_shiftKey = (event->modifiers() & Qt::ShiftModifier) != 0;
+ m_ctrlKey = (event->modifiers() & Qt::ControlModifier) != 0;
+ m_altKey = (event->modifiers() & Qt::AltModifier) != 0;
+ m_metaKey = (event->modifiers() & Qt::MetaModifier) != 0;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/PlatformScreenQt.cpp b/WebCore/platform/qt/PlatformScreenQt.cpp
new file mode 100644
index 0000000..5bc86d0
--- /dev/null
+++ b/WebCore/platform/qt/PlatformScreenQt.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "PlatformScreen.h"
+
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "HostWindow.h"
+#include "Widget.h"
+#include <QApplication>
+#include <QDesktopWidget>
+
+namespace WebCore {
+
+int screenDepth(Widget* w)
+{
+ QDesktopWidget* d = QApplication::desktop();
+ QWidget *view = w->root()->hostWindow()->platformWindow();
+ int screenNumber = view ? d->screenNumber(view) : 0;
+ return d->screen(screenNumber)->depth();
+}
+
+int screenDepthPerComponent(Widget* w)
+{
+ QWidget *view = w->root()->hostWindow()->platformWindow();
+ return view ? view->depth() : QApplication::desktop()->screen(0)->depth();
+}
+
+bool screenIsMonochrome(Widget* w)
+{
+ QDesktopWidget* d = QApplication::desktop();
+ QWidget *view = w->root()->hostWindow()->platformWindow();
+ int screenNumber = view ? d->screenNumber(view) : 0;
+ return d->screen(screenNumber)->numColors() < 2;
+}
+
+FloatRect screenRect(Widget* w)
+{
+ QRect r = QApplication::desktop()->screenGeometry(w->root()->hostWindow()->platformWindow());
+ return FloatRect(r.x(), r.y(), r.width(), r.height());
+}
+
+FloatRect screenAvailableRect(Widget* w)
+{
+ QRect r = QApplication::desktop()->availableGeometry(w->root()->hostWindow()->platformWindow());
+ return FloatRect(r.x(), r.y(), r.width(), r.height());
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp
new file mode 100644
index 0000000..76728fa
--- /dev/null
+++ b/WebCore/platform/qt/PopupMenuQt.cpp
@@ -0,0 +1,122 @@
+/*
+ * This file is part of the popup menu implementation for <select> elements in WebCore.
+ *
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * Coypright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "PopupMenu.h"
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "HostWindow.h"
+#include "PopupMenuClient.h"
+#include "NotImplemented.h"
+#include "QWebPopup.h"
+
+#include <QAction>
+#include <QDebug>
+#include <QMenu>
+#include <QPoint>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QWidgetAction>
+
+namespace WebCore {
+
+PopupMenu::PopupMenu(PopupMenuClient* client)
+ : m_popupClient(client)
+{
+ m_popup = new QWebPopup(client);
+}
+
+PopupMenu::~PopupMenu()
+{
+ delete m_popup;
+}
+
+void PopupMenu::clear()
+{
+ m_popup->clear();
+}
+
+void PopupMenu::populate(const IntRect& r)
+{
+ clear();
+ Q_ASSERT(client());
+
+ int size = client()->listSize();
+ for (int i = 0; i < size; i++) {
+ if (client()->itemIsSeparator(i)) {
+ //FIXME: better seperator item
+ m_popup->insertItem(i, QString::fromLatin1("---"));
+ }
+ else {
+ //PopupMenuStyle style = client()->itemStyle(i);
+ m_popup->insertItem(i, client()->itemText(i));
+#if 0
+ item = new QListWidgetItem(client()->itemText(i));
+ m_actions.insert(item, i);
+ if (style->font() != Font())
+ item->setFont(style->font());
+
+ Qt::ItemFlags flags = Qt::ItemIsSelectable;
+ if (client()->itemIsEnabled(i))
+ flags |= Qt::ItemIsEnabled;
+ item->setFlags(flags);
+#endif
+ }
+ }
+}
+
+void PopupMenu::show(const IntRect& r, FrameView* v, int index)
+{
+ QWidget* window = v->hostWindow()->platformWindow();
+ populate(r);
+ QRect rect = r;
+ rect.moveTopLeft(v->contentsToWindow(r.topLeft()));
+ rect.setHeight(m_popup->sizeHint().height());
+
+ m_popup->setParent(window);
+ m_popup->setGeometry(rect);
+ m_popup->setCurrentIndex(index);
+ m_popup->exec();
+}
+
+void PopupMenu::hide()
+{
+ m_popup->hidePopup();
+}
+
+void PopupMenu::updateFromElement()
+{
+ client()->setTextFromItem(m_popupClient->selectedIndex());
+}
+
+bool PopupMenu::itemWritingDirectionIsNatural()
+{
+ return false;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/QWebPopup.cpp b/WebCore/platform/qt/QWebPopup.cpp
new file mode 100644
index 0000000..ae5c24e
--- /dev/null
+++ b/WebCore/platform/qt/QWebPopup.cpp
@@ -0,0 +1,73 @@
+/*
+ *
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#include "config.h"
+#include "QWebPopup.h"
+#include "PopupMenuStyle.h"
+
+#include <QCoreApplication>
+#include <QMouseEvent>
+
+namespace WebCore {
+
+QWebPopup::QWebPopup(PopupMenuClient* client)
+ : m_client(client)
+ , m_popupVisible(false)
+{
+ Q_ASSERT(m_client);
+
+ setFont(m_client->menuStyle().font().font());
+ connect(this, SIGNAL(activated(int)),
+ SLOT(activeChanged(int)));
+}
+
+
+void QWebPopup::exec()
+{
+ QMouseEvent event(QEvent::MouseButtonPress, QCursor::pos(), Qt::LeftButton,
+ Qt::LeftButton, Qt::NoModifier);
+ QCoreApplication::sendEvent(this, &event);
+}
+
+void QWebPopup::showPopup()
+{
+ QComboBox::showPopup();
+ m_popupVisible = true;
+}
+
+void QWebPopup::hidePopup()
+{
+ QComboBox::hidePopup();
+ if (!m_popupVisible)
+ return;
+
+ m_popupVisible = false;
+ m_client->hidePopup();
+}
+
+void QWebPopup::activeChanged(int index)
+{
+ if (index < 0)
+ return;
+
+ m_client->valueChanged(index);
+}
+
+}
diff --git a/WebCore/platform/qt/QWebPopup.h b/WebCore/platform/qt/QWebPopup.h
new file mode 100644
index 0000000..36d6781
--- /dev/null
+++ b/WebCore/platform/qt/QWebPopup.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef QWebPopup_h
+#define QWebPopup_h
+
+#include <QComboBox>
+
+#include "PopupMenuClient.h"
+
+namespace WebCore {
+
+class QWebPopup : public QComboBox {
+ Q_OBJECT
+public:
+ QWebPopup(PopupMenuClient* client);
+
+ void exec();
+
+ virtual void showPopup();
+ virtual void hidePopup();
+
+private slots:
+ void activeChanged(int);
+private:
+ PopupMenuClient* m_client;
+ bool m_popupVisible;
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp
new file mode 100644
index 0000000..2a33e45
--- /dev/null
+++ b/WebCore/platform/qt/RenderThemeQt.cpp
@@ -0,0 +1,947 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * 2006 Dirk Mueller <mueller@kde.org>
+ * 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+
+#include "qwebpage.h"
+#include "RenderThemeQt.h"
+#include "ChromeClientQt.h"
+#include "NotImplemented.h"
+
+#include <QApplication>
+#include <QColor>
+#include <QDebug>
+#include <QFile>
+#include <QWidget>
+#include <QPainter>
+#include <QPushButton>
+#include <QStyleFactory>
+#include <QStyleOptionButton>
+#include <QStyleOptionFrameV2>
+
+#include "Color.h"
+#include "CSSStyleSheet.h"
+#include "Document.h"
+#include "Page.h"
+#include "Font.h"
+#include "RenderTheme.h"
+#include "GraphicsContext.h"
+#include "HTMLMediaElement.h"
+#include "HTMLNames.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+
+StylePainter::StylePainter(const RenderObject::PaintInfo& paintInfo)
+{
+ init(paintInfo.context ? paintInfo.context : 0);
+}
+
+StylePainter::StylePainter(GraphicsContext* context)
+{
+ init(context);
+}
+
+void StylePainter::init(GraphicsContext* context)
+{
+ painter = static_cast<QPainter*>(context->platformContext());
+ widget = 0;
+ QPaintDevice* dev = 0;
+ if (painter)
+ dev = painter->device();
+ if (dev && dev->devType() == QInternal::Widget)
+ widget = static_cast<QWidget*>(dev);
+ style = (widget ? widget->style() : QApplication::style());
+
+ if (painter) {
+ // the styles often assume being called with a pristine painter where no brush is set,
+ // so reset it manually
+ oldBrush = painter->brush();
+ painter->setBrush(Qt::NoBrush);
+
+ // painting the widget with anti-aliasing will make it blurry
+ // disable it here and restore it later
+ oldAntialiasing = painter->testRenderHint(QPainter::Antialiasing);
+ painter->setRenderHint(QPainter::Antialiasing, false);
+ }
+}
+
+StylePainter::~StylePainter()
+{
+ if (painter) {
+ painter->setBrush(oldBrush);
+ painter->setRenderHints(QPainter::Antialiasing, oldAntialiasing);
+ }
+}
+
+RenderTheme* theme()
+{
+ static RenderThemeQt rt;
+ return &rt;
+}
+
+RenderThemeQt::RenderThemeQt()
+ : RenderTheme()
+{
+ QPushButton button;
+ button.setAttribute(Qt::WA_MacSmallSize);
+ QFont defaultButtonFont = QApplication::font(&button);
+ QFontInfo fontInfo(defaultButtonFont);
+ m_buttonFontFamily = defaultButtonFont.family();
+#ifdef Q_WS_MAC
+ m_buttonFontPixelSize = fontInfo.pixelSize();
+#endif
+
+ m_fallbackStyle = 0;
+}
+
+RenderThemeQt::~RenderThemeQt()
+{
+ delete m_fallbackStyle;
+}
+
+// for some widget painting, we need to fallback to Windows style
+QStyle* RenderThemeQt::fallbackStyle()
+{
+ if(!m_fallbackStyle)
+ m_fallbackStyle = QStyleFactory::create(QLatin1String("windows"));
+
+ if(!m_fallbackStyle)
+ m_fallbackStyle = QApplication::style();
+
+ return m_fallbackStyle;
+}
+
+bool RenderThemeQt::supportsHover(const RenderStyle*) const
+{
+ return true;
+}
+
+bool RenderThemeQt::supportsFocusRing(const RenderStyle* style) const
+{
+ return true; // Qt provides this through the style
+}
+
+int RenderThemeQt::baselinePosition(const RenderObject* o) const
+{
+ if (o->style()->appearance() == CheckboxPart ||
+ o->style()->appearance() == RadioPart)
+ return o->marginTop() + o->height() - 2; // Same as in old khtml
+ return RenderTheme::baselinePosition(o);
+}
+
+bool RenderThemeQt::controlSupportsTints(const RenderObject* o) const
+{
+ if (!isEnabled(o))
+ return false;
+
+ // Checkboxes only have tint when checked.
+ if (o->style()->appearance() == CheckboxPart)
+ return isChecked(o);
+
+ // For now assume other controls have tint if enabled.
+ return true;
+}
+
+bool RenderThemeQt::supportsControlTints() const
+{
+ return true;
+}
+
+static QRect inflateButtonRect(const QRect& originalRect)
+{
+ QStyleOptionButton option;
+ option.state |= QStyle::State_Small;
+ option.rect = originalRect;
+
+ QRect layoutRect = QApplication::style()->subElementRect(QStyle::SE_PushButtonLayoutItem,
+ &option, 0);
+ if (!layoutRect.isNull()) {
+ int paddingLeft = layoutRect.left() - originalRect.left();
+ int paddingRight = originalRect.right() - layoutRect.right();
+ int paddingTop = layoutRect.top() - originalRect.top();
+ int paddingBottom = originalRect.bottom() - layoutRect.bottom();
+
+ return originalRect.adjusted(-paddingLeft, -paddingTop, paddingRight, paddingBottom);
+ } else {
+ return originalRect;
+ }
+}
+
+void RenderThemeQt::adjustRepaintRect(const RenderObject* o, IntRect& r)
+{
+ switch (o->style()->appearance()) {
+ case CheckboxPart: {
+ break;
+ }
+ case RadioPart: {
+ break;
+ }
+ case PushButtonPart:
+ case ButtonPart: {
+ QRect inflatedRect = inflateButtonRect(r);
+ r = IntRect(inflatedRect.x(), inflatedRect.y(), inflatedRect.width(), inflatedRect.height());
+ break;
+ }
+ case MenulistPart: {
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+bool RenderThemeQt::isControlStyled(const RenderStyle* style, const BorderData& border,
+ const FillLayer& background, const Color& backgroundColor) const
+{
+ if (style->appearance() == TextFieldPart
+ || style->appearance() == TextAreaPart
+ || style->appearance() == ListboxPart) {
+ return style->border() != border;
+ }
+
+ return RenderTheme::isControlStyled(style, border, background, backgroundColor);
+}
+
+Color RenderThemeQt::platformActiveSelectionBackgroundColor() const
+{
+ QPalette pal = QApplication::palette();
+ return pal.brush(QPalette::Active, QPalette::Highlight).color();
+}
+
+Color RenderThemeQt::platformInactiveSelectionBackgroundColor() const
+{
+ QPalette pal = QApplication::palette();
+ return pal.brush(QPalette::Inactive, QPalette::Highlight).color();
+}
+
+Color RenderThemeQt::platformActiveSelectionForegroundColor() const
+{
+ QPalette pal = QApplication::palette();
+ return pal.brush(QPalette::Active, QPalette::HighlightedText).color();
+}
+
+Color RenderThemeQt::platformInactiveSelectionForegroundColor() const
+{
+ QPalette pal = QApplication::palette();
+ return pal.brush(QPalette::Inactive, QPalette::HighlightedText).color();
+}
+
+void RenderThemeQt::systemFont(int propId, FontDescription& fontDescription) const
+{
+ // no-op
+}
+
+int RenderThemeQt::minimumMenuListSize(RenderStyle*) const
+{
+ const QFontMetrics &fm = QApplication::fontMetrics();
+ return 7 * fm.width(QLatin1Char('x'));
+}
+
+static void computeSizeBasedOnStyle(RenderStyle* renderStyle)
+{
+ // If the width and height are both specified, then we have nothing to do.
+ if (!renderStyle->width().isIntrinsicOrAuto() && !renderStyle->height().isAuto())
+ return;
+
+ QSize size(0, 0);
+ const QFontMetrics fm(renderStyle->font().font());
+ QStyle* applicationStyle = QApplication::style();
+
+ switch (renderStyle->appearance()) {
+ case CheckboxPart: {
+ QStyleOption styleOption;
+ styleOption.state |= QStyle::State_Small;
+ int checkBoxWidth = applicationStyle->pixelMetric(QStyle::PM_IndicatorWidth,
+ &styleOption);
+ size = QSize(checkBoxWidth, checkBoxWidth);
+ break;
+ }
+ case RadioPart: {
+ QStyleOption styleOption;
+ styleOption.state |= QStyle::State_Small;
+ int radioWidth = applicationStyle->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth,
+ &styleOption);
+ size = QSize(radioWidth, radioWidth);
+ break;
+ }
+ case PushButtonPart:
+ case ButtonPart: {
+ QStyleOptionButton styleOption;
+ styleOption.state |= QStyle::State_Small;
+ QSize contentSize = fm.size(Qt::TextShowMnemonic, QString::fromLatin1("X"));
+ QSize pushButtonSize = applicationStyle->sizeFromContents(QStyle::CT_PushButton,
+ &styleOption,
+ contentSize,
+ 0);
+ styleOption.rect = QRect(0, 0, pushButtonSize.width(), pushButtonSize.height());
+ QRect layoutRect = applicationStyle->subElementRect(QStyle::SE_PushButtonLayoutItem,
+ &styleOption,
+ 0);
+ // If the style supports layout rects we use that, and
+ // compensate accordingly in paintButton() below.
+ if (!layoutRect.isNull()) {
+ size.setHeight(layoutRect.height());
+ } else {
+ size.setHeight(pushButtonSize.height());
+ }
+
+ break;
+ }
+ case MenulistPart: {
+ QStyleOptionComboBox styleOption;
+ styleOption.state |= QStyle::State_Small;
+ int contentHeight = qMax(fm.lineSpacing(), 14) + 2;
+ QSize menuListSize = applicationStyle->sizeFromContents(QStyle::CT_ComboBox,
+ &styleOption,
+ QSize(0, contentHeight),
+ 0);
+ size.setHeight(menuListSize.height());
+ break;
+ }
+ case TextFieldPart: {
+ const int verticalMargin = 1;
+ const int horizontalMargin = 2;
+ int h = qMax(fm.lineSpacing(), 14) + 2*verticalMargin;
+ int w = fm.width(QLatin1Char('x')) * 17 + 2*horizontalMargin;
+ QStyleOptionFrameV2 opt;
+ opt.lineWidth = applicationStyle->pixelMetric(QStyle::PM_DefaultFrameWidth,
+ &opt, 0);
+ QSize sz = applicationStyle->sizeFromContents(QStyle::CT_LineEdit,
+ &opt,
+ QSize(w, h).expandedTo(QApplication::globalStrut()),
+ 0);
+ size.setHeight(sz.height());
+ break;
+ }
+ default:
+ break;
+ }
+
+ // FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
+ if (renderStyle->width().isIntrinsicOrAuto() && size.width() > 0)
+ renderStyle->setWidth(Length(size.width(), Fixed));
+ if (renderStyle->height().isAuto() && size.height() > 0)
+ renderStyle->setHeight(Length(size.height(), Fixed));
+}
+
+void RenderThemeQt::setCheckboxSize(RenderStyle* style) const
+{
+ computeSizeBasedOnStyle(style);
+}
+
+bool RenderThemeQt::paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ return paintButton(o, i, r);
+}
+
+void RenderThemeQt::setRadioSize(RenderStyle* style) const
+{
+ computeSizeBasedOnStyle(style);
+}
+
+bool RenderThemeQt::paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ return paintButton(o, i, r);
+}
+
+void RenderThemeQt::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
+{
+ // Ditch the border.
+ style->resetBorder();
+
+ // Height is locked to auto.
+ style->setHeight(Length(Auto));
+
+ // White-space is locked to pre
+ style->setWhiteSpace(PRE);
+
+ FontDescription fontDescription = style->fontDescription();
+ fontDescription.setIsAbsoluteSize(true);
+
+#ifdef Q_WS_MAC // Use fixed font size and family on Mac (like Safari does)
+ fontDescription.setSpecifiedSize(m_buttonFontPixelSize);
+ fontDescription.setComputedSize(m_buttonFontPixelSize);
+#else
+ fontDescription.setSpecifiedSize(style->fontSize());
+ fontDescription.setComputedSize(style->fontSize());
+#endif
+
+ FontFamily fontFamily;
+ fontFamily.setFamily(m_buttonFontFamily);
+ fontDescription.setFamily(fontFamily);
+ style->setFontDescription(fontDescription);
+ style->setLineHeight(RenderStyle::initialLineHeight());
+
+ setButtonSize(style);
+ setButtonPadding(style);
+
+ style->setColor(QApplication::palette().text().color());
+}
+
+void RenderThemeQt::setButtonSize(RenderStyle* style) const
+{
+ computeSizeBasedOnStyle(style);
+}
+
+void RenderThemeQt::setButtonPadding(RenderStyle* style) const
+{
+ QStyleOptionButton styleOption;
+ styleOption.state |= QStyle::State_Small;
+
+ // Fake a button rect here, since we're just computing deltas
+ QRect originalRect = QRect(0, 0, 100, 30);
+ styleOption.rect = originalRect;
+
+ // Default padding is based on the button margin pixel metric
+ int buttonMargin = QApplication::style()->pixelMetric(QStyle::PM_ButtonMargin,
+ &styleOption, 0);
+ int paddingLeft = buttonMargin;
+ int paddingRight = buttonMargin;
+ int paddingTop = 1;
+ int paddingBottom = 0;
+
+ // Then check if the style uses layout margins
+ QRect layoutRect = QApplication::style()->subElementRect(QStyle::SE_PushButtonLayoutItem,
+ &styleOption, 0);
+ if (!layoutRect.isNull()) {
+ QRect contentsRect = QApplication::style()->subElementRect(QStyle::SE_PushButtonContents,
+ &styleOption, 0);
+ paddingLeft = contentsRect.left() - layoutRect.left();
+ paddingRight = layoutRect.right() - contentsRect.right();
+ paddingTop = contentsRect.top() - layoutRect.top();
+
+ // Can't use this right now because we don't have the baseline to compensate
+ // paddingBottom = layoutRect.bottom() - contentsRect.bottom();
+ }
+
+ style->setPaddingLeft(Length(paddingLeft, Fixed));
+ style->setPaddingRight(Length(paddingRight, Fixed));
+ style->setPaddingTop(Length(paddingTop, Fixed));
+ style->setPaddingBottom(Length(paddingBottom, Fixed));
+}
+
+bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ StylePainter p(i);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionButton option;
+ if (p.widget)
+ option.initFrom(p.widget);
+
+ option.rect = r;
+ option.state |= QStyle::State_Small;
+
+ ControlPart appearance = applyTheme(option, o);
+ if(appearance == PushButtonPart || appearance == ButtonPart) {
+ option.rect = inflateButtonRect(option.rect);
+ p.drawControl(QStyle::CE_PushButton, option);
+ } else if(appearance == RadioPart) {
+ p.drawControl(QStyle::CE_RadioButton, option);
+ } else if(appearance == CheckboxPart) {
+ p.drawControl(QStyle::CE_CheckBox, option);
+ }
+
+ return false;
+}
+
+void RenderThemeQt::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ style->setBackgroundColor(Color::transparent);
+ style->setColor(QApplication::palette().text().color());
+}
+
+bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ StylePainter p(i);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionFrameV2 panel;
+ if (p.widget)
+ panel.initFrom(p.widget);
+
+ panel.rect = r;
+ panel.lineWidth = p.style->pixelMetric(QStyle::PM_DefaultFrameWidth, &panel, p.widget);
+ panel.state |= QStyle::State_Sunken;
+ panel.features = QStyleOptionFrameV2::None;
+
+ // Get the correct theme data for a text field
+ ControlPart appearance = applyTheme(panel, o);
+ if (appearance != TextFieldPart
+ && appearance != SearchFieldPart
+ && appearance != TextAreaPart
+ && appearance != ListboxPart)
+ return true;
+
+ // Now paint the text field.
+ p.drawPrimitive(QStyle::PE_PanelLineEdit, panel);
+
+ return false;
+}
+
+void RenderThemeQt::adjustTextAreaStyle(CSSStyleSelector* selector, RenderStyle* style, Element* element) const
+{
+ adjustTextFieldStyle(selector, style, element);
+}
+
+bool RenderThemeQt::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ return paintTextField(o, i, r);
+}
+
+void RenderThemeQt::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ style->resetBorder();
+
+ // Height is locked to auto.
+ style->setHeight(Length(Auto));
+
+ // White-space is locked to pre
+ style->setWhiteSpace(PRE);
+
+ computeSizeBasedOnStyle(style);
+
+ // Add in the padding that we'd like to use.
+ setPopupPadding(style);
+
+ style->setColor(QApplication::palette().text().color());
+}
+
+void RenderThemeQt::setPopupPadding(RenderStyle* style) const
+{
+ const int padding = 8;
+ style->setPaddingLeft(Length(padding, Fixed));
+
+ QStyleOptionComboBox opt;
+ int w = QApplication::style()->pixelMetric(QStyle::PM_ButtonIconSize, &opt, 0);
+ style->setPaddingRight(Length(padding + w, Fixed));
+
+ style->setPaddingTop(Length(2, Fixed));
+ style->setPaddingBottom(Length(0, Fixed));
+}
+
+
+bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r)
+{
+ StylePainter p(i);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionComboBox opt;
+ if (p.widget)
+ opt.initFrom(p.widget);
+ ControlPart appearance = applyTheme(opt, o);
+
+ const QPoint topLeft = r.topLeft();
+ p.painter->translate(topLeft);
+ opt.rect.moveTo(QPoint(0,0));
+ opt.rect.setSize(r.size());
+
+ opt.frame = false;
+
+ p.drawComplexControl(QStyle::CC_ComboBox, opt);
+ p.painter->translate(-topLeft);
+ return false;
+}
+
+void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style,
+ Element* e) const
+{
+ // WORKAROUND because html4.css specifies -webkit-border-radius for <select> so we override it here
+ // see also http://bugs.webkit.org/show_bug.cgi?id=18399
+ style->resetBorderRadius();
+
+ // Height is locked to auto.
+ style->setHeight(Length(Auto));
+
+ // White-space is locked to pre
+ style->setWhiteSpace(PRE);
+
+ computeSizeBasedOnStyle(style);
+
+ // Add in the padding that we'd like to use.
+ setPopupPadding(style);
+
+ style->setColor(QApplication::palette().text().color());
+}
+
+bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i,
+ const IntRect& r)
+{
+ StylePainter p(i);
+ if (!p.isValid())
+ return true;
+
+ QStyleOptionComboBox option;
+ if (p.widget)
+ option.initFrom(p.widget);
+ applyTheme(option, o);
+ option.rect = r;
+
+ // for drawing the combo box arrow, rely only on the fallback style
+ p.style = fallbackStyle();
+ option.subControls = QStyle::SC_ComboBoxArrow;
+ p.drawComplexControl(QStyle::CC_ComboBox, option);
+
+ return false;
+}
+
+bool RenderThemeQt::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ notImplemented();
+ return RenderTheme::paintSliderTrack(o, pi, r);
+}
+
+bool RenderThemeQt::paintSliderThumb(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ notImplemented();
+ return RenderTheme::paintSliderThumb(o, pi, r);
+}
+
+bool RenderThemeQt::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ paintTextField(o, pi, r);
+ return false;
+}
+
+void RenderThemeQt::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderStyle* style,
+ Element* e) const
+{
+ notImplemented();
+ RenderTheme::adjustSearchFieldStyle(selector, style, e);
+}
+
+void RenderThemeQt::adjustSearchFieldCancelButtonStyle(CSSStyleSelector* selector, RenderStyle* style,
+ Element* e) const
+{
+ notImplemented();
+ RenderTheme::adjustSearchFieldCancelButtonStyle(selector, style, e);
+}
+
+bool RenderThemeQt::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ notImplemented();
+ return RenderTheme::paintSearchFieldCancelButton(o, pi, r);
+}
+
+void RenderThemeQt::adjustSearchFieldDecorationStyle(CSSStyleSelector* selector, RenderStyle* style,
+ Element* e) const
+{
+ notImplemented();
+ RenderTheme::adjustSearchFieldDecorationStyle(selector, style, e);
+}
+
+bool RenderThemeQt::paintSearchFieldDecoration(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ notImplemented();
+ return RenderTheme::paintSearchFieldDecoration(o, pi, r);
+}
+
+void RenderThemeQt::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* selector, RenderStyle* style,
+ Element* e) const
+{
+ notImplemented();
+ RenderTheme::adjustSearchFieldResultsDecorationStyle(selector, style, e);
+}
+
+bool RenderThemeQt::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& pi,
+ const IntRect& r)
+{
+ notImplemented();
+ return RenderTheme::paintSearchFieldResultsDecoration(o, pi, r);
+}
+
+bool RenderThemeQt::supportsFocus(ControlPart appearance) const
+{
+ switch (appearance) {
+ case PushButtonPart:
+ case ButtonPart:
+ case TextFieldPart:
+ case TextAreaPart:
+ case ListboxPart:
+ case MenulistPart:
+ case RadioPart:
+ case CheckboxPart:
+ return true;
+ default: // No for all others...
+ return false;
+ }
+}
+
+ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const
+{
+ // Default bits: no focus, no mouse over
+ option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
+
+ if (!isEnabled(o))
+ option.state &= ~QStyle::State_Enabled;
+
+ if (isReadOnlyControl(o))
+ // Readonly is supported on textfields.
+ option.state |= QStyle::State_ReadOnly;
+
+ if (supportsFocus(o->style()->appearance()) && isFocused(o))
+ option.state |= QStyle::State_HasFocus;
+
+ if (isHovered(o))
+ option.state |= QStyle::State_MouseOver;
+
+ ControlPart result = o->style()->appearance();
+
+ switch (result) {
+ case PushButtonPart:
+ case SquareButtonPart:
+ case ButtonPart:
+ case ButtonBevelPart:
+ case ListItemPart:
+ case MenulistButtonPart:
+ case SearchFieldResultsButtonPart:
+ case SearchFieldCancelButtonPart: {
+ if (isPressed(o))
+ option.state |= QStyle::State_Sunken;
+ else if (result == PushButtonPart)
+ option.state |= QStyle::State_Raised;
+ break;
+ }
+ }
+
+ if(result == RadioPart || result == CheckboxPart)
+ option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
+
+ // If the webview has a custom palette, use it
+ Page* page = o->document()->page();
+ if (page) {
+ QWidget* view = static_cast<ChromeClientQt*>(page->chrome()->client())->m_webPage->view();
+ if (view)
+ option.palette = view->palette();
+ }
+
+ return result;
+}
+
+void RenderTheme::adjustDefaultStyleSheet(CSSStyleSheet* style)
+{
+ QFile platformStyleSheet(":/webcore/resources/html4-adjustments-qt.css");
+ if (platformStyleSheet.open(QFile::ReadOnly)) {
+ QByteArray sheetData = platformStyleSheet.readAll();
+ style->parseString(QString::fromUtf8(sheetData.constData(), sheetData.length()));
+ }
+}
+
+#if ENABLE(VIDEO)
+
+// Helper class to transform the painter's world matrix to the object's content area, scaled to 0,0,100,100
+class WorldMatrixTransformer
+{
+public:
+ WorldMatrixTransformer(QPainter* painter, RenderObject* renderObject, const IntRect& r) : m_painter(painter) {
+ RenderStyle* style = renderObject->style();
+ m_originalTransform = m_painter->transform();
+ m_painter->translate(r.x() + style->paddingLeft().value(), r.y() + style->paddingTop().value());
+ m_painter->scale((r.width() - style->paddingLeft().value() - style->paddingRight().value()) / 100.0,
+ (r.height() - style->paddingTop().value() - style->paddingBottom().value()) / 100.0);
+ }
+
+ ~WorldMatrixTransformer() { m_painter->setTransform(m_originalTransform); }
+
+private:
+ QPainter* m_painter;
+ QTransform m_originalTransform;
+};
+
+HTMLMediaElement* RenderThemeQt::getMediaElementFromRenderObject(RenderObject* o) const
+{
+ Node* node = o->element();
+ Node* mediaNode = node ? node->shadowAncestorNode() : 0;
+ if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag)))
+ return 0;
+
+ return static_cast<HTMLMediaElement*>(mediaNode);
+}
+
+void RenderThemeQt::paintMediaBackground(QPainter* painter, const IntRect& r) const
+{
+ painter->setPen(Qt::NoPen);
+ static QColor transparentBlack(0,0,0,100);
+ painter->setBrush(transparentBlack);
+ painter->drawRoundedRect(r.x(), r.y(), r.width(), r.height(), 5.0, 5.0);
+}
+
+QColor RenderThemeQt::getMediaControlForegroundColor(RenderObject* o) const
+{
+ QColor fgColor = platformActiveSelectionBackgroundColor();
+ if (o && o->element()->active())
+ fgColor = fgColor.lighter();
+ return fgColor;
+}
+
+bool RenderThemeQt::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ return RenderTheme::paintMediaFullscreenButton(o, paintInfo, r);
+}
+
+bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o);
+ if (!mediaElement)
+ return false;
+
+ StylePainter p(paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ paintMediaBackground(p.painter, r);
+
+ WorldMatrixTransformer transformer(p.painter, o, r);
+ const QPointF speakerPolygon[6] = { QPointF(20, 30), QPointF(50, 30), QPointF(80, 0),
+ QPointF(80, 100), QPointF(50, 70), QPointF(20, 70)};
+
+ p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->drawPolygon(speakerPolygon, 6);
+
+ if (mediaElement->muted()) {
+ p.painter->setPen(Qt::red);
+ p.painter->drawLine(0, 100, 100, 0);
+ }
+
+ return false;
+}
+
+bool RenderThemeQt::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o);
+ if (!mediaElement)
+ return false;
+
+ StylePainter p(paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ paintMediaBackground(p.painter, r);
+
+ WorldMatrixTransformer transformer(p.painter, o, r);
+ p.painter->setBrush(getMediaControlForegroundColor(o));
+ if (mediaElement->canPlay()) {
+ const QPointF playPolygon[3] = { QPointF(0, 0), QPointF(100, 50), QPointF(0, 100)};
+ p.painter->drawPolygon(playPolygon, 3);
+ } else {
+ p.painter->drawRect(0, 0, 30, 100);
+ p.painter->drawRect(70, 0, 30, 100);
+ }
+
+ return false;
+}
+
+bool RenderThemeQt::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ // We don't want to paint this at the moment.
+ return false;
+}
+
+bool RenderThemeQt::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ // We don't want to paint this at the moment.
+ return false;
+}
+
+bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o);
+ if (!mediaElement)
+ return false;
+
+ StylePainter p(paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ paintMediaBackground(p.painter, r);
+
+ if (MediaPlayer* player = mediaElement->player()) {
+ if (player->totalBytesKnown()) {
+ float percentLoaded = static_cast<float>(player->bytesLoaded()) / player->totalBytes();
+
+ WorldMatrixTransformer transformer(p.painter, o, r);
+ p.painter->setBrush(getMediaControlForegroundColor());
+ p.painter->drawRect(0, 37, 100 * percentLoaded, 26);
+ }
+ }
+
+ return false;
+}
+
+bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+ HTMLMediaElement* mediaElement = getMediaElementFromRenderObject(o->parent());
+ if (!mediaElement)
+ return false;
+
+ StylePainter p(paintInfo);
+ if (!p.isValid())
+ return true;
+
+ p.painter->setRenderHint(QPainter::Antialiasing, true);
+
+ p.painter->setPen(Qt::NoPen);
+ p.painter->setBrush(getMediaControlForegroundColor(o));
+ p.painter->drawRect(r.x(), r.y(), r.width(), r.height());
+
+ return false;
+}
+#endif
+
+void RenderThemeQt::adjustSliderThumbSize(RenderObject* o) const
+{
+ if (o->style()->appearance() == MediaSliderThumbPart) {
+ RenderStyle* parentStyle = o->parent()->style();
+ Q_ASSERT(parentStyle);
+
+ int parentHeight = parentStyle->height().value();
+ o->style()->setWidth(Length(parentHeight / 3, Fixed));
+ o->style()->setHeight(Length(parentHeight, Fixed));
+ }
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h
new file mode 100644
index 0000000..76e1855
--- /dev/null
+++ b/WebCore/platform/qt/RenderThemeQt.h
@@ -0,0 +1,174 @@
+/*
+ * This file is part of the theme implementation for form controls in WebCore.
+ *
+ * Copyright (C) 2007 Trolltech
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef RenderThemeQt_H
+#define RenderThemeQt_H
+
+#include "RenderTheme.h"
+
+#include <QStyle>
+
+QT_BEGIN_NAMESPACE
+class QPainter;
+class QWidget;
+QT_END_NAMESPACE
+
+namespace WebCore {
+
+class RenderStyle;
+class HTMLMediaElement;
+
+class RenderThemeQt : public RenderTheme
+{
+public:
+ RenderThemeQt();
+ virtual ~RenderThemeQt();
+
+ virtual bool supportsHover(const RenderStyle*) const;
+ virtual bool supportsFocusRing(const RenderStyle* style) const;
+
+ virtual int baselinePosition(const RenderObject* o) const;
+
+ // A method asking if the control changes its tint when the window has focus or not.
+ virtual bool controlSupportsTints(const RenderObject*) const;
+
+ // A general method asking if any control tinting is supported at all.
+ virtual bool supportsControlTints() const;
+
+ virtual void adjustRepaintRect(const RenderObject* o, IntRect& r);
+
+ virtual bool isControlStyled(const RenderStyle*, const BorderData&,
+ const FillLayer&, const Color&) const;
+
+ // The platform selection color.
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+
+ virtual void systemFont(int propId, FontDescription&) const;
+
+ virtual int minimumMenuListSize(RenderStyle*) const;
+
+ virtual void adjustSliderThumbSize(RenderObject*) const;
+
+protected:
+ virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void setButtonSize(RenderStyle*) const;
+
+ virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintTextArea(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustTextAreaStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r);
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual bool paintSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual bool paintSearchField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+
+ virtual void adjustSearchFieldCancelButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldCancelButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+ virtual void adjustSearchFieldResultsDecorationStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintSearchFieldResultsDecoration(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+#if ENABLE(VIDEO)
+ virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+ virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+
+private:
+ HTMLMediaElement* getMediaElementFromRenderObject(RenderObject* o) const;
+ void paintMediaBackground(QPainter* painter, const IntRect& r) const;
+ QColor getMediaControlForegroundColor(RenderObject* o = 0) const;
+#endif
+
+private:
+ bool supportsFocus(ControlPart) const;
+
+ ControlPart applyTheme(QStyleOption&, RenderObject*) const;
+
+ void setButtonPadding(RenderStyle*) const;
+ void setPopupPadding(RenderStyle*) const;
+
+#ifdef Q_WS_MAC
+ int m_buttonFontPixelSize;
+#endif
+ QString m_buttonFontFamily;
+
+ QStyle* m_fallbackStyle;
+ QStyle* fallbackStyle();
+};
+
+class StylePainter
+{
+public:
+ explicit StylePainter(const RenderObject::PaintInfo& paintInfo);
+ explicit StylePainter(GraphicsContext* context);
+ ~StylePainter();
+
+ bool isValid() const { return painter && style; }
+
+ QPainter* painter;
+ QWidget* widget;
+ QStyle* style;
+
+ void drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption& opt)
+ { style->drawPrimitive(pe, &opt, painter, widget); }
+ void drawControl(QStyle::ControlElement ce, const QStyleOption& opt)
+ { style->drawControl(ce, &opt, painter, widget); }
+ void drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex& opt)
+ { style->drawComplexControl(cc, &opt, painter, widget); }
+
+private:
+ void init(GraphicsContext* context);
+
+ QBrush oldBrush;
+ bool oldAntialiasing;
+
+ Q_DISABLE_COPY(StylePainter)
+};
+
+}
+
+#endif
diff --git a/WebCore/platform/qt/ScreenQt.cpp b/WebCore/platform/qt/ScreenQt.cpp
new file mode 100644
index 0000000..eda1446
--- /dev/null
+++ b/WebCore/platform/qt/ScreenQt.cpp
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 "Page.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "Widget.h"
+#include "IntRect.h"
+#include "FloatRect.h"
+
+#include <QApplication>
+#include <QDesktopWidget>
+
+namespace WebCore {
+
+static QWidget* qwidgetForPage(const Page* page)
+{
+ Frame* frame = (page ? page->mainFrame() : 0);
+ FrameView* frameView = (frame ? frame->view() : 0);
+
+ if (!frameView)
+ return 0;
+
+ return frameView->qwidget();
+}
+
+FloatRect screenRect(const Page* page)
+{
+ QWidget* qw = qwidgetForPage(page);
+ if (!qw)
+ return FloatRect();
+
+ // Taken from KGlobalSettings::desktopGeometry
+ QDesktopWidget* dw = QApplication::desktop();
+ if (!dw)
+ return FloatRect();
+
+ return IntRect(dw->screenGeometry(qw));
+}
+
+int screenDepth(const Page* page)
+{
+ QWidget* qw = qwidgetForPage(page);
+ if (!qw)
+ return 32;
+
+ return qw->depth();
+}
+
+FloatRect usableScreenRect(const Page* page)
+{
+ QWidget* qw = qwidgetForPage(page);
+ if (!qw)
+ return FloatRect();
+
+ // Taken from KGlobalSettings::desktopGeometry
+ QDesktopWidget* dw = QApplication::desktop();
+ if (!dw)
+ return FloatRect();
+
+ return IntRect(dw->availableGeometry(qw));
+}
+
+float scaleFactor(const Page*)
+{
+ return 1.0f;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ScrollViewQt.cpp b/WebCore/platform/qt/ScrollViewQt.cpp
new file mode 100644
index 0000000..76d9f01
--- /dev/null
+++ b/WebCore/platform/qt/ScrollViewQt.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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"
+
+namespace WebCore {
+
+void ScrollView::platformInit()
+{
+ m_widgetsThatPreventBlitting = 0;
+}
+
+void ScrollView::platformDestroy()
+{
+}
+
+void ScrollView::platformAddChild(Widget* child)
+{
+ root()->m_widgetsThatPreventBlitting++;
+ if (parent())
+ parent()->platformAddChild(child);
+}
+
+void ScrollView::platformRemoveChild(Widget* child)
+{
+ ASSERT(root()->m_widgetsThatPreventBlitting);
+ root()->m_widgetsThatPreventBlitting--;
+ child->hide();
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ScrollbarQt.cpp b/WebCore/platform/qt/ScrollbarQt.cpp
new file mode 100644
index 0000000..2d65282
--- /dev/null
+++ b/WebCore/platform/qt/ScrollbarQt.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 "Scrollbar.h"
+
+#include "EventHandler.h"
+#include "FrameView.h"
+#include "Frame.h"
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "PlatformMouseEvent.h"
+#include "ScrollbarTheme.h"
+
+#include <QApplication>
+#include <QDebug>
+#include <QPainter>
+#include <QStyle>
+#include <QMenu>
+
+using namespace std;
+
+namespace WebCore {
+
+bool Scrollbar::contextMenu(const PlatformMouseEvent& event)
+{
+#ifndef QT_NO_CONTEXTMENU
+ bool horizontal = (m_orientation == HorizontalScrollbar);
+
+ QMenu menu;
+ QAction* actScrollHere = menu.addAction(QCoreApplication::translate("QWebPage", "Scroll here"));
+ menu.addSeparator();
+
+ QAction* actScrollTop = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Left edge") : QCoreApplication::translate("QWebPage", "Top"));
+ QAction* actScrollBottom = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Right edge") : QCoreApplication::translate("QWebPage", "Bottom"));
+ menu.addSeparator();
+
+ QAction* actPageUp = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Page left") : QCoreApplication::translate("QWebPage", "Page up"));
+ QAction* actPageDown = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Page right") : QCoreApplication::translate("QWebPage", "Page down"));
+ menu.addSeparator();
+
+ QAction* actScrollUp = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Scroll left") : QCoreApplication::translate("QWebPage", "Scroll up"));
+ QAction* actScrollDown = menu.addAction(horizontal ? QCoreApplication::translate("QWebPage", "Scroll right") : QCoreApplication::translate("QWebPage", "Scroll down"));
+
+ const QPoint globalPos = QPoint(event.globalX(), event.globalY());
+ QAction* actionSelected = menu.exec(globalPos);
+
+ if (actionSelected == 0)
+ /* Do nothing */ ;
+ else if (actionSelected == actScrollHere) {
+ const QPoint pos = convertFromContainingWindow(event.pos());
+ moveThumb(horizontal ? pos.x() : pos.y());
+ } else if (actionSelected == actScrollTop)
+ setValue(0);
+ else if (actionSelected == actScrollBottom)
+ setValue(maximum());
+ else if (actionSelected == actPageUp)
+ scroll(horizontal ? ScrollLeft: ScrollUp, ScrollByPage, 1);
+ else if (actionSelected == actPageDown)
+ scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage, 1);
+ else if (actionSelected == actScrollUp)
+ scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine, 1);
+ else if (actionSelected == actScrollDown)
+ scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine, 1);
+#endif // QT_NO_CONTEXTMENU
+ return true;
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/ScrollbarThemeQt.cpp b/WebCore/platform/qt/ScrollbarThemeQt.cpp
new file mode 100644
index 0000000..1995719
--- /dev/null
+++ b/WebCore/platform/qt/ScrollbarThemeQt.cpp
@@ -0,0 +1,244 @@
+/*
+ * Copyright (C) 2007, 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2007 Staikos Computing Services Inc. <info@staikos.net>
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 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 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 "ScrollbarThemeQt.h"
+
+#include "GraphicsContext.h"
+#include "PlatformMouseEvent.h"
+#include "RenderThemeQt.h"
+#include "Scrollbar.h"
+#include "ScrollView.h"
+
+#include <QApplication>
+#include <QDebug>
+#include <QPainter>
+#include <QStyle>
+#include <QStyleOptionSlider>
+#include <QMenu>
+
+namespace WebCore {
+
+ScrollbarTheme* ScrollbarTheme::nativeTheme()
+{
+ static ScrollbarThemeQt theme;
+ return &theme;
+}
+
+ScrollbarThemeQt::~ScrollbarThemeQt()
+{
+}
+
+static QStyle::SubControl scPart(const ScrollbarPart& part)
+{
+ switch (part) {
+ case NoPart:
+ return QStyle::SC_None;
+ case BackButtonStartPart:
+ case BackButtonEndPart:
+ return QStyle::SC_ScrollBarSubLine;
+ case BackTrackPart:
+ return QStyle::SC_ScrollBarSubPage;
+ case ThumbPart:
+ return QStyle::SC_ScrollBarSlider;
+ case ForwardTrackPart:
+ return QStyle::SC_ScrollBarAddPage;
+ case ForwardButtonStartPart:
+ case ForwardButtonEndPart:
+ return QStyle::SC_ScrollBarAddLine;
+ }
+
+ return QStyle::SC_None;
+}
+
+static ScrollbarPart scrollbarPart(const QStyle::SubControl& sc)
+{
+ switch (sc) {
+ case QStyle::SC_None:
+ return NoPart;
+ case QStyle::SC_ScrollBarSubLine:
+ return BackButtonStartPart;
+ case QStyle::SC_ScrollBarSubPage:
+ return BackTrackPart;
+ case QStyle::SC_ScrollBarSlider:
+ return ThumbPart;
+ case QStyle::SC_ScrollBarAddPage:
+ return ForwardTrackPart;
+ case QStyle::SC_ScrollBarAddLine:
+ return ForwardButtonStartPart;
+ }
+ return NoPart;
+}
+
+static QStyleOptionSlider* styleOptionSlider(Scrollbar* scrollbar)
+{
+ static QStyleOptionSlider opt;
+ opt.rect = scrollbar->frameRect();
+ opt.state = 0;
+ if (scrollbar->enabled())
+ opt.state |= QStyle::State_Enabled;
+ if (scrollbar->controlSize() != RegularScrollbar)
+ opt.state |= QStyle::State_Mini;
+ opt.orientation = (scrollbar->orientation() == VerticalScrollbar) ? Qt::Vertical : Qt::Horizontal;
+ if (scrollbar->orientation() == HorizontalScrollbar)
+ opt.state |= QStyle::State_Horizontal;
+ opt.sliderValue = scrollbar->value();
+ opt.sliderPosition = opt.sliderValue;
+ opt.pageStep = scrollbar->visibleSize();
+ opt.singleStep = scrollbar->lineStep();
+ opt.minimum = 0;
+ opt.maximum = qMax(0, scrollbar->maximum());
+ ScrollbarPart pressedPart = scrollbar->pressedPart();
+ ScrollbarPart hoveredPart = scrollbar->hoveredPart();
+ if (pressedPart != NoPart) {
+ opt.activeSubControls = scPart(scrollbar->pressedPart());
+ if (pressedPart == BackButtonStartPart || pressedPart == ForwardButtonStartPart ||
+ pressedPart == BackButtonEndPart || pressedPart == ForwardButtonEndPart ||
+ pressedPart == ThumbPart)
+ opt.state |= QStyle::State_Sunken;
+ } else
+ opt.activeSubControls = scPart(hoveredPart);
+ if (hoveredPart != NoPart)
+ opt.state |= QStyle::State_MouseOver;
+ return &opt;
+}
+
+bool ScrollbarThemeQt::paint(Scrollbar* scrollbar, GraphicsContext* graphicsContext, const IntRect& damageRect)
+{
+ if (graphicsContext->updatingControlTints()) {
+ scrollbar->invalidateRect(damageRect);
+ return false;
+ }
+
+ StylePainter p(graphicsContext);
+ if (!p.isValid())
+ return true;
+
+ p.painter->save();
+ QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
+ p.painter->setClipRect(opt->rect.intersected(damageRect));
+
+#ifdef Q_WS_MAC
+ p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
+#else
+ const QPoint topLeft = opt->rect.topLeft();
+ p.painter->translate(topLeft);
+ opt->rect.moveTo(QPoint(0, 0));
+
+ // The QStyle expects the background to be already filled
+ p.painter->fillRect(opt->rect, opt->palette.background());
+
+ p.drawComplexControl(QStyle::CC_ScrollBar, *opt);
+ opt->rect.moveTo(topLeft);
+#endif
+ p.painter->restore();
+
+ return true;
+}
+
+ScrollbarPart ScrollbarThemeQt::hitTest(Scrollbar* scrollbar, const PlatformMouseEvent& evt)
+{
+ QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
+ const QPoint pos = scrollbar->convertFromContainingWindow(evt.pos());
+ opt->rect.moveTo(QPoint(0, 0));
+ QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0);
+ return scrollbarPart(sc);
+}
+
+bool ScrollbarThemeQt::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt)
+{
+ // Middle click centers slider thumb (if supported)
+ return QApplication::style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton;
+}
+
+void ScrollbarThemeQt::invalidatePart(Scrollbar* scrollbar, ScrollbarPart)
+{
+ // FIXME: Do more precise invalidation.
+ scrollbar->invalidate();
+}
+
+int ScrollbarThemeQt::scrollbarThickness(ScrollbarControlSize controlSize)
+{
+ QStyle* s = QApplication::style();
+ QStyleOptionSlider o;
+ o.orientation = Qt::Vertical;
+ o.state &= ~QStyle::State_Horizontal;
+ if (controlSize != RegularScrollbar)
+ o.state |= QStyle::State_Mini;
+ return s->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0);
+}
+
+int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar)
+{
+ if (scrollbar->enabled())
+ return (int)((float)scrollbar->currentPos() * (trackLength(scrollbar) - thumbLength(scrollbar)) / scrollbar->maximum());
+ return 0;
+}
+
+int ScrollbarThemeQt::thumbLength(Scrollbar* scrollbar)
+{
+ QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
+ IntRect thumb = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0);
+ return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height();
+}
+
+int ScrollbarThemeQt::trackPosition(Scrollbar* scrollbar)
+{
+ QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
+ IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);
+ return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y();
+}
+
+int ScrollbarThemeQt::trackLength(Scrollbar* scrollbar)
+{
+ QStyleOptionSlider* opt = styleOptionSlider(scrollbar);
+ IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0);
+ return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height();
+}
+
+void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext* context, const IntRect& rect)
+{
+ if (context->updatingControlTints()) {
+ scrollView->invalidateRect(rect);
+ return;
+ }
+
+#if QT_VERSION < 0x040500
+ context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window));
+#else
+ StylePainter p(context);
+ if (!p.isValid())
+ return;
+
+ QStyleOption option;
+ option.rect = rect;
+ p.drawPrimitive(QStyle::PE_PanelScrollAreaCorner, option);
+#endif
+}
+
+}
+
diff --git a/WebCore/platform/qt/ScrollbarThemeQt.h b/WebCore/platform/qt/ScrollbarThemeQt.h
new file mode 100644
index 0000000..787b15a
--- /dev/null
+++ b/WebCore/platform/qt/ScrollbarThemeQt.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008 Apple Inc. 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 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 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 ScrollbarThemeQt_h
+#define ScrollbarThemeQt_h
+
+#include "ScrollbarTheme.h"
+
+namespace WebCore {
+
+class ScrollbarThemeQt : public ScrollbarTheme {
+public:
+ virtual ~ScrollbarThemeQt();
+
+ virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& damageRect);
+ virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect);
+
+ virtual ScrollbarPart hitTest(Scrollbar*, const PlatformMouseEvent&);
+
+ virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&);
+
+ virtual void invalidatePart(Scrollbar*, ScrollbarPart);
+
+ virtual int thumbPosition(Scrollbar*);
+ virtual int thumbLength(Scrollbar*);
+ virtual int trackPosition(Scrollbar*);
+ virtual int trackLength(Scrollbar*);
+
+ virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
+};
+
+}
+#endif
diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/qt/SearchPopupMenuQt.cpp
new file mode 100644
index 0000000..7822b2c
--- /dev/null
+++ b/WebCore/platform/qt/SearchPopupMenuQt.cpp
@@ -0,0 +1,45 @@
+/*
+ * Copyright C 2006 Zack Rusin <zack@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "SearchPopupMenu.h"
+
+#include "AtomicString.h"
+
+namespace WebCore {
+
+SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client)
+ : PopupMenu(client)
+{
+}
+
+void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+{
+}
+
+void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+{
+}
+
+bool SearchPopupMenu::enabled()
+{
+ return true;
+}
+
+}
diff --git a/WebCore/platform/qt/SharedBufferQt.cpp b/WebCore/platform/qt/SharedBufferQt.cpp
new file mode 100644
index 0000000..38ba6d1
--- /dev/null
+++ b/WebCore/platform/qt/SharedBufferQt.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 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 "SharedBuffer.h"
+
+#include <QFile>
+
+namespace WebCore {
+
+PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fileName)
+{
+ if (fileName.isEmpty())
+ return 0;
+
+ QFile file(fileName);
+ if (!file.exists() || !file.open(QFile::ReadOnly))
+ return 0;
+
+
+ RefPtr<SharedBuffer> result = SharedBuffer::create();
+ result->m_buffer.resize(file.size());
+ if (result->m_buffer.size() != file.size())
+ return 0;
+
+ file.read(result->m_buffer.data(), result->m_buffer.size());
+ return result.release();
+}
+
+}
diff --git a/WebCore/platform/qt/SharedTimerQt.cpp b/WebCore/platform/qt/SharedTimerQt.cpp
new file mode 100644
index 0000000..49f55c1
--- /dev/null
+++ b/WebCore/platform/qt/SharedTimerQt.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ *
+ * 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 "SharedTimerQt.h"
+
+#include <QApplication>
+
+namespace WebCore {
+
+SharedTimerQt* SharedTimerQt::s_self = 0; // FIXME: staticdeleter
+
+void setSharedTimerFiredFunction(void (*f)())
+{
+ SharedTimerQt::inst()->m_timerFunction = f;
+}
+
+void setSharedTimerFireTime(double fireTime)
+{
+ if (!qApp)
+ return;
+
+ qreal fireTimeMs = (fireTime - currentTime()) * 1000;
+ SharedTimerQt::inst()->start(qMax(0, int(fireTimeMs)));
+}
+
+void stopSharedTimer()
+{
+ SharedTimerQt::inst()->stop();
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/SharedTimerQt.h b/WebCore/platform/qt/SharedTimerQt.h
new file mode 100644
index 0000000..30e1e21
--- /dev/null
+++ b/WebCore/platform/qt/SharedTimerQt.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ *
+ * 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 SharedTimerQt_h
+#define SharedTimerQt_h
+
+#include "SharedTimerQt.h"
+#include "SystemTime.h"
+
+#include <QTimer>
+#include <QCoreApplication>
+
+namespace WebCore {
+
+class SharedTimerQt : public QTimer {
+Q_OBJECT
+protected:
+ SharedTimerQt()
+ : QTimer()
+ , m_timerFunction(0)
+ {
+ connect(this, SIGNAL(timeout()), this, SLOT(fire()));
+ setSingleShot(true);
+ }
+
+ ~SharedTimerQt()
+ {
+ }
+
+public:
+ static void cleanup()
+ {
+ if (s_self->isActive())
+ s_self->fire();
+
+ delete s_self;
+ s_self = 0;
+ }
+
+ static SharedTimerQt* inst()
+ {
+ if (!s_self) {
+ s_self = new SharedTimerQt();
+ qAddPostRoutine(SharedTimerQt::cleanup);
+ }
+
+ return s_self;
+ }
+
+ void (*m_timerFunction)();
+
+public Q_SLOTS:
+ void fire()
+ {
+ if (m_timerFunction)
+ (m_timerFunction)();
+ }
+
+private:
+ static SharedTimerQt* s_self;
+};
+
+}
+
+#endif
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/SoundQt.cpp b/WebCore/platform/qt/SoundQt.cpp
new file mode 100644
index 0000000..0996328
--- /dev/null
+++ b/WebCore/platform/qt/SoundQt.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ *
+ * 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 <QApplication>
+
+#include "Sound.h"
+
+namespace WebCore {
+
+void systemBeep()
+{
+ QApplication::beep();
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/SystemTimeQt.cpp b/WebCore/platform/qt/SystemTimeQt.cpp
new file mode 100644
index 0000000..a9f3d98
--- /dev/null
+++ b/WebCore/platform/qt/SystemTimeQt.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ *
+ * 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 <sys/time.h>
+
+namespace WebCore {
+
+double currentTime()
+{
+ struct timeval tv;
+ struct timezone tz;
+
+ gettimeofday(&tv, &tz);
+ return (double)tv.tv_sec + (double)(tv.tv_usec / 1000000.0);
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/TemporaryLinkStubs.cpp b/WebCore/platform/qt/TemporaryLinkStubs.cpp
new file mode 100644
index 0000000..f262684
--- /dev/null
+++ b/WebCore/platform/qt/TemporaryLinkStubs.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Collabora, Ltd.
+ *
+ * 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 "AXObjectCache.h"
+#include "DNS.h"
+#include "CString.h"
+#include "CachedResource.h"
+#include "CookieJar.h"
+#include "Cursor.h"
+#include "Font.h"
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "FTPDirectoryDocument.h"
+#include "IntPoint.h"
+#include "Widget.h"
+#include "GraphicsContext.h"
+#include "Cursor.h"
+#include "loader.h"
+#include "FileSystem.h"
+#include "FrameView.h"
+#include "GraphicsContext.h"
+#include "IconLoader.h"
+#include "IntPoint.h"
+#include "KURL.h"
+#include "Language.h"
+#include "loader.h"
+#include "LocalizedStrings.h"
+#include "Node.h"
+#include "NotImplemented.h"
+#include "Path.h"
+#include "PlatformMouseEvent.h"
+#include "PluginDatabase.h"
+#include "PluginPackage.h"
+#include "PluginView.h"
+#include "RenderTheme.h"
+#include "SharedBuffer.h"
+#include "SystemTime.h"
+#include "TextBoundaries.h"
+#include "Widget.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <float.h>
+
+using namespace WebCore;
+
+#if !defined(Q_WS_X11) && !defined(Q_WS_WIN)
+
+bool PluginPackage::fetchInfo() { notImplemented(); return false; }
+unsigned PluginPackage::hash() const { notImplemented(); return 0; }
+bool PluginPackage::equal(const PluginPackage&, const PluginPackage&) { notImplemented(); return false; }
+int PluginPackage::compareFileVersion(const PlatformModuleVersion&) const { notImplemented(); return -1; }
+
+void PluginView::setNPWindowRect(const IntRect&) { notImplemented(); }
+const char* PluginView::userAgent() { notImplemented(); return 0; }
+void PluginView::invalidateRect(NPRect*) { notImplemented(); }
+void PluginView::invalidateRegion(NPRegion) { notImplemented(); }
+void PluginView::forceRedraw() { notImplemented(); }
+void PluginView::setFocus() { Widget::setFocus(); }
+void PluginView::show() { Widget::show(); }
+void PluginView::hide() { Widget::hide(); }
+void PluginView::paint(GraphicsContext*, const IntRect&) { notImplemented(); }
+void PluginView::setParent(ScrollView* view) { Widget::setParent(view); }
+void PluginView::setParentVisible(bool) { notImplemented(); }
+void PluginView::updatePluginWidget() const { notImplemented(); }
+void PluginView::handleKeyboardEvent(KeyboardEvent*) { notImplemented(); }
+void PluginView::handleMouseEvent(MouseEvent*) { notImplemented(); }
+NPError PluginView::handlePostReadFile(Vector<char>&, uint32, const char*) { notImplemented(); return NPERR_GENERIC_ERROR; }
+NPError PluginView::getValue(NPNVariable, void*) { notImplemented(); return NPERR_GENERIC_ERROR; }
+PluginView::~PluginView() {}
+#endif
+
+namespace WebCore {
+
+void getSupportedKeySizes(Vector<String>&) { notImplemented(); }
+String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); }
+
+#if !defined(Q_OS_WIN)
+// defined in win/SystemTimeWin.cpp, which is compiled for the Qt/Windows port
+float userIdleTime() { notImplemented(); return FLT_MAX; } // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed
+#endif
+
+void prefetchDNS(const String& hostname) { notImplemented(); }
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/WebCoreResources.qrc b/WebCore/platform/qt/WebCoreResources.qrc
new file mode 100644
index 0000000..e42cd7f
--- /dev/null
+++ b/WebCore/platform/qt/WebCoreResources.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/webcore/resources">
+ <file>html4-adjustments-qt.css</file>
+</qresource>
+</RCC> \ No newline at end of file
diff --git a/WebCore/platform/qt/WheelEventQt.cpp b/WebCore/platform/qt/WheelEventQt.cpp
new file mode 100644
index 0000000..135f15a
--- /dev/null
+++ b/WebCore/platform/qt/WheelEventQt.cpp
@@ -0,0 +1,59 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "PlatformWheelEvent.h"
+
+#include "PlatformMouseEvent.h"
+
+#include <QWheelEvent>
+
+namespace WebCore {
+
+
+PlatformWheelEvent::PlatformWheelEvent(QWheelEvent* e)
+#ifdef QT_NO_WHEELEVENT
+{
+ Q_UNUSED(e);
+}
+#else
+ : m_position(e->pos())
+ , m_globalPosition(e->globalPos())
+ , m_granularity(ScrollByLineWheelEvent)
+ , m_isAccepted(false)
+ , m_shiftKey(e->modifiers() & Qt::ShiftModifier)
+ , m_ctrlKey(e->modifiers() & Qt::ControlModifier)
+ , m_altKey(e->modifiers() & Qt::AltModifier)
+ , m_metaKey(e->modifiers() & Qt::MetaModifier)
+{
+ if (e->orientation() == Qt::Horizontal) {
+ m_deltaX = (e->delta() / 120);
+ m_deltaY = 0;
+ } else {
+ m_deltaX = 0;
+ m_deltaY = (e->delta() / 120);
+ }
+
+ // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event
+ m_deltaX *= horizontalLineMultiplier();
+ m_deltaY *= verticalLineMultiplier();
+}
+#endif // QT_NO_WHEELEVENT
+
+} // namespace WebCore
diff --git a/WebCore/platform/qt/WidgetQt.cpp b/WebCore/platform/qt/WidgetQt.cpp
new file mode 100644
index 0000000..68cf383
--- /dev/null
+++ b/WebCore/platform/qt/WidgetQt.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * Copyright (C) 2006 George Stiakos <staikos@kde.org>
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2008 Holger Hans Peter Freyther
+ *
+ * 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 "Font.h"
+#include "GraphicsContext.h"
+#include "HostWindow.h"
+#include "IntRect.h"
+#include "ScrollView.h"
+#include "Widget.h"
+#include "NotImplemented.h"
+
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "qwebpage.h"
+
+#include <QCoreApplication>
+#include <QPainter>
+#include <QPaintEngine>
+
+#include <QDebug>
+
+namespace WebCore {
+
+Widget::Widget(QWidget* widget)
+{
+ init(widget);
+}
+
+Widget::~Widget()
+{
+ Q_ASSERT(!parent());
+}
+
+IntRect Widget::frameRect() const
+{
+ return m_frame;
+}
+
+void Widget::setFrameRect(const IntRect& rect)
+{
+ if (platformWidget())
+ platformWidget()->setGeometry(convertToContainingWindow(IntRect(0, 0, rect.width(), rect.height())));
+ m_frame = rect;
+}
+
+void Widget::setFocus()
+{
+}
+
+void Widget::setCursor(const Cursor& cursor)
+{
+#ifndef QT_NO_CURSOR
+ if (QWidget* widget = root()->hostWindow()->platformWindow())
+ QCoreApplication::postEvent(widget, new SetCursorEvent(cursor.impl()));
+#endif
+}
+
+void Widget::show()
+{
+ if (platformWidget())
+ platformWidget()->show();
+}
+
+void Widget::hide()
+{
+ if (platformWidget())
+ platformWidget()->hide();
+}
+
+void Widget::paint(GraphicsContext *, const IntRect &rect)
+{
+}
+
+void Widget::setIsSelected(bool)
+{
+ notImplemented();
+}
+
+}
+
+// vim: ts=4 sw=4 et
diff --git a/WebCore/platform/qt/html4-adjustments-qt.css b/WebCore/platform/qt/html4-adjustments-qt.css
new file mode 100644
index 0000000..129c164
--- /dev/null
+++ b/WebCore/platform/qt/html4-adjustments-qt.css
@@ -0,0 +1,96 @@
+/*
+ * QtWebKit specific style sheet.
+ *
+ * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+audio {
+ height: 34px;
+ width: 400px;
+}
+
+audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
+ left: auto;
+ right: 5px;
+ width: 12px;
+ height: 12px;
+ padding: 6px;
+ margin: 5px 0px;
+}
+
+audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
+ left: 5px;
+ width: 9px;
+ height: 12px;
+ padding: 6px 12px 6px 11px;
+ margin: 5px 0px;
+}
+
+audio::-webkit-media-controls-time-display, video::-webkit-media-controls-time-display {
+ /* Since MediaControlElements are always created with a renderer we have to hide
+ the controls we don't use, so they don't mess up activation and event handling */
+ left: 0px;
+ top: 0px;
+ width: 0px;
+ height: 0px;
+
+ display: none;
+}
+
+audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
+ left: 42px;
+ right: 34px;
+ height: 12px;
+ padding: 6px 8px;
+ margin: 5px 0px;
+}
+
+audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
+ /* Since MediaControlElements are always created with a renderer we have to hide
+ the controls we don't use, so they don't mess up activation and event handling */
+ left: 0px;
+ top: 0px;
+ width: 0px;
+ height: 0px;
+
+ display: none;
+}
+
+audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
+ /* Since MediaControlElements are always created with a renderer we have to hide
+ the controls we don't use, so they don't mess up activation and event handling */
+ left: 0px;
+ top: 0px;
+ width: 0px;
+ height: 0px;
+
+ display: none;
+}
+
+audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
+ /* Since MediaControlElements are always created with a renderer we have to hide
+ the controls we don't use, so they don't mess up activation and event handling */
+ left: 0px;
+ top: 0px;
+ width: 0px;
+ height: 0px;
+
+ display: none;
+}
+