summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/haiku
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/haiku')
-rw-r--r--Source/WebCore/platform/haiku/ClipboardHaiku.cpp217
-rw-r--r--Source/WebCore/platform/haiku/ClipboardHaiku.h74
-rw-r--r--Source/WebCore/platform/haiku/ContextMenuHaiku.cpp122
-rw-r--r--Source/WebCore/platform/haiku/ContextMenuItemHaiku.cpp164
-rw-r--r--Source/WebCore/platform/haiku/CookieJarHaiku.cpp79
-rw-r--r--Source/WebCore/platform/haiku/CursorHaiku.cpp271
-rw-r--r--Source/WebCore/platform/haiku/DragDataHaiku.cpp102
-rw-r--r--Source/WebCore/platform/haiku/DragImageHaiku.cpp74
-rw-r--r--Source/WebCore/platform/haiku/EventLoopHaiku.cpp41
-rw-r--r--Source/WebCore/platform/haiku/FileChooserHaiku.cpp38
-rw-r--r--Source/WebCore/platform/haiku/FileSystemHaiku.cpp94
-rw-r--r--Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp497
-rw-r--r--Source/WebCore/platform/haiku/LoggingHaiku.cpp48
-rw-r--r--Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp93
-rw-r--r--Source/WebCore/platform/haiku/PasteboardHaiku.cpp227
-rw-r--r--Source/WebCore/platform/haiku/PlatformKeyboardEventHaiku.cpp390
-rw-r--r--Source/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp80
-rw-r--r--Source/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp63
-rw-r--r--Source/WebCore/platform/haiku/PopupMenuHaiku.cpp192
-rw-r--r--Source/WebCore/platform/haiku/PopupMenuHaiku.h55
-rw-r--r--Source/WebCore/platform/haiku/RenderThemeHaiku.cpp178
-rw-r--r--Source/WebCore/platform/haiku/RenderThemeHaiku.h70
-rw-r--r--Source/WebCore/platform/haiku/ScreenHaiku.cpp86
-rw-r--r--Source/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp164
-rw-r--r--Source/WebCore/platform/haiku/ScrollbarThemeHaiku.h55
-rw-r--r--Source/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp57
-rw-r--r--Source/WebCore/platform/haiku/SearchPopupMenuHaiku.h44
-rw-r--r--Source/WebCore/platform/haiku/SharedBufferHaiku.cpp51
-rw-r--r--Source/WebCore/platform/haiku/SharedTimerHaiku.cpp124
-rw-r--r--Source/WebCore/platform/haiku/SoundHaiku.cpp42
-rw-r--r--Source/WebCore/platform/haiku/TemporaryLinkStubs.cpp86
-rw-r--r--Source/WebCore/platform/haiku/WidgetHaiku.cpp132
32 files changed, 4010 insertions, 0 deletions
diff --git a/Source/WebCore/platform/haiku/ClipboardHaiku.cpp b/Source/WebCore/platform/haiku/ClipboardHaiku.cpp
new file mode 100644
index 0000000..495f1d2
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ClipboardHaiku.cpp
@@ -0,0 +1,217 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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 "ClipboardHaiku.h"
+
+#include "FileList.h"
+#include "IntPoint.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+#include <support/Locker.h>
+#include <app/Clipboard.h>
+#include <Message.h>
+#include <String.h>
+#include <wtf/HashTable.h>
+#include <wtf/text/StringHash.h>
+
+
+namespace WebCore {
+
+PassRefPtr<Clipboard> Clipboard::create(ClipboardAccessPolicy policy, DragData*, Frame*)
+{
+ return ClipboardHaiku::create(policy, DragAndDrop);
+}
+
+ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, ClipboardType clipboardType)
+ : Clipboard(policy, clipboardType)
+{
+}
+
+void ClipboardHaiku::clearData(const String& type)
+{
+ if (be_clipboard->Lock()) {
+ BMessage* data = be_clipboard->Data();
+
+ if (data) {
+ data->RemoveName(BString(type).String());
+ be_clipboard->Commit();
+ }
+
+ be_clipboard->Unlock();
+ }
+}
+
+void ClipboardHaiku::clearAllData()
+{
+ if (be_clipboard->Lock()) {
+ be_clipboard->Clear();
+ be_clipboard->Commit();
+ be_clipboard->Unlock();
+ }
+}
+
+String ClipboardHaiku::getData(const String& type, bool& success) const
+{
+ BString result;
+ success = false;
+
+ if (be_clipboard->Lock()) {
+ BMessage* data = be_clipboard->Data();
+
+ if (data)
+ if (data->FindString(BString(type).String(), &result) == B_OK)
+ success = true;
+
+ be_clipboard->Unlock();
+ }
+
+ return result;
+}
+
+bool ClipboardHaiku::setData(const String& type, const String& data)
+{
+ bool result = false;
+
+ if (be_clipboard->Lock()) {
+ BMessage* bdata = be_clipboard->Data();
+
+ if (bdata) {
+ bdata->RemoveName(BString(type).String());
+
+ if (bdata->AddString(BString(type).String(), BString(data)) == B_OK)
+ result = true;
+ }
+
+ be_clipboard->Commit();
+ be_clipboard->Unlock();
+ }
+
+ return result;
+}
+
+// Extensions beyond IE's API.
+HashSet<String> ClipboardHaiku::types() const
+{
+ HashSet<String> result;
+
+ if (be_clipboard->Lock()) {
+ BMessage* data = be_clipboard->Data();
+
+ if (data) {
+ char* name;
+ uint32 type;
+ int32 count;
+
+ for (int32 i = 0; data->GetInfo(B_ANY_TYPE, i, &name, &type, &count) == B_OK; i++)
+ result.add(name);
+ }
+
+ be_clipboard->Unlock();
+ }
+
+ return result;
+}
+
+PassRefPtr<FileList> ClipboardHaiku::files() const
+{
+ notImplemented();
+ return 0;
+}
+
+IntPoint ClipboardHaiku::dragLocation() const
+{
+ notImplemented();
+ return IntPoint(0, 0);
+}
+
+CachedImage* ClipboardHaiku::dragImage() const
+{
+ notImplemented();
+ return 0;
+}
+
+void ClipboardHaiku::setDragImage(CachedImage*, const IntPoint&)
+{
+ notImplemented();
+}
+
+Node* ClipboardHaiku::dragImageElement()
+{
+ notImplemented();
+ return 0;
+}
+
+void ClipboardHaiku::setDragImageElement(Node*, const IntPoint&)
+{
+ notImplemented();
+}
+
+DragImageRef ClipboardHaiku::createDragImage(IntPoint& dragLocation) const
+{
+ notImplemented();
+ return 0;
+}
+
+void ClipboardHaiku::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*)
+{
+ notImplemented();
+}
+
+void ClipboardHaiku::writeURL(const KURL&, const String&, Frame*)
+{
+ notImplemented();
+}
+
+void ClipboardHaiku::writeRange(Range*, Frame*)
+{
+ notImplemented();
+}
+
+void ClipboardHaiku::writePlainText(const String&)
+{
+ notImplemented();
+}
+
+bool ClipboardHaiku::hasData()
+{
+ bool result = false;
+
+ if (be_clipboard->Lock()) {
+ BMessage* data = be_clipboard->Data();
+
+ if (data)
+ result = !data->IsEmpty();
+
+ be_clipboard->Unlock();
+ }
+
+ return result;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/ClipboardHaiku.h b/Source/WebCore/platform/haiku/ClipboardHaiku.h
new file mode 100644
index 0000000..89dc7bd
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ClipboardHaiku.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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 ClipboardHaiku_h
+#define ClipboardHaiku_h
+
+#include "Clipboard.h"
+#include "ClipboardAccessPolicy.h"
+
+namespace WebCore {
+ class CachedImage;
+
+ // State available during IE's events for drag and drop and copy/paste.
+ class ClipboardHaiku : public Clipboard {
+ public:
+ static PassRefPtr<ClipboardHaiku> create(ClipboardAccessPolicy policy, ClipboardType clipboardType)
+ {
+ return adoptRef(new ClipboardHaiku(policy, clipboardType));
+ }
+ ~ClipboardHaiku() { }
+
+ 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;
+ virtual PassRefPtr<FileList> files() const;
+
+ IntPoint dragLocation() const;
+ CachedImage* dragImage() const;
+ void setDragImage(CachedImage*, const IntPoint&);
+ Node* dragImageElement();
+ 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 void writePlainText(const String&);
+
+ virtual bool hasData();
+
+ private:
+ ClipboardHaiku(ClipboardAccessPolicy, ClipboardType);
+ };
+} // namespace WebCore
+
+#endif // ClipboardHaiku_h
+
diff --git a/Source/WebCore/platform/haiku/ContextMenuHaiku.cpp b/Source/WebCore/platform/haiku/ContextMenuHaiku.cpp
new file mode 100644
index 0000000..aaff99b
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ContextMenuHaiku.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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 "ContextMenuController.h"
+#include "ContextMenuItem.h"
+#include "Document.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include <Looper.h>
+#include <Menu.h>
+#include <Message.h>
+#include <wtf/Assertions.h>
+
+
+namespace WebCore {
+
+// FIXME: This class isn't used yet
+class ContextMenuReceiver : public BLooper {
+public:
+ ContextMenuReceiver(ContextMenu* menu)
+ : BLooper("context_menu_receiver")
+ , m_menu(menu)
+ , m_result(-1)
+ {
+ }
+
+ void HandleMessage(BMessage* msg)
+ {
+ m_result = msg->what;
+ if (m_result != -1) {
+ BMenuItem* item = m_menu->platformDescription()->FindItem(m_result);
+ if (!item) {
+ printf("Error: Context menu item with code %i not found!\n", m_result);
+ return;
+ }
+ ContextMenuItem cmItem(item);
+ m_menu->controller()->contextMenuItemSelected(&cmItem);
+ cmItem.releasePlatformDescription();
+ }
+ }
+
+ int Result()
+ {
+ return m_result;
+ }
+
+private:
+ ContextMenu* m_menu;
+ int m_result;
+};
+
+ContextMenu::ContextMenu()
+ : m_platformDescription(new BMenu("context_menu"))
+{
+}
+
+ContextMenu::~ContextMenu()
+{
+ delete m_platformDescription;
+}
+
+void ContextMenu::appendItem(ContextMenuItem& item)
+{
+ BMenuItem* menuItem = item.releasePlatformDescription();
+ if (menuItem)
+ m_platformDescription->AddItem(menuItem);
+}
+
+unsigned ContextMenu::itemCount() const
+{
+ return m_platformDescription->CountItems();
+}
+
+void ContextMenu::insertItem(unsigned position, ContextMenuItem& item)
+{
+ BMenuItem* menuItem = item.releasePlatformDescription();
+ if (menuItem)
+ m_platformDescription->AddItem(menuItem, position);
+}
+
+PlatformMenuDescription ContextMenu::platformDescription() const
+{
+ return m_platformDescription;
+}
+
+void ContextMenu::setPlatformDescription(PlatformMenuDescription menu)
+{
+ if (static_cast<BMenu*>(menu) == m_platformDescription)
+ return;
+
+ delete m_platformDescription;
+ m_platformDescription = static_cast<BMenu*>(menu);
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/ContextMenuItemHaiku.cpp b/Source/WebCore/platform/haiku/ContextMenuItemHaiku.cpp
new file mode 100644
index 0000000..469590d
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ContextMenuItemHaiku.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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"
+#include "NotImplemented.h"
+
+#include <Menu.h>
+#include <MenuItem.h>
+#include <Message.h>
+#include <String.h>
+
+
+using namespace WebCore;
+
+ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription item)
+{
+ m_platformDescription = item;
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenu* subMenu)
+{
+ m_platformDescription = new BMenuItem(subMenu->platformDescription(),
+ new BMessage(ContextMenuItemTagNoAction));
+}
+
+ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action,
+ const String& title, ContextMenu* subMenu)
+{
+ if (type == ActionType)
+ m_platformDescription = new BMenuItem(BString(title).String(), new BMessage(action));
+ else if (type == SeparatorType)
+ m_platformDescription = new BSeparatorItem();
+ else {
+ m_platformDescription = new BMenuItem(subMenu->platformDescription(), new BMessage(action));
+ m_platformDescription->SetLabel(BString(title).String());
+ }
+}
+
+ContextMenuItem::~ContextMenuItem()
+{
+ delete m_platformDescription;
+}
+
+PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription()
+{
+ BMenuItem* item = m_platformDescription;
+ m_platformDescription = 0;
+ return item;
+}
+
+ContextMenuItemType ContextMenuItem::type() const
+{
+ if (dynamic_cast<BSeparatorItem*>(m_platformDescription))
+ return SeparatorType;
+ if (m_platformDescription->Submenu())
+ return SubmenuType;
+ return ActionType;
+}
+
+void ContextMenuItem::setType(ContextMenuItemType type)
+{
+ ContextMenuAction theAction = action();
+ String theTitle = title();
+ BMenu* subMenu = platformSubMenu();
+ delete m_platformDescription;
+
+ if (type == ActionType)
+ m_platformDescription = new BMenuItem(BString(theTitle).String(), new BMessage(theAction));
+ else if (type == SeparatorType)
+ m_platformDescription = new BSeparatorItem();
+ else {
+ if (subMenu) {
+ m_platformDescription = new BMenuItem(subMenu, new BMessage(theAction));
+ m_platformDescription->SetLabel(BString(theTitle).String());
+ } else
+ m_platformDescription = new BMenuItem(BString(theTitle).String(), new BMessage(theAction));
+ }
+}
+
+ContextMenuAction ContextMenuItem::action() const
+{
+ if (!m_platformDescription)
+ return ContextMenuItemTagNoAction;
+ return static_cast<WebCore::ContextMenuAction>(m_platformDescription->Message()->what);
+}
+
+void ContextMenuItem::setAction(ContextMenuAction action)
+{
+ if (m_platformDescription)
+ m_platformDescription->Message()->what = action;
+}
+
+String ContextMenuItem::title() const
+{
+ if (m_platformDescription)
+ return "";
+ return BString(m_platformDescription->Label());
+}
+
+void ContextMenuItem::setTitle(const String& title)
+{
+ // FIXME: We need to find a better way to convert WebKit Strings into c strings
+ m_platformDescription->SetLabel(BString(title).String());
+}
+
+PlatformMenuDescription ContextMenuItem::platformSubMenu() const
+{
+ return m_platformDescription->Submenu();
+}
+
+void ContextMenuItem::setSubMenu(ContextMenu* menu)
+{
+ // FIXME: We assume m_platformDescription is valid
+ const char* title = m_platformDescription->Label();
+ delete m_platformDescription;
+ m_platformDescription = new BMenuItem(menu->platformDescription(), new BMessage(action()));
+ m_platformDescription->SetLabel(title);
+}
+
+void ContextMenuItem::setChecked(bool checked)
+{
+ if (m_platformDescription)
+ m_platformDescription->SetMarked(checked);
+}
+
+void ContextMenuItem::setEnabled(bool enable)
+{
+ if (m_platformDescription)
+ m_platformDescription->SetEnabled(enable);
+}
+
+bool ContextMenuItem::enabled() const
+{
+ if (!m_platformDescription)
+ return true;
+ return m_platformDescription->IsEnabled();
+}
+
diff --git a/Source/WebCore/platform/haiku/CookieJarHaiku.cpp b/Source/WebCore/platform/haiku/CookieJarHaiku.cpp
new file mode 100644
index 0000000..471ac59
--- /dev/null
+++ b/Source/WebCore/platform/haiku/CookieJarHaiku.cpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2006 George Staikos <staikos@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CookieJar.h"
+
+#include "Cookie.h"
+#include "KURL.h"
+#include "PlatformString.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
+
+
+namespace WebCore {
+
+// FIXME: Shouldn't this be saved to and restored from disk too?
+static HashMap<String, String> cookieJar;
+
+void setCookies(Document*, const KURL& url, const String& value)
+{
+ cookieJar.set(url.string(), value);
+}
+
+String cookies(const Document*, const KURL& url)
+{
+ return cookieJar.get(url.string());
+}
+
+String cookieRequestHeaderFieldValue(const Document*, const KURL& url)
+{
+ // FIXME: include HttpOnly cookies.
+ return cookieJar.get(url.string());
+}
+
+bool cookiesEnabled(const Document*)
+{
+ // FIXME: This should probably be a setting
+ return true;
+}
+
+bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies)
+{
+ // FIXME: Not yet implemented
+ rawCookies.clear();
+ return false; // return true when implemented
+}
+
+void deleteCookie(const Document*, const KURL&, const String&)
+{
+ // FIXME: Not yet implemented
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/CursorHaiku.cpp b/Source/WebCore/platform/haiku/CursorHaiku.cpp
new file mode 100644
index 0000000..58833bc
--- /dev/null
+++ b/Source/WebCore/platform/haiku/CursorHaiku.cpp
@@ -0,0 +1,271 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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 "NotImplemented.h"
+
+namespace WebCore {
+
+Cursor::Cursor(PlatformCursor cursor)
+ : m_platformCursor(cursor)
+{
+}
+
+Cursor::Cursor(const Cursor& other)
+ : m_platformCursor(0)
+{
+ *this = other;
+}
+
+Cursor::~Cursor()
+{
+ delete m_platformCursor;
+}
+
+Cursor::Cursor(Image*, const IntPoint&)
+ : m_platformCursor(0)
+{
+ notImplemented();
+}
+
+Cursor& Cursor::operator=(const Cursor& other)
+{
+ delete m_platformCursor;
+ m_platformCursor = other.m_platformCursor ? new BCursor(*other.m_platformCursor) : 0;
+ return *this;
+}
+
+static Cursor createCursorByID(BCursorID id)
+{
+ return Cursor(new BCursor(id));
+}
+
+const Cursor& pointerCursor()
+{
+ static Cursor cursorSystemDefault(0);
+ return cursorSystemDefault;
+}
+
+const Cursor& moveCursor()
+{
+ static Cursor cursorMove = createCursorByID(B_CURSOR_ID_MOVE);
+ return cursorMove;
+}
+
+const Cursor& crossCursor()
+{
+ static Cursor cursorCrossHair = createCursorByID(B_CURSOR_ID_CROSS_HAIR);
+ return cursorCrossHair;
+}
+
+const Cursor& handCursor()
+{
+ static Cursor cursorFollowLink = createCursorByID(B_CURSOR_ID_FOLLOW_LINK);
+ return cursorFollowLink;
+}
+
+const Cursor& iBeamCursor()
+{
+ static Cursor cursorIBeam = createCursorByID(B_CURSOR_ID_I_BEAM);
+ return cursorIBeam;
+}
+
+const Cursor& waitCursor()
+{
+ static Cursor cursorProgress = createCursorByID(B_CURSOR_ID_PROGRESS);
+ return cursorProgress;
+}
+
+const Cursor& helpCursor()
+{
+ static Cursor cursorHelp = createCursorByID(B_CURSOR_ID_HELP);
+ return cursorHelp;
+}
+
+const Cursor& eastResizeCursor()
+{
+ static Cursor cursorResizeEast = createCursorByID(B_CURSOR_ID_RESIZE_EAST);
+ return cursorResizeEast;
+}
+
+const Cursor& northResizeCursor()
+{
+ static Cursor cursorResizeNorth = createCursorByID(B_CURSOR_ID_RESIZE_NORTH);
+ return cursorResizeNorth;
+}
+
+const Cursor& northEastResizeCursor()
+{
+ static Cursor cursorResizeNorthEast = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_EAST);
+ return cursorResizeNorthEast;
+}
+
+const Cursor& northWestResizeCursor()
+{
+ static Cursor cursorResizeNorthWest = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_WEST);
+ return cursorResizeNorthWest;
+}
+
+const Cursor& southResizeCursor()
+{
+ static Cursor cursorResizeSouth = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH);
+ return cursorResizeSouth;
+}
+
+const Cursor& southEastResizeCursor()
+{
+ static Cursor cursorResizeSouthEast = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH_EAST);
+ return cursorResizeSouthEast;
+}
+
+const Cursor& southWestResizeCursor()
+{
+ static Cursor cursorResizeSouthWest = createCursorByID(B_CURSOR_ID_RESIZE_SOUTH_WEST);
+ return cursorResizeSouthWest;
+}
+
+const Cursor& westResizeCursor()
+{
+ static Cursor cursorResizeWest = createCursorByID(B_CURSOR_ID_RESIZE_WEST);
+ return cursorResizeWest;
+}
+
+const Cursor& northSouthResizeCursor()
+{
+ static Cursor cursorResizeNorthSouth = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_SOUTH);
+ return cursorResizeNorthSouth;
+}
+
+const Cursor& eastWestResizeCursor()
+{
+ static Cursor cursorResizeEastWest = createCursorByID(B_CURSOR_ID_RESIZE_EAST_WEST);
+ return cursorResizeEastWest;
+}
+
+const Cursor& northEastSouthWestResizeCursor()
+{
+ static Cursor cursorResizeNorthEastSouthWest = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_EAST_SOUTH_WEST);
+ return cursorResizeNorthEastSouthWest;
+}
+
+const Cursor& northWestSouthEastResizeCursor()
+{
+ static Cursor cursorResizeNorthWestSouthEast = createCursorByID(B_CURSOR_ID_RESIZE_NORTH_WEST_SOUTH_EAST);
+ return cursorResizeNorthWestSouthEast;
+}
+
+const Cursor& columnResizeCursor()
+{
+ return eastWestResizeCursor();
+}
+
+const Cursor& rowResizeCursor()
+{
+ return northSouthResizeCursor();
+}
+
+const Cursor& verticalTextCursor()
+{
+ static Cursor cursorIBeamHorizontal = createCursorByID(B_CURSOR_ID_I_BEAM_HORIZONTAL);
+ return cursorIBeamHorizontal;
+}
+
+const Cursor& cellCursor()
+{
+ return pointerCursor();
+}
+
+const Cursor& contextMenuCursor()
+{
+ static Cursor cursorContextMenu = createCursorByID(B_CURSOR_ID_CONTEXT_MENU);
+ return cursorContextMenu;
+}
+
+const Cursor& noDropCursor()
+{
+ static Cursor cursorNotAllowed = createCursorByID(B_CURSOR_ID_NOT_ALLOWED);
+ return cursorNotAllowed;
+}
+
+const Cursor& copyCursor()
+{
+ static Cursor cursorCopy = createCursorByID(B_CURSOR_ID_COPY);
+ return cursorCopy;
+}
+
+const Cursor& progressCursor()
+{
+ static Cursor cursorProgress = createCursorByID(B_CURSOR_ID_PROGRESS);
+ return cursorProgress;
+}
+
+const Cursor& aliasCursor()
+{
+ return handCursor();
+}
+
+const Cursor& noneCursor()
+{
+ static Cursor cursorNoCursor = createCursorByID(B_CURSOR_ID_NO_CURSOR);
+ return cursorNoCursor;
+}
+
+const Cursor& notAllowedCursor()
+{
+ static Cursor cursorNotAllowed = createCursorByID(B_CURSOR_ID_NOT_ALLOWED);
+ return cursorNotAllowed;
+}
+
+const Cursor& zoomInCursor()
+{
+ static Cursor cursorZoomIn = createCursorByID(B_CURSOR_ID_ZOOM_IN);
+ return cursorZoomIn;
+}
+
+const Cursor& zoomOutCursor()
+{
+ static Cursor cursorZoomOut = createCursorByID(B_CURSOR_ID_ZOOM_OUT);
+ return cursorZoomOut;
+}
+
+const Cursor& grabCursor()
+{
+ static Cursor cursorGrab = createCursorByID(B_CURSOR_ID_GRAB);
+ return cursorGrab;
+}
+
+const Cursor& grabbingCursor()
+{
+ static Cursor cursorGrabbing = createCursorByID(B_CURSOR_ID_GRABBING);
+ return cursorGrabbing;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/DragDataHaiku.cpp b/Source/WebCore/platform/haiku/DragDataHaiku.cpp
new file mode 100644
index 0000000..7c2dc9c
--- /dev/null
+++ b/Source/WebCore/platform/haiku/DragDataHaiku.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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 "Document.h"
+#include "DocumentFragment.h"
+#include "NotImplemented.h"
+
+
+namespace WebCore {
+
+bool DragData::canSmartReplace() const
+{
+ notImplemented();
+ return false;
+}
+
+bool DragData::containsColor() const
+{
+ notImplemented();
+ return false;
+}
+
+bool DragData::containsFiles() const
+{
+ notImplemented();
+ return false;
+}
+
+void DragData::asFilenames(Vector<String>& result) const
+{
+ notImplemented();
+}
+
+bool DragData::containsPlainText() const
+{
+ notImplemented();
+ return false;
+}
+
+String DragData::asPlainText() const
+{
+ notImplemented();
+ return String();
+}
+
+Color DragData::asColor() const
+{
+ notImplemented();
+ return Color();
+}
+
+bool DragData::containsCompatibleContent() const
+{
+ return containsColor() || containsURL() || containsPlainText();
+}
+
+bool DragData::containsURL(FilenameConversionPolicy filenamePolicy) const
+{
+ notImplemented();
+ return false;
+}
+
+String DragData::asURL(FilenameConversionPolicy filenamePolicy, String* title) const
+{
+ notImplemented();
+ return String();
+}
+
+PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const
+{
+ notImplemented();
+ return 0;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/DragImageHaiku.cpp b/Source/WebCore/platform/haiku/DragImageHaiku.cpp
new file mode 100644
index 0000000..87f780a
--- /dev/null
+++ b/Source/WebCore/platform/haiku/DragImageHaiku.cpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * 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"
+
+#include "NotImplemented.h"
+
+
+namespace WebCore {
+
+IntSize dragImageSize(DragImageRef)
+{
+ notImplemented();
+ return IntSize(0, 0);
+}
+
+void deleteDragImage(DragImageRef)
+{
+ notImplemented();
+}
+
+DragImageRef scaleDragImage(DragImageRef image, FloatSize)
+{
+ notImplemented();
+ return image;
+}
+
+DragImageRef dissolveDragImageToFraction(DragImageRef image, float)
+{
+ notImplemented();
+ return image;
+}
+
+DragImageRef createDragImageFromImage(Image*)
+{
+ notImplemented();
+ return 0;
+}
+
+DragImageRef createDragImageIconForCachedImage(CachedImage*)
+{
+ notImplemented();
+ return 0;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/EventLoopHaiku.cpp b/Source/WebCore/platform/haiku/EventLoopHaiku.cpp
new file mode 100644
index 0000000..4750e6f
--- /dev/null
+++ b/Source/WebCore/platform/haiku/EventLoopHaiku.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009 Maxime Simon
+ *
+ * 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 "EventLoop.h"
+
+#include <app/Application.h>
+
+
+namespace WebCore {
+
+void EventLoop::cycle()
+{
+ if (!be_app)
+ m_ended = true;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/FileChooserHaiku.cpp b/Source/WebCore/platform/haiku/FileChooserHaiku.cpp
new file mode 100644
index 0000000..3a44de8
--- /dev/null
+++ b/Source/WebCore/platform/haiku/FileChooserHaiku.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "FileChooser.h"
+
+#include "Icon.h"
+#include "NotImplemented.h"
+
+
+namespace WebCore {
+
+String FileChooser::basenameForWidth(const Font&, int width) const
+{
+ notImplemented();
+ return String();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/FileSystemHaiku.cpp b/Source/WebCore/platform/haiku/FileSystemHaiku.cpp
new file mode 100644
index 0000000..b0d34f2
--- /dev/null
+++ b/Source/WebCore/platform/haiku/FileSystemHaiku.cpp
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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 "FileSystem.h"
+
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include <wtf/text/CString.h>
+
+#include <Directory.h>
+#include <Entry.h>
+#include <File.h>
+#include <FindDirectory.h>
+#include <Path.h>
+
+
+namespace WebCore {
+
+CString fileSystemRepresentation(const String& string)
+{
+ return string.utf8();
+}
+
+String homeDirectoryPath()
+{
+ BPath path;
+ if (find_directory(B_USER_DIRECTORY, &path) != B_OK)
+ return String();
+
+ return String(path.Path());
+}
+
+CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle)
+{
+ notImplemented();
+ handle = invalidPlatformFileHandle;
+ return CString();
+}
+
+void closeFile(PlatformFileHandle&)
+{
+ notImplemented();
+}
+
+int writeToFile(PlatformFileHandle, const char* data, int length)
+{
+ notImplemented();
+ return 0;
+}
+
+bool unloadModule(PlatformModule)
+{
+ notImplemented();
+ return false;
+}
+
+Vector<String> listDirectory(const String& path, const String& filter)
+{
+ Vector<String> entries;
+ BDirectory directory(path.utf8().data());
+ entry_ref ref;
+ while (directory.GetNextRef(&ref) == B_OK)
+ entries.append(ref.name);
+ return entries;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
new file mode 100644
index 0000000..5587fa2
--- /dev/null
+++ b/Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp
@@ -0,0 +1,497 @@
+/*
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LocalizedStrings.h"
+
+#include "NotImplemented.h"
+#include "PlatformString.h"
+
+
+namespace WebCore {
+String submitButtonDefaultLabel()
+{
+ return "Submit";
+}
+
+String inputElementAltText()
+{
+ return String();
+}
+
+String resetButtonDefaultLabel()
+{
+ return "Reset";
+}
+
+String defaultLanguage()
+{
+ return "en";
+}
+
+String searchableIndexIntroduction()
+{
+ return "Searchable Index";
+}
+
+String fileButtonChooseFileLabel()
+{
+ return "Choose File";
+}
+
+String fileButtonNoFileSelectedLabel()
+{
+ return "No file selected";
+}
+
+String contextMenuItemTagOpenLinkInNewWindow()
+{
+ return "Open in new tab";
+}
+
+String contextMenuItemTagDownloadLinkToDisk()
+{
+ return "Download link to disk";
+}
+
+String contextMenuItemTagCopyLinkToClipboard()
+{
+ return "Copy link to clipboard";
+}
+
+String contextMenuItemTagOpenImageInNewWindow()
+{
+ return "Open image in new window";
+}
+
+String contextMenuItemTagDownloadImageToDisk()
+{
+ return "Download image to disk";
+}
+
+String contextMenuItemTagCopyImageToClipboard()
+{
+ return "Copy image to clipboard";
+}
+
+String contextMenuItemTagOpenVideoInNewWindow()
+{
+ return "Open video in new window";
+}
+
+String contextMenuItemTagOpenAudioInNewWindow()
+{
+ return "Open audio in new window";
+}
+
+String contextMenuItemTagCopyVideoLinkToClipboard()
+{
+ return "Copy video link location";
+}
+
+String contextMenuItemTagCopyAudioLinkToClipboard()
+{
+ return "Copy audio link location";
+}
+
+String contextMenuItemTagToggleMediaControls()
+{
+ return "Toggle media controls";
+}
+
+String contextMenuItemTagToggleMediaLoop()
+{
+ return "Toggle media loop playback";
+}
+
+String contextMenuItemTagEnterVideoFullscreen()
+{
+ return "Switch video to fullscreen";
+}
+
+String contextMenuItemTagMediaPlay()
+{
+ return "Play";
+}
+
+String contextMenuItemTagMediaPause()
+{
+ return "Pause";
+}
+
+String contextMenuItemTagMediaMute()
+{
+ return "Mute";
+}
+
+String contextMenuItemTagOpenFrameInNewWindow()
+{
+ return "Open frame in new window";
+}
+
+String contextMenuItemTagCopy()
+{
+ return "Copy";
+}
+
+String contextMenuItemTagGoBack()
+{
+ return "Go back";
+}
+
+String contextMenuItemTagGoForward()
+{
+ return "Go forward";
+}
+
+String contextMenuItemTagStop()
+{
+ return "Stop";
+}
+
+String contextMenuItemTagReload()
+{
+ return "Reload";
+}
+
+String contextMenuItemTagCut()
+{
+ return "Cut";
+}
+
+String contextMenuItemTagPaste()
+{
+ return "Paste";
+}
+
+String contextMenuItemTagNoGuessesFound()
+{
+ return "No guesses found";
+}
+
+String contextMenuItemTagIgnoreSpelling()
+{
+ return "Ignore spelling";
+}
+
+String contextMenuItemTagLearnSpelling()
+{
+ return "Learn spelling";
+}
+
+String contextMenuItemTagSearchWeb()
+{
+ return "Search web";
+}
+
+String contextMenuItemTagLookUpInDictionary()
+{
+ return "Lookup in dictionary";
+}
+
+String contextMenuItemTagOpenLink()
+{
+ return "Open link";
+}
+
+String contextMenuItemTagIgnoreGrammar()
+{
+ return "Ignore grammar";
+}
+
+String contextMenuItemTagSpellingMenu()
+{
+ return "Spelling menu";
+}
+
+String contextMenuItemTagShowSpellingPanel(bool show)
+{
+ return "Show spelling panel";
+}
+
+String contextMenuItemTagCheckSpelling()
+{
+ return "Check spelling";
+}
+
+String contextMenuItemTagCheckSpellingWhileTyping()
+{
+ return "Check spelling while typing";
+}
+
+String contextMenuItemTagCheckGrammarWithSpelling()
+{
+ return "Check for grammar with spelling";
+}
+
+String contextMenuItemTagFontMenu()
+{
+ return "Font menu";
+}
+
+String contextMenuItemTagBold()
+{
+ return "Bold";
+}
+
+String contextMenuItemTagItalic()
+{
+ return "Italic";
+}
+
+String contextMenuItemTagUnderline()
+{
+ return "Underline";
+}
+
+String contextMenuItemTagOutline()
+{
+ return "Outline";
+}
+
+String contextMenuItemTagWritingDirectionMenu()
+{
+ return "Writing direction menu";
+}
+
+String contextMenuItemTagDefaultDirection()
+{
+ return "Default direction";
+}
+
+String contextMenuItemTagLeftToRight()
+{
+ return "Left to right";
+}
+
+String contextMenuItemTagRightToLeft()
+{
+ return "Right to left";
+}
+
+String contextMenuItemTagInspectElement()
+{
+ return "Inspect";
+}
+
+String searchMenuNoRecentSearchesText()
+{
+ return "No recent text searches";
+}
+
+String searchMenuRecentSearchesText()
+{
+ return "Recent text searches";
+}
+
+String searchMenuClearRecentSearchesText()
+{
+ return "Clear recent text searches";
+}
+
+String unknownFileSizeText()
+{
+ return "Unknown";
+}
+
+String AXWebAreaText()
+{
+ return String();
+}
+
+String AXLinkText()
+{
+ return String();
+}
+
+String AXListMarkerText()
+{
+ return String();
+}
+
+String AXImageMapText()
+{
+ return String();
+}
+
+String AXHeadingText()
+{
+ return String();
+}
+
+String AXMenuListPopupActionVerb()
+{
+ return String();
+}
+
+String AXMenuListActionVerb()
+{
+ return String();
+}
+
+String imageTitle(const String& filename, const IntSize& size)
+{
+ return String(filename);
+}
+
+String contextMenuItemTagTextDirectionMenu()
+{
+ return String();
+}
+
+String AXButtonActionVerb()
+{
+ return String();
+}
+
+String AXTextFieldActionVerb()
+{
+ return String();
+}
+
+String AXRadioButtonActionVerb()
+{
+ return String();
+}
+
+String AXCheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXUncheckedCheckBoxActionVerb()
+{
+ return String();
+}
+
+String AXLinkActionVerb()
+{
+ return String();
+}
+
+String AXDefinitionListTermText()
+{
+ return String();
+}
+
+String AXDefinitionListDefinitionText()
+{
+ return String();
+}
+
+String validationMessageValueMissingText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageValueMissingForCheckboxText()
+{
+ notImplemented();
+ return validationMessageValueMissingText();
+}
+
+String validationMessageValueMissingForFileText()
+{
+ notImplemented();
+ return validationMessageValueMissingText();
+}
+
+String validationMessageValueMissingForMultipleFileText()
+{
+ notImplemented();
+ return validationMessageValueMissingText();
+}
+
+String validationMessageValueMissingForRadioText()
+{
+ notImplemented();
+ return validationMessageValueMissingText();
+}
+
+String validationMessageValueMissingForSelectText()
+{
+ notImplemented();
+ return validationMessageValueMissingText();
+}
+
+String validationMessageTypeMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTypeMismatchForEmailText()
+{
+ notImplemented();
+ return validationMessageTypeMismatchText();
+}
+
+String validationMessageTypeMismatchForMultipleEmailText()
+{
+ notImplemented();
+ return validationMessageTypeMismatchText();
+}
+
+String validationMessageTypeMismatchForURLText()
+{
+ notImplemented();
+ return validationMessageTypeMismatchText();
+}
+
+String validationMessagePatternMismatchText()
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageTooLongText(int, int)
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeUnderflowText(const String&)
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageRangeOverflowText(const String&)
+{
+ notImplemented();
+ return String();
+}
+
+String validationMessageStepMismatchText(const String&, const String&)
+{
+ notImplemented();
+ return String();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/LoggingHaiku.cpp b/Source/WebCore/platform/haiku/LoggingHaiku.cpp
new file mode 100644
index 0000000..f09c483
--- /dev/null
+++ b/Source/WebCore/platform/haiku/LoggingHaiku.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * 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 "Logging.h"
+
+
+namespace WebCore {
+
+void InitializeLoggingChannelsIfNecessary()
+{
+ // FIXME: Should read the logging channels from a file.
+ static bool haveInitializedLoggingChannels = false;
+ if (haveInitializedLoggingChannels)
+ return;
+
+ haveInitializedLoggingChannels = true;
+
+ LogEvents.state = WTFLogChannelOn;
+ LogFrames.state = WTFLogChannelOn;
+ LogLoading.state = WTFLogChannelOn;
+ LogPlatformLeaks.state = WTFLogChannelOn;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
new file mode 100644
index 0000000..685827e
--- /dev/null
+++ b/Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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"
+
+#include "PlatformString.h"
+#include <MimeType.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+struct ExtensionMap {
+ const char* extension;
+ const char* mimeType;
+};
+
+static const ExtensionMap extensionMap[] = {
+ { "bmp", "image/bmp" },
+ { "gif", "image/gif" },
+ { "html", "text/html" },
+ { "ico", "image/x-icon" },
+ { "jpeg", "image/jpeg" },
+ { "jpg", "image/jpeg" },
+ { "js", "application/x-javascript" },
+ { "pdf", "application/pdf" },
+ { "png", "image/png" },
+ { "rss", "application/rss+xml" },
+ { "svg", "image/svg+xml" },
+ { "text", "text/plain" },
+ { "txt", "text/plain" },
+ { "xbm", "image/x-xbitmap" },
+ { "xml", "text/xml" },
+ { "xsl", "text/xsl" },
+ { "xhtml", "application/xhtml+xml" },
+ { 0, 0 }
+};
+
+String MIMETypeRegistry::getMIMETypeForExtension(const String& ext)
+{
+ String str = ext.lower();
+
+ // Try WebCore built-in types.
+ const ExtensionMap* extMap = extensionMap;
+ while (extMap->extension) {
+ if (str == extMap->extension)
+ return extMap->mimeType;
+ ++extMap;
+ }
+
+ // Try system mime database.
+ String fakeFileName("filename.");
+ fakeFileName.append(str);
+
+ BMimeType type;
+ if (BMimeType::GuessMimeType(fakeFileName.utf8().data(), &type) == B_OK)
+ return type.Type();
+
+ // unknown
+ return String();
+}
+
+bool MIMETypeRegistry::isApplicationPluginMIMEType(const String&)
+{
+ return false;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PasteboardHaiku.cpp b/Source/WebCore/platform/haiku/PasteboardHaiku.cpp
new file mode 100644
index 0000000..d7a7e08
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PasteboardHaiku.cpp
@@ -0,0 +1,227 @@
+/*
+ * Copyright (C) 2006 Zack Rusin <zack@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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 "KURL.h"
+#include "NotImplemented.h"
+#include "TextResourceDecoder.h"
+#include "markup.h"
+#include <support/Locker.h>
+#include <Clipboard.h>
+#include <Message.h>
+#include <String.h>
+#include <wtf/text/CString.h>
+
+
+namespace WebCore {
+
+Pasteboard::Pasteboard()
+{
+}
+
+Pasteboard::~Pasteboard()
+{
+}
+
+Pasteboard* Pasteboard::generalPasteboard()
+{
+ static Pasteboard pasteboard;
+ return &pasteboard;
+}
+
+// BClipboard unfortunately does not derive from BLocker, so we cannot use BAutolock.
+class AutoClipboardLocker {
+public:
+ AutoClipboardLocker(BClipboard* clipboard)
+ : m_clipboard(clipboard)
+ , m_isLocked(clipboard && clipboard->Lock())
+ {
+ }
+
+ ~AutoClipboardLocker()
+ {
+ if (m_isLocked)
+ m_clipboard->Unlock();
+ }
+
+ bool isLocked() const
+ {
+ return m_isLocked;
+ }
+
+private:
+ BClipboard* m_clipboard;
+ bool m_isLocked;
+};
+
+void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
+{
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return;
+
+ be_clipboard->Clear();
+ BMessage* data = be_clipboard->Data();
+ if (!data)
+ return;
+
+ BString string(frame->selectedText());
+
+ // Replace unwanted representation of blank lines
+ const char* utf8BlankLine = "\302\240\n";
+ string.ReplaceAll(utf8BlankLine, "\n");
+
+ data->AddData("text/plain", B_MIME_TYPE, string.String(), string.Length());
+
+ BString markupString(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs));
+ data->AddData("text/html", B_MIME_TYPE, markupString.String(), markupString.Length());
+
+ be_clipboard->Commit();
+}
+
+void Pasteboard::writePlainText(const String& text)
+{
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return;
+
+ be_clipboard->Clear();
+ BMessage* data = be_clipboard->Data();
+ if (!data)
+ return;
+
+ BString string(text);
+ data->AddData("text/plain", B_MIME_TYPE, string.String(), string.Length());
+ be_clipboard->Commit();
+}
+
+bool Pasteboard::canSmartReplace()
+{
+ notImplemented();
+ return false;
+}
+
+String Pasteboard::plainText(Frame* frame)
+{
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return String();
+
+ BMessage* data = be_clipboard->Data();
+ if (!data)
+ return String();
+
+ const char* buffer = 0;
+ ssize_t bufferLength;
+ BString string;
+ if (data->FindData("text/plain", B_MIME_TYPE, reinterpret_cast<const void**>(&buffer), &bufferLength) == B_OK)
+ string.Append(buffer, bufferLength);
+
+ return string;
+}
+
+PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context,
+ bool allowPlainText, bool& chosePlainText)
+{
+ chosePlainText = false;
+
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return 0;
+
+ BMessage* data = be_clipboard->Data();
+ if (!data)
+ return 0;
+
+ const char* buffer = 0;
+ ssize_t bufferLength;
+ if (data->FindData("text/html", B_MIME_TYPE, reinterpret_cast<const void**>(&buffer), &bufferLength) == B_OK) {
+ RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/plain", "UTF-8", true);
+ String html = decoder->decode(buffer, bufferLength);
+ html += decoder->flush();
+
+ if (!html.isEmpty()) {
+ RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), html, "", FragmentScriptingNotAllowed);
+ if (fragment)
+ return fragment.release();
+ }
+ }
+
+ if (!allowPlainText)
+ return 0;
+
+ if (data->FindData("text/plain", B_MIME_TYPE, reinterpret_cast<const void**>(&buffer), &bufferLength) == B_OK) {
+ BString plainText(buffer, bufferLength);
+
+ chosePlainText = true;
+ RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), plainText);
+ if (fragment)
+ return fragment.release();
+ }
+
+ return 0;
+}
+
+void Pasteboard::writeURL(const KURL& url, const String&, Frame*)
+{
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return;
+
+ be_clipboard->Clear();
+
+ BMessage* data = be_clipboard->Data();
+ if (!data)
+ return;
+
+ BString string(url.string());
+ data->AddData("text/plain", B_MIME_TYPE, string.String(), string.Length());
+ be_clipboard->Commit();
+}
+
+void Pasteboard::writeImage(Node*, const KURL&, const String&)
+{
+ notImplemented();
+}
+
+void Pasteboard::clear()
+{
+ AutoClipboardLocker locker(be_clipboard);
+ if (!locker.isLocked())
+ return;
+
+ be_clipboard->Clear();
+ be_clipboard->Commit();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PlatformKeyboardEventHaiku.cpp b/Source/WebCore/platform/haiku/PlatformKeyboardEventHaiku.cpp
new file mode 100644
index 0000000..ecf5921
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PlatformKeyboardEventHaiku.cpp
@@ -0,0 +1,390 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2008 Andrea Anzani <andrea.anzani@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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 "NotImplemented.h"
+#include "WindowsKeyboardCodes.h"
+#include <InterfaceDefs.h>
+#include <Message.h>
+#include <String.h>
+#include <wtf/text/CString.h>
+
+
+namespace WebCore {
+
+static String keyIdentifierForHaikuKeyCode(char singleByte, int keyCode)
+{
+ switch (singleByte) {
+ case B_FUNCTION_KEY:
+
+ switch (keyCode) {
+ case B_F1_KEY:
+ return "F1";
+ case B_F2_KEY:
+ return "F2";
+ case B_F3_KEY:
+ return "F3";
+ case B_F4_KEY:
+ return "F4";
+ case B_F5_KEY:
+ return "F5";
+ case B_F6_KEY:
+ return "F6";
+ case B_F7_KEY:
+ return "F7";
+ case B_F8_KEY:
+ return "F8";
+ case B_F9_KEY:
+ return "F9";
+ case B_F10_KEY:
+ return "F10";
+ case B_F11_KEY:
+ return "F11";
+ case B_F12_KEY:
+ return "F12";
+ case B_PRINT_KEY:
+ return "Print";
+ case B_PAUSE_KEY:
+ return "Pause";
+ case B_SCROLL_KEY:
+ return ""; // FIXME
+ }
+ break;
+
+ case B_BACKSPACE:
+ return "U+0008";
+ case B_LEFT_ARROW:
+ return "Left";
+ case B_RIGHT_ARROW:
+ return "Right";
+ case B_UP_ARROW:
+ return "Up";
+ case B_DOWN_ARROW:
+ return "Down";
+ case B_INSERT:
+ return "Insert";
+ case B_ENTER:
+ return "Enter";
+ case B_DELETE:
+ return "U+007F";
+ case B_HOME:
+ return "Home";
+ case B_END:
+ return "End";
+ case B_PAGE_UP:
+ return "PageUp";
+ case B_PAGE_DOWN:
+ return "PageDown";
+ case B_TAB:
+ return "U+0009";
+ }
+
+ return String::format("U+%04X", toASCIIUpper(singleByte));
+}
+
+static int windowsKeyCodeForKeyEvent(char singleByte, int keyCode)
+{
+ switch (singleByte) {
+ case B_FUNCTION_KEY:
+ switch (keyCode) {
+ case B_F1_KEY:
+ return VK_F1;
+ case B_F2_KEY:
+ return VK_F2;
+ case B_F3_KEY:
+ return VK_F3;
+ case B_F4_KEY:
+ return VK_F4;
+ case B_F5_KEY:
+ return VK_F5;
+ case B_F6_KEY:
+ return VK_F6;
+ case B_F7_KEY:
+ return VK_F7;
+ case B_F8_KEY:
+ return VK_F8;
+ case B_F9_KEY:
+ return VK_F9;
+ case B_F10_KEY:
+ return VK_F10;
+ case B_F11_KEY:
+ return VK_F11;
+ case B_F12_KEY:
+ return VK_F12;
+ case B_PRINT_KEY:
+ return VK_PRINT;
+ case B_PAUSE_KEY:
+ return 0; // FIXME
+ case B_SCROLL_KEY:
+ return 0; // FIXME
+ }
+ break;
+
+ case B_BACKSPACE:
+ return VK_BACK; // (08) BACKSPACE key
+ case B_TAB:
+ return VK_TAB; // (09) TAB key
+ case B_RETURN:
+ return VK_RETURN; //(0D) Return key
+ case B_ESCAPE:
+ return VK_ESCAPE; // (1B) ESC key
+ case B_SPACE:
+ return VK_SPACE; // (20) SPACEBAR
+ case B_PAGE_UP:
+ return VK_PRIOR; // (21) PAGE UP key
+ case B_PAGE_DOWN:
+ return VK_NEXT; // (22) PAGE DOWN key
+ case B_END:
+ return VK_END; // (23) END key
+ case B_HOME:
+ return VK_HOME; // (24) HOME key
+ case B_LEFT_ARROW:
+ return VK_LEFT; // (25) LEFT ARROW key
+ case B_UP_ARROW:
+ return VK_UP; // (26) UP ARROW key
+ case B_RIGHT_ARROW:
+ return VK_RIGHT; // (27) RIGHT ARROW key
+ case B_DOWN_ARROW:
+ return VK_DOWN; // (28) DOWN ARROW key
+ case B_INSERT:
+ return VK_INSERT; // (2D) INS key
+ case B_DELETE:
+ return VK_DELETE; // (2E) DEL key
+
+ case '0':
+ case ')':
+ return VK_0;
+ case '1':
+ case '!':
+ return VK_1;
+ case '2':
+ case '@':
+ return VK_2;
+ case '3':
+ case '#':
+ return VK_3;
+ case '4':
+ case '$':
+ return VK_4;
+ case '5':
+ case '%':
+ return VK_5;
+ case '6':
+ case '^':
+ return VK_6;
+ case '7':
+ case '&':
+ return VK_7;
+ case '8':
+ case '*':
+ return VK_8;
+ case '9':
+ case '(':
+ return VK_9;
+ case 'a':
+ case 'A':
+ return VK_A;
+ case 'b':
+ case 'B':
+ return VK_B;
+ case 'c':
+ case 'C':
+ return VK_C;
+ case 'd':
+ case 'D':
+ return VK_D;
+ case 'e':
+ case 'E':
+ return VK_E;
+ case 'f':
+ case 'F':
+ return VK_F;
+ case 'g':
+ case 'G':
+ return VK_G;
+ case 'h':
+ case 'H':
+ return VK_H;
+ case 'i':
+ case 'I':
+ return VK_I;
+ case 'j':
+ case 'J':
+ return VK_J;
+ case 'k':
+ case 'K':
+ return VK_K;
+ case 'l':
+ case 'L':
+ return VK_L;
+ case 'm':
+ case 'M':
+ return VK_M;
+ case 'n':
+ case 'N':
+ return VK_N;
+ case 'o':
+ case 'O':
+ return VK_O;
+ case 'p':
+ case 'P':
+ return VK_P;
+ case 'q':
+ case 'Q':
+ return VK_Q;
+ case 'r':
+ case 'R':
+ return VK_R;
+ case 's':
+ case 'S':
+ return VK_S;
+ case 't':
+ case 'T':
+ return VK_T;
+ case 'u':
+ case 'U':
+ return VK_U;
+ case 'v':
+ case 'V':
+ return VK_V;
+ case 'w':
+ case 'W':
+ return VK_W;
+ case 'x':
+ case 'X':
+ return VK_X;
+ case 'y':
+ case 'Y':
+ return VK_Y;
+ case 'z':
+ case 'Z':
+ return VK_Z;
+ case ';':
+ case ':':
+ return VK_OEM_1;
+ case '+':
+ case '=':
+ return VK_OEM_PLUS;
+ case ',':
+ case '<':
+ return VK_OEM_COMMA;
+ case '-':
+ case '_':
+ return VK_OEM_MINUS;
+ case '.':
+ case '>':
+ return VK_OEM_PERIOD;
+ case '/':
+ case '?':
+ return VK_OEM_2;
+ case '`':
+ case '~':
+ return VK_OEM_3;
+ case '[':
+ case '{':
+ return VK_OEM_4;
+ case '\\':
+ case '|':
+ return VK_OEM_5;
+ case ']':
+ case '}':
+ return VK_OEM_6;
+ case '\'':
+ case '"':
+ return VK_OEM_7;
+ }
+ return singleByte;
+}
+
+PlatformKeyboardEvent::PlatformKeyboardEvent(BMessage* message)
+ : m_autoRepeat(false)
+ , m_isKeypad(false)
+ , m_shiftKey(false)
+ , m_ctrlKey(false)
+ , m_altKey(false)
+ , m_metaKey(false)
+{
+ BString bytes = message->FindString("bytes");
+
+ m_nativeVirtualKeyCode = message->FindInt32("key");
+
+ m_text = String::fromUTF8(bytes.String(), bytes.Length());
+ m_unmodifiedText = String(bytes.String(), bytes.Length());
+ m_keyIdentifier = keyIdentifierForHaikuKeyCode(bytes.ByteAt(0), m_nativeVirtualKeyCode);
+
+ m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(bytes.ByteAt(0), m_nativeVirtualKeyCode);
+
+ if (message->what == B_KEY_UP)
+ m_type = KeyUp;
+ else if (message->what == B_KEY_DOWN)
+ m_type = KeyDown;
+
+ int32 modifiers = message->FindInt32("modifiers");
+ m_shiftKey = modifiers & B_SHIFT_KEY;
+ m_ctrlKey = modifiers & B_COMMAND_KEY;
+ m_altKey = modifiers & B_CONTROL_KEY;
+ m_metaKey = modifiers & B_OPTION_KEY;
+}
+
+void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCompatibilityMode)
+{
+ // 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 (backwardCompatibilityMode)
+ return;
+
+ if (type == RawKeyDown) {
+ m_text = String();
+ m_unmodifiedText = String();
+ } else {
+ m_keyIdentifier = String();
+ m_windowsVirtualKeyCode = 0;
+ }
+}
+
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+ return ::modifiers() & B_CAPS_LOCK;
+}
+
+void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)
+{
+ unit32 modifiers = ::modifiers();
+ shiftKey = modifiers & B_SHIFT_KEY;
+ ctrlKey = modifiers & B_COMMAND_KEY;
+ altKey = modifiers & B_CONTROL_KEY;
+ metaKey = modifiers & B_OPTION_KEY;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp b/Source/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp
new file mode 100644
index 0000000..f1051a5
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * 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 <Message.h>
+#include <View.h>
+
+namespace WebCore {
+
+PlatformMouseEvent::PlatformMouseEvent(const BMessage* message)
+ : m_position(message->FindPoint("be:view_where"))
+ , m_globalPosition(message->FindPoint("screen_where"))
+ , m_clickCount(message->FindInt32("clicks"))
+ , m_timestamp(message->FindInt64("when") / 1000000.0)
+{
+ int32 buttons = 0;
+ if (message->what == B_MOUSE_UP)
+ message->FindInt32("previous buttons", &buttons);
+ else
+ message->FindInt32("buttons", &buttons);
+
+ if (buttons & B_PRIMARY_MOUSE_BUTTON)
+ m_button = LeftButton;
+ else if (buttons & B_SECONDARY_MOUSE_BUTTON)
+ m_button = RightButton;
+ else if (buttons & B_TERTIARY_MOUSE_BUTTON)
+ m_button = MiddleButton;
+ else
+ m_button = NoButton;
+
+ switch (message->what) {
+ case B_MOUSE_DOWN:
+ m_eventType = MouseEventPressed;
+ break;
+ case B_MOUSE_UP:
+ m_eventType = MouseEventReleased;
+ break;
+ case B_MOUSE_MOVED:
+ default:
+ m_eventType = MouseEventMoved;
+ break;
+ };
+
+ int32 modifiers = message->FindInt32("modifiers");
+ m_shiftKey = modifiers & B_SHIFT_KEY;
+ m_ctrlKey = modifiers & B_CONTROL_KEY;
+ m_altKey = modifiers & B_COMMAND_KEY;
+ m_metaKey = modifiers & B_OPTION_KEY;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp b/Source/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
new file mode 100644
index 0000000..351b4ec
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PlatformWheelEvent.h"
+
+#include "Scrollbar.h"
+
+#include <InterfaceDefs.h>
+#include <Message.h>
+#include <Point.h>
+
+
+namespace WebCore {
+
+PlatformWheelEvent::PlatformWheelEvent(BMessage* message)
+ : m_position(message->FindPoint("be:view_where"))
+ , m_globalPosition(message->FindPoint("screen_where"))
+ , m_deltaX(message->FindFloat("be:wheel_delta_x"))
+ , m_deltaY(message->FindFloat("be:wheel_delta_y"))
+ , m_wheelTicksX(m_deltaX)
+ , m_wheelTicksY(m_deltaY)
+ , m_granularity(ScrollByPixelWheelEvent)
+ , m_isAccepted(false)
+{
+ m_deltaX *= -Scrollbar::pixelsPerLineStep();
+ m_deltaY *= -Scrollbar::pixelsPerLineStep();
+
+ int32 modifiers = message->FindInt32("modifiers");
+ m_shiftKey = modifiers & B_SHIFT_KEY;
+ m_ctrlKey = modifiers & B_CONTROL_KEY;
+ m_altKey = modifiers & B_COMMAND_KEY;
+ m_metaKey = modifiers & B_OPTION_KEY;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PopupMenuHaiku.cpp b/Source/WebCore/platform/haiku/PopupMenuHaiku.cpp
new file mode 100644
index 0000000..e3edb83
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PopupMenuHaiku.cpp
@@ -0,0 +1,192 @@
+/*
+ * This file is part of the popup menu implementation for <select> elements in WebCore.
+ *
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ * Copyright (C) 2010 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "PopupMenuHaiku.h"
+
+#include "FrameView.h"
+
+#include "NotImplemented.h"
+#include <Application.h>
+#include <Handler.h>
+#include <MenuItem.h>
+#include <Message.h>
+#include <PopUpMenu.h>
+#include <String.h>
+#include <Window.h>
+#include <support/Autolock.h>
+#include <support/Locker.h>
+
+namespace WebCore {
+
+static const uint32 kPopupResult = 'pmrs';
+static const uint32 kPopupHidden = 'pmhd';
+
+// This BHandler is added to the application (main) thread, so that we
+// invoke methods on the PopupMenuClient within the main thread.
+class PopupMenuHandler : public BHandler {
+public:
+ PopupMenuHandler(PopupMenuClient* popupClient)
+ : m_popupClient(popupClient)
+ {
+ }
+
+ virtual void MessageReceived(BMessage* message)
+ {
+ switch (message->what) {
+ case kPopupResult: {
+ int32 index = 0;
+ message->FindInt32("index", &index);
+ m_popupClient->valueChanged(index);
+ break;
+ }
+ case kPopupHidden:
+ m_popupClient->popupDidHide();
+ break;
+
+ default:
+ BHandler::MessageReceived(message);
+ }
+ }
+
+private:
+ PopupMenuClient* m_popupClient;
+};
+
+class HaikuPopup : public BPopUpMenu {
+public:
+ HaikuPopup(PopupMenuClient* popupClient)
+ : BPopUpMenu("WebCore Popup", true, false)
+ , m_popupClient(popupClient)
+ , m_Handler(popupClient)
+ {
+ if (be_app->Lock()) {
+ be_app->AddHandler(&m_Handler);
+ be_app->Unlock();
+ }
+ SetAsyncAutoDestruct(false);
+ }
+
+ virtual ~HaikuPopup()
+ {
+ if (be_app->Lock()) {
+ be_app->RemoveHandler(&m_Handler);
+ be_app->Unlock();
+ }
+ }
+
+ void show(const IntRect& rect, FrameView* view, int index)
+ {
+ // Clean out the menu first
+ for (int32 i = CountItems() - 1; i >= 0; i--)
+ delete RemoveItem(i);
+
+ // Popuplate the menu from the client
+ int itemCount = m_popupClient->listSize();
+ for (int i = 0; i < itemCount; i++) {
+ if (m_popupClient->itemIsSeparator(i))
+ AddSeparatorItem();
+ else {
+ // NOTE: WebCore distinguishes between "Group" and "Label"
+ // here, but both types of item (radio or check mark) currently
+ // look the same on Haiku.
+ BString label(m_popupClient->itemText(i));
+ BMessage* message = new BMessage(kPopupResult);
+ message->AddInt32("index", i);
+ BMenuItem* item = new BMenuItem(label.String(), message);
+ AddItem(item);
+ item->SetTarget(BMessenger(&m_Handler));
+ item->SetEnabled(m_popupClient->itemIsEnabled(i));
+ item->SetMarked(i == index);
+ }
+ }
+
+ // We need to force a layout now, or the item frames will not be
+ // computed yet, so we cannot move the current item under the mouse.
+ DoLayout();
+
+ // Account for frame of menu field
+ BRect screenRect(view->contentsToScreen(rect));
+ screenRect.OffsetBy(2, 2);
+ // Move currently selected item under the mouse.
+ if (BMenuItem* item = ItemAt(index))
+ screenRect.OffsetBy(0, -item->Frame().top);
+
+ BRect openRect = Bounds().OffsetToSelf(screenRect.LeftTop());
+
+ Go(screenRect.LeftTop(), true, true, openRect, true);
+ }
+
+ void hide()
+ {
+ if (!IsHidden())
+ Hide();
+ }
+
+private:
+ virtual void Hide()
+ {
+ BPopUpMenu::Hide();
+ be_app->PostMessage(kPopupHidden, &m_Handler);
+ }
+
+ PopupMenuClient* m_popupClient;
+ PopupMenuHandler m_Handler;
+};
+
+PopupMenuHaiku::PopupMenuHaiku(PopupMenuClient* client)
+ : m_popupClient(client)
+ , m_menu(new HaikuPopup(client))
+{
+ // We don't need additional references to the client, since we completely
+ // control any sub-objects we create that need it as well.
+}
+
+PopupMenuHaiku::~PopupMenuHaiku()
+{
+ delete m_menu;
+}
+
+void PopupMenuHaiku::disconnectClient()
+{
+ m_popupClient = 0;
+}
+
+void PopupMenuHaiku::show(const IntRect& rect, FrameView* view, int index)
+{
+ // The menu will update itself from the PopupMenuClient before showing.
+ m_menu->show(rect, view, index);
+}
+
+void PopupMenuHaiku::hide()
+{
+ m_menu->hide();
+}
+
+void PopupMenuHaiku::updateFromElement()
+{
+ client()->setTextFromItem(m_popupClient->selectedIndex());
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/PopupMenuHaiku.h b/Source/WebCore/platform/haiku/PopupMenuHaiku.h
new file mode 100644
index 0000000..9207923
--- /dev/null
+++ b/Source/WebCore/platform/haiku/PopupMenuHaiku.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 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 PopupMenuHaiku_h
+#define PopupMenuHaiku_h
+
+#include "IntRect.h"
+#include "PopupMenu.h"
+#include "PopupMenuClient.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class FrameView;
+class HaikuPopup;
+class Scrollbar;
+
+class PopupMenuHaiku : public PopupMenu {
+public:
+ PopupMenuHaiku(PopupMenuClient*);
+ ~PopupMenuHaiku();
+
+ virtual void show(const IntRect&, FrameView*, int index);
+ virtual void hide();
+ virtual void updateFromElement();
+ virtual void disconnectClient();
+
+private:
+ PopupMenuClient* client() const { return m_popupClient; }
+
+ PopupMenuClient* m_popupClient;
+ HaikuPopup* m_menu;
+};
+
+}
+
+#endif // PopupMenuHaiku_h
diff --git a/Source/WebCore/platform/haiku/RenderThemeHaiku.cpp b/Source/WebCore/platform/haiku/RenderThemeHaiku.cpp
new file mode 100644
index 0000000..78dfa9e
--- /dev/null
+++ b/Source/WebCore/platform/haiku/RenderThemeHaiku.cpp
@@ -0,0 +1,178 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
+ * 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "config.h"
+#include "RenderThemeHaiku.h"
+
+#include "GraphicsContext.h"
+#include "NotImplemented.h"
+#include <ControlLook.h>
+#include <View.h>
+
+
+namespace WebCore {
+
+PassRefPtr<RenderTheme> RenderThemeHaiku::create()
+{
+ return adoptRef(new RenderThemeHaiku());
+}
+
+PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*)
+{
+ static RenderTheme* renderTheme = RenderThemeHaiku::create().releaseRef();
+ return renderTheme;
+}
+
+RenderThemeHaiku::RenderThemeHaiku()
+{
+}
+
+RenderThemeHaiku::~RenderThemeHaiku()
+{
+}
+
+static bool supportsFocus(ControlPart appearance)
+{
+ switch (appearance) {
+ case PushButtonPart:
+ case ButtonPart:
+ case TextFieldPart:
+ case TextAreaPart:
+ case SearchFieldPart:
+ case MenulistPart:
+ case RadioPart:
+ case CheckboxPart:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool RenderThemeHaiku::supportsFocusRing(const RenderStyle* style) const
+{
+ return supportsFocus(style->appearance());
+}
+
+Color RenderThemeHaiku::platformActiveSelectionBackgroundColor() const
+{
+ return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR));
+}
+
+Color RenderThemeHaiku::platformInactiveSelectionBackgroundColor() const
+{
+ return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR));
+}
+
+Color RenderThemeHaiku::platformActiveSelectionForegroundColor() const
+{
+ return Color(ui_color(B_CONTROL_TEXT_COLOR));
+}
+
+Color RenderThemeHaiku::platformInactiveSelectionForegroundColor() const
+{
+ return Color(ui_color(B_CONTROL_TEXT_COLOR));
+}
+
+Color RenderThemeHaiku::platformTextSearchHighlightColor() const
+{
+ return Color(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR));
+}
+
+void RenderThemeHaiku::systemFont(int propId, FontDescription&) const
+{
+ notImplemented();
+}
+
+bool RenderThemeHaiku::paintCheckbox(RenderObject*, const PaintInfo& info, const IntRect& intRect)
+{
+ if (info.context->paintingDisabled())
+ return false;
+
+ rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+ BRect rect = intRect;
+ BView* view = info.context->platformContext();
+
+ if (!be_control_look)
+ return false;
+
+ be_control_look->DrawCheckBox(view, rect, rect, base);
+ return true;
+}
+
+void RenderThemeHaiku::setCheckboxSize(RenderStyle* style) const
+{
+ int size = 10;
+
+ // If the width and height are both specified, then we have nothing to do.
+ if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto())
+ return;
+
+ // FIXME: A hard-coded size of 'size' is used. This is wrong but necessary for now.
+ if (style->width().isIntrinsicOrAuto())
+ style->setWidth(Length(size, Fixed));
+
+ if (style->height().isAuto())
+ style->setHeight(Length(size, Fixed));
+}
+
+bool RenderThemeHaiku::paintRadio(RenderObject*, const PaintInfo& info, const IntRect& intRect)
+{
+ if (info.context->paintingDisabled())
+ return false;
+
+ rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
+ BRect rect = intRect;
+ BView* view = info.context->platformContext();
+
+ if (!be_control_look)
+ return false;
+
+ be_control_look->DrawRadioButton(view, rect, rect, base);
+ return true;
+}
+
+void RenderThemeHaiku::setRadioSize(RenderStyle* style) const
+{
+ // This is the same as checkboxes.
+ setCheckboxSize(style);
+}
+
+void RenderThemeHaiku::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const
+{
+ // Leave some space for the arrow.
+ style->setPaddingRight(Length(22, Fixed));
+ const int minHeight = 20;
+ style->setMinHeight(Length(minHeight, Fixed));
+}
+
+bool RenderThemeHaiku::paintMenuList(RenderObject*, const PaintInfo&, const IntRect&)
+{
+ notImplemented();
+ return false;
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/haiku/RenderThemeHaiku.h b/Source/WebCore/platform/haiku/RenderThemeHaiku.h
new file mode 100644
index 0000000..06b7bdf
--- /dev/null
+++ b/Source/WebCore/platform/haiku/RenderThemeHaiku.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the WebKit project.
+ *
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef RenderThemeHaiku_h
+#define RenderThemeHaiku_h
+
+#include "RenderTheme.h"
+
+namespace WebCore {
+
+ class RenderThemeHaiku : public RenderTheme {
+ private:
+ RenderThemeHaiku();
+ virtual ~RenderThemeHaiku();
+
+ public:
+ static PassRefPtr<RenderTheme> create();
+
+ // A method asking if the theme's controls actually care about redrawing when hovered.
+ virtual bool supportsHover(const RenderStyle* style) const { return false; }
+
+ // A method asking if the theme is able to draw the focus ring.
+ virtual bool supportsFocusRing(const RenderStyle*) const;
+
+ // The platform selection color.
+ virtual Color platformActiveSelectionBackgroundColor() const;
+ virtual Color platformInactiveSelectionBackgroundColor() const;
+ virtual Color platformActiveSelectionForegroundColor() const;
+ virtual Color platformInactiveSelectionForegroundColor() const;
+
+ virtual Color platformTextSearchHighlightColor() const;
+
+ // System fonts.
+ virtual void systemFont(int propId, FontDescription&) const;
+
+ protected:
+ virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual void setCheckboxSize(RenderStyle*) const;
+
+ virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&);
+ virtual void setRadioSize(RenderStyle*) const;
+
+ virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
+ virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
+ };
+
+} // namespace WebCore
+
+#endif // RenderThemeHaiku_h
diff --git a/Source/WebCore/platform/haiku/ScreenHaiku.cpp b/Source/WebCore/platform/haiku/ScreenHaiku.cpp
new file mode 100644
index 0000000..d43297b
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ScreenHaiku.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Screen.h"
+
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#include "Widget.h"
+#include <GraphicsDefs.h>
+#include <interface/Screen.h>
+
+
+namespace WebCore {
+
+FloatRect screenRect(Widget*)
+{
+ BScreen screen;
+ // FIXME: We assume this screen is valid
+ return FloatRect(screen.Frame());
+}
+
+FloatRect screenAvailableRect(Widget* widget)
+{
+ // FIXME: We could use the get_deskbar_frame() function
+ // from InterfaceDefs.h to make this smaller
+ return screenRect(widget);
+}
+
+int screenDepth(Widget*)
+{
+ BScreen screen;
+ // FIXME: We assume this screen is valid
+ color_space cs = screen.ColorSpace();
+
+ size_t pixelChunk, rowAlignment, pixelsPerChunk;
+ if (get_pixel_size_for(cs, &pixelChunk, &rowAlignment, &pixelsPerChunk) == B_OK)
+ // FIXME: Not sure if this is right
+ return pixelChunk * 8;
+
+ return 8;
+}
+
+int screenDepthPerComponent(Widget*)
+{
+ notImplemented();
+ return 8;
+}
+
+bool screenIsMonochrome(Widget*)
+{
+ BScreen screen;
+ // FIXME: We assume this screen is valid
+ return screen.ColorSpace() == B_MONOCHROME_1_BIT;
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp b/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp
new file mode 100644
index 0000000..8adab3d
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright 2009 Maxime Simon <simon.maxime@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 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 "ScrollbarThemeHaiku.h"
+
+#include "GraphicsContext.h"
+#include "Scrollbar.h"
+#include <ControlLook.h>
+#include <InterfaceDefs.h>
+
+
+int buttonWidth(int scrollbarWidth, int thickness)
+{
+ return scrollbarWidth < 2 * thickness ? scrollbarWidth / 2 : thickness;
+}
+
+namespace WebCore {
+
+ScrollbarTheme* ScrollbarTheme::nativeTheme()
+{
+ static ScrollbarThemeHaiku theme;
+ return &theme;
+}
+
+ScrollbarThemeHaiku::ScrollbarThemeHaiku()
+{
+}
+
+ScrollbarThemeHaiku::~ScrollbarThemeHaiku()
+{
+}
+
+int ScrollbarThemeHaiku::scrollbarThickness(ScrollbarControlSize controlSize)
+{
+ // FIXME: Should we make a distinction between a Small and a Regular Scrollbar?
+ return 16;
+}
+
+bool ScrollbarThemeHaiku::hasButtons(Scrollbar* scrollbar)
+{
+ return scrollbar->enabled();
+}
+
+bool ScrollbarThemeHaiku::hasThumb(Scrollbar* scrollbar)
+{
+ return scrollbar->enabled() && thumbLength(scrollbar) > 0;
+}
+
+IntRect ScrollbarThemeHaiku::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
+{
+ if (part == BackButtonEndPart)
+ return IntRect();
+
+ int thickness = scrollbarThickness();
+ IntPoint buttonOrigin(scrollbar->x(), scrollbar->y());
+ IntSize buttonSize = scrollbar->orientation() == HorizontalScrollbar
+ ? IntSize(buttonWidth(scrollbar->width(), thickness), thickness)
+ : IntSize(thickness, buttonWidth(scrollbar->height(), thickness));
+ IntRect buttonRect(buttonOrigin, buttonSize);
+
+ return buttonRect;
+}
+
+IntRect ScrollbarThemeHaiku::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool)
+{
+ if (part == BackButtonStartPart)
+ return IntRect();
+
+ int thickness = scrollbarThickness();
+ if (scrollbar->orientation() == HorizontalScrollbar) {
+ int width = buttonWidth(scrollbar->width(), thickness);
+ return IntRect(scrollbar->x() + scrollbar->width() - width, scrollbar->y(), width, thickness);
+ }
+
+ int height = buttonWidth(scrollbar->height(), thickness);
+ return IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height() - height, thickness, height);
+}
+
+IntRect ScrollbarThemeHaiku::trackRect(Scrollbar* scrollbar, bool)
+{
+ int thickness = scrollbarThickness();
+ if (scrollbar->orientation() == HorizontalScrollbar) {
+ if (scrollbar->width() < 2 * thickness)
+ return IntRect();
+ return IntRect(scrollbar->x() + thickness, scrollbar->y(), scrollbar->width() - 2 * thickness, thickness);
+ }
+ if (scrollbar->height() < 2 * thickness)
+ return IntRect();
+ return IntRect(scrollbar->x(), scrollbar->y() + thickness, thickness, scrollbar->height() - 2 * thickness);
+}
+
+void ScrollbarThemeHaiku::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar)
+{
+ if (!be_control_look)
+ return;
+
+ BRect rect = trackRect(scrollbar, false);
+ orientation scrollbarOrientation = scrollbar->orientation() == HorizontalScrollbar ? B_HORIZONTAL : B_VERTICAL;
+
+ be_control_look->DrawScrollBarBackground(context->platformContext(), rect, rect, ui_color(B_PANEL_BACKGROUND_COLOR), 0, scrollbarOrientation);
+}
+
+void ScrollbarThemeHaiku::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part)
+{
+ if (!be_control_look)
+ return;
+
+ BRect drawRect = BRect(rect);
+ BView* view = context->platformContext();
+ rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
+ rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT);
+
+ be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor);
+ be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor);
+
+ int arrowDirection;
+ if (scrollbar->orientation() == VerticalScrollbar)
+ arrowDirection = part == BackButtonStartPart ? BControlLook::B_UP_ARROW : BControlLook::B_DOWN_ARROW;
+ else
+ arrowDirection = part == BackButtonStartPart ? BControlLook::B_LEFT_ARROW : BControlLook::B_RIGHT_ARROW;
+
+ be_control_look->DrawArrowShape(view, drawRect, drawRect, ui_color(B_CONTROL_TEXT_COLOR), arrowDirection);
+}
+
+void ScrollbarThemeHaiku::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& rect)
+{
+ if (!be_control_look)
+ return;
+
+ BRect drawRect = BRect(rect);
+ BView* view = context->platformContext();
+ rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR);
+ rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT);
+
+ be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor);
+ be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor);
+}
+
+}
+
diff --git a/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.h b/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.h
new file mode 100644
index 0000000..18e2cc0
--- /dev/null
+++ b/Source/WebCore/platform/haiku/ScrollbarThemeHaiku.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright 2009 Maxime Simon <simon.maxime@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 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 ScrollbarThemeHaiku_h
+#define ScrollbarThemeHaiku_h
+
+#include "ScrollbarThemeComposite.h"
+
+namespace WebCore {
+ class Scrollbar;
+
+ class ScrollbarThemeHaiku : public ScrollbarThemeComposite {
+ public:
+ ScrollbarThemeHaiku();
+ virtual ~ScrollbarThemeHaiku();
+
+ virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
+
+ virtual bool hasButtons(Scrollbar*);
+ virtual bool hasThumb(Scrollbar*);
+
+ virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting);
+ virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting);
+ virtual IntRect trackRect(Scrollbar*, bool painting);
+
+ virtual void paintScrollbarBackground(GraphicsContext*, Scrollbar*);
+ virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart);
+ virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&);
+ };
+
+}
+#endif
diff --git a/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp b/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp
new file mode 100644
index 0000000..ea73c61
--- /dev/null
+++ b/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "SearchPopupMenuHaiku.h"
+
+#include "NotImplemented.h"
+#include <wtf/text/AtomicString.h>
+
+
+namespace WebCore {
+
+SearchPopupMenuHaiku::SearchPopupMenuHaiku(PopupMenuClient* client)
+ : m_popup(adoptRef(new PopupMenuHaiku(client)))
+{
+}
+
+void SearchPopupMenuHaiku::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
+{
+ notImplemented();
+}
+
+void SearchPopupMenuHaiku::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
+{
+ notImplemented();
+}
+
+bool SearchPopupMenuHaiku::enabled()
+{
+ notImplemented();
+ return false;
+}
+
+PopupMenu* SearchPopupMenuHaiku::popupMenu()
+{
+ return m_popup.get();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.h b/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.h
new file mode 100644
index 0000000..a9e8e8d
--- /dev/null
+++ b/Source/WebCore/platform/haiku/SearchPopupMenuHaiku.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 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 SearchPopupMenuHaiku_h
+#define SearchPopupMenuHaiku_h
+
+#include "PopupMenuHaiku.h"
+#include "SearchPopupMenu.h"
+
+namespace WebCore {
+
+class SearchPopupMenuHaiku : public SearchPopupMenu {
+public:
+ SearchPopupMenuHaiku(PopupMenuClient*);
+
+ virtual PopupMenu* popupMenu();
+ virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems);
+ virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems);
+ virtual bool enabled();
+
+private:
+ RefPtr<PopupMenuHaiku> m_popup;
+};
+
+}
+
+#endif // SearchPopupMenuHaiku_h
diff --git a/Source/WebCore/platform/haiku/SharedBufferHaiku.cpp b/Source/WebCore/platform/haiku/SharedBufferHaiku.cpp
new file mode 100644
index 0000000..5bab562
--- /dev/null
+++ b/Source/WebCore/platform/haiku/SharedBufferHaiku.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * 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 <File.h>
+#include <String.h>
+
+namespace WebCore {
+
+PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fileName)
+{
+ if (fileName.isEmpty())
+ return 0;
+
+ BFile file(BString(fileName).String(), B_READ_ONLY);
+ if (file.InitCheck() != B_OK)
+ return 0;
+
+ off_t size;
+ file.GetSize(&size);
+
+ Vector<char> buffer(size);
+ file.Read(buffer.data(), buffer.size());
+ return SharedBuffer::adoptVector(buffer);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/haiku/SharedTimerHaiku.cpp b/Source/WebCore/platform/haiku/SharedTimerHaiku.cpp
new file mode 100644
index 0000000..6265a2a
--- /dev/null
+++ b/Source/WebCore/platform/haiku/SharedTimerHaiku.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SharedTimer.h"
+
+#include <MessageFilter.h>
+#include <MessageRunner.h>
+#include <Looper.h>
+#include <support/Locker.h>
+#include <support/Autolock.h>
+#include <wtf/CurrentTime.h>
+
+#define FIRE_MESSAGE 'fire'
+
+
+namespace WebCore {
+
+class SharedTimerHaiku: public BMessageFilter {
+ friend void setSharedTimerFiredFunction(void (*f)());
+public:
+ static SharedTimerHaiku* instance();
+
+ void start(double);
+ void stop();
+
+protected:
+ virtual filter_result Filter(BMessage*, BHandler**);
+
+private:
+ SharedTimerHaiku();
+ ~SharedTimerHaiku();
+
+ void (*m_timerFunction)();
+ bool m_shouldRun;
+};
+
+SharedTimerHaiku::SharedTimerHaiku()
+ : BMessageFilter(FIRE_MESSAGE)
+ , m_timerFunction(0)
+ , m_shouldRun(false)
+{
+}
+
+SharedTimerHaiku::~SharedTimerHaiku()
+{
+}
+
+SharedTimerHaiku* SharedTimerHaiku::instance()
+{
+ BLooper* looper = BLooper::LooperForThread(find_thread(0));
+ static SharedTimerHaiku* timer;
+
+ if (!timer) {
+ BAutolock lock(looper);
+ timer = new SharedTimerHaiku();
+ looper->AddCommonFilter(timer);
+ }
+
+ return timer;
+}
+
+void SharedTimerHaiku::start(double fireTime)
+{
+ m_shouldRun = true;
+
+ double intervalInSeconds = fireTime - currentTime();
+ bigtime_t intervalInMicroSeconds = intervalInSeconds < 0 ? 0 : intervalInSeconds * 1000000;
+
+ BMessageRunner::StartSending(Looper(), new BMessage(FIRE_MESSAGE), intervalInMicroSeconds, 1);
+}
+
+void SharedTimerHaiku::stop()
+{
+ m_shouldRun = false;
+}
+
+filter_result SharedTimerHaiku::Filter(BMessage*, BHandler**)
+{
+ if (m_shouldRun && m_timerFunction)
+ m_timerFunction();
+
+ return B_SKIP_MESSAGE;
+}
+
+// WebCore functions
+void setSharedTimerFiredFunction(void (*f)())
+{
+ SharedTimerHaiku::instance()->m_timerFunction = f;
+}
+
+void setSharedTimerFireTime(double fireTime)
+{
+ SharedTimerHaiku::instance()->start(fireTime);
+}
+
+void stopSharedTimer()
+{
+ SharedTimerHaiku::instance()->stop();
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/haiku/SoundHaiku.cpp b/Source/WebCore/platform/haiku/SoundHaiku.cpp
new file mode 100644
index 0000000..9bee93f
--- /dev/null
+++ b/Source/WebCore/platform/haiku/SoundHaiku.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Sound.h"
+
+#include <Beep.h>
+
+
+namespace WebCore {
+
+void systemBeep()
+{
+ beep();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/TemporaryLinkStubs.cpp b/Source/WebCore/platform/haiku/TemporaryLinkStubs.cpp
new file mode 100644
index 0000000..58ab873
--- /dev/null
+++ b/Source/WebCore/platform/haiku/TemporaryLinkStubs.cpp
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2006 Apple Computer, 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) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "CookieStorage.h"
+#include "KURL.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include "SSLKeyGenerator.h"
+#include "SystemTime.h"
+
+using namespace WebCore;
+
+Vector<char> loadResourceIntoArray(const char*)
+{
+ notImplemented();
+ return Vector<char>();
+}
+
+namespace WebCore {
+
+String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url)
+{
+ return String();
+}
+
+void getSupportedKeySizes(Vector<String>&)
+{
+ notImplemented();
+}
+
+float userIdleTime()
+{
+ notImplemented();
+ return 0;
+}
+
+void callOnMainThread(void (*)())
+{
+ notImplemented();
+}
+
+String KURL::fileSystemPath() const
+{
+ notImplemented();
+ return String();
+}
+
+void setCookieStoragePrivateBrowsingEnabled(bool)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
+
diff --git a/Source/WebCore/platform/haiku/WidgetHaiku.cpp b/Source/WebCore/platform/haiku/WidgetHaiku.cpp
new file mode 100644
index 0000000..3663d67
--- /dev/null
+++ b/Source/WebCore/platform/haiku/WidgetHaiku.cpp
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com>
+ * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de>
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "Widget.h"
+
+#include "Cursor.h"
+#include "IntRect.h"
+#include "NotImplemented.h"
+#include <View.h>
+
+namespace WebCore {
+
+class AutoPlatformWidgetLocker {
+public:
+ AutoPlatformWidgetLocker(PlatformWidget widget)
+ : m_widget(widget)
+ {
+ if (!m_widget || m_widget->LockLooperWithTimeout(5000) != B_OK)
+ m_widget = 0;
+ }
+
+ ~AutoPlatformWidgetLocker()
+ {
+ if (m_widget)
+ m_widget->UnlockLooper();
+ }
+
+ bool isLocked() const
+ {
+ return m_widget;
+ }
+
+private:
+ PlatformWidget m_widget;
+};
+
+Widget::Widget(PlatformWidget widget)
+ : m_topLevelPlatformWidget(0)
+{
+ init(widget);
+}
+
+Widget::~Widget()
+{
+}
+
+IntRect Widget::frameRect() const
+{
+ return m_frame;
+}
+
+void Widget::setFrameRect(const IntRect& rect)
+{
+ m_frame = rect;
+}
+
+void Widget::setFocus(bool focused)
+{
+ if (focused) {
+ AutoPlatformWidgetLocker locker(topLevelPlatformWidget());
+ if (locker.isLocked())
+ topLevelPlatformWidget()->MakeFocus();
+ }
+}
+
+void Widget::setCursor(const Cursor& cursor)
+{
+ AutoPlatformWidgetLocker locker(topLevelPlatformWidget());
+ if (locker.isLocked())
+ topLevelPlatformWidget()->SetViewCursor(cursor.impl());
+}
+
+void Widget::show()
+{
+ setSelfVisible(true);
+ if (!isParentVisible())
+ return;
+
+ AutoPlatformWidgetLocker locker(platformWidget());
+ if (locker.isLocked() && platformWidget()->IsHidden())
+ platformWidget()->Show();
+}
+
+void Widget::hide()
+{
+ setSelfVisible(false);
+ if (!isParentVisible())
+ return;
+
+ AutoPlatformWidgetLocker locker(platformWidget());
+ if (locker.isLocked() && !platformWidget()->IsHidden())
+ platformWidget()->Hide();
+}
+
+void Widget::paint(GraphicsContext*, IntRect const&)
+{
+ notImplemented();
+}
+
+void Widget::setIsSelected(bool)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
+