From cad810f21b803229eb11403f9209855525a25d57 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 6 May 2011 11:45:16 +0100 Subject: Merge WebKit at r75315: Initial merge by git. Change-Id: I570314b346ce101c935ed22a626b48c2af266b84 --- Source/WebCore/platform/haiku/ClipboardHaiku.cpp | 217 +++++++++ Source/WebCore/platform/haiku/ClipboardHaiku.h | 74 +++ Source/WebCore/platform/haiku/ContextMenuHaiku.cpp | 122 +++++ .../platform/haiku/ContextMenuItemHaiku.cpp | 164 +++++++ Source/WebCore/platform/haiku/CookieJarHaiku.cpp | 79 ++++ Source/WebCore/platform/haiku/CursorHaiku.cpp | 271 +++++++++++ Source/WebCore/platform/haiku/DragDataHaiku.cpp | 102 +++++ Source/WebCore/platform/haiku/DragImageHaiku.cpp | 74 +++ Source/WebCore/platform/haiku/EventLoopHaiku.cpp | 41 ++ Source/WebCore/platform/haiku/FileChooserHaiku.cpp | 38 ++ Source/WebCore/platform/haiku/FileSystemHaiku.cpp | 94 ++++ .../platform/haiku/LocalizedStringsHaiku.cpp | 497 +++++++++++++++++++++ Source/WebCore/platform/haiku/LoggingHaiku.cpp | 48 ++ .../platform/haiku/MIMETypeRegistryHaiku.cpp | 93 ++++ Source/WebCore/platform/haiku/PasteboardHaiku.cpp | 227 ++++++++++ .../platform/haiku/PlatformKeyboardEventHaiku.cpp | 390 ++++++++++++++++ .../platform/haiku/PlatformMouseEventHaiku.cpp | 80 ++++ .../platform/haiku/PlatformWheelEventHaiku.cpp | 63 +++ Source/WebCore/platform/haiku/PopupMenuHaiku.cpp | 192 ++++++++ Source/WebCore/platform/haiku/PopupMenuHaiku.h | 55 +++ Source/WebCore/platform/haiku/RenderThemeHaiku.cpp | 178 ++++++++ Source/WebCore/platform/haiku/RenderThemeHaiku.h | 70 +++ Source/WebCore/platform/haiku/ScreenHaiku.cpp | 86 ++++ .../WebCore/platform/haiku/ScrollbarThemeHaiku.cpp | 164 +++++++ .../WebCore/platform/haiku/ScrollbarThemeHaiku.h | 55 +++ .../platform/haiku/SearchPopupMenuHaiku.cpp | 57 +++ .../WebCore/platform/haiku/SearchPopupMenuHaiku.h | 44 ++ .../WebCore/platform/haiku/SharedBufferHaiku.cpp | 51 +++ Source/WebCore/platform/haiku/SharedTimerHaiku.cpp | 124 +++++ Source/WebCore/platform/haiku/SoundHaiku.cpp | 42 ++ .../WebCore/platform/haiku/TemporaryLinkStubs.cpp | 86 ++++ Source/WebCore/platform/haiku/WidgetHaiku.cpp | 132 ++++++ 32 files changed, 4010 insertions(+) create mode 100644 Source/WebCore/platform/haiku/ClipboardHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/ClipboardHaiku.h create mode 100644 Source/WebCore/platform/haiku/ContextMenuHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/ContextMenuItemHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/CookieJarHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/CursorHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/DragDataHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/DragImageHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/EventLoopHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/FileChooserHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/FileSystemHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/LoggingHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/MIMETypeRegistryHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PasteboardHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PlatformKeyboardEventHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PlatformMouseEventHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PlatformWheelEventHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PopupMenuHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/PopupMenuHaiku.h create mode 100644 Source/WebCore/platform/haiku/RenderThemeHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/RenderThemeHaiku.h create mode 100644 Source/WebCore/platform/haiku/ScreenHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/ScrollbarThemeHaiku.h create mode 100644 Source/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/SearchPopupMenuHaiku.h create mode 100644 Source/WebCore/platform/haiku/SharedBufferHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/SharedTimerHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/SoundHaiku.cpp create mode 100644 Source/WebCore/platform/haiku/TemporaryLinkStubs.cpp create mode 100644 Source/WebCore/platform/haiku/WidgetHaiku.cpp (limited to 'Source/WebCore/platform/haiku') 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 + * + * 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 +#include +#include +#include +#include +#include + + +namespace WebCore { + +PassRefPtr 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 ClipboardHaiku::types() const +{ + HashSet 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 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 + * + * 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 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 types() const; + virtual PassRefPtr 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 + * Copyright (C) 2007 Ryan Leavengood + * + * 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 +#include +#include +#include + + +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(menu) == m_platformDescription) + return; + + delete m_platformDescription; + m_platformDescription = static_cast(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 + * Copyright (C) 2007 Ryan Leavengood + * + * 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 +#include +#include +#include + + +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(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(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 + * Copyright (C) 2007 Ryan Leavengood + * + * 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 +#include + + +namespace WebCore { + +// FIXME: Shouldn't this be saved to and restored from disk too? +static HashMap 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& 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 + * Copyright (C) 2010 Stephan Aßmus + * + * 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 + * + * 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& 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 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 + * + * 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 + + +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 + * Copyright (C) 2007 Ryan Leavengood + * + * 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 + * Copyright (C) 2010 Stephan Aßmus + * + * 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 + +#include +#include +#include +#include +#include + + +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 listDirectory(const String& path, const String& filter) +{ + Vector 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 + * + * 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 + * + * 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 + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Trolltech ASA + * Copyright (C) 2010 Stephan Aßmus + * + * 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 +#include + +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 + * Copyright (C) 2007 Ryan Leavengood + * Copyright (C) 2010 Stephan Aßmus + * + * 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 +#include +#include +#include +#include + + +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(&buffer), &bufferLength) == B_OK) + string.Append(buffer, bufferLength); + + return string; +} + +PassRefPtr Pasteboard::documentFragment(Frame* frame, PassRefPtr 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(&buffer), &bufferLength) == B_OK) { + RefPtr decoder = TextResourceDecoder::create("text/plain", "UTF-8", true); + String html = decoder->decode(buffer, bufferLength); + html += decoder->flush(); + + if (!html.isEmpty()) { + RefPtr 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(&buffer), &bufferLength) == B_OK) { + BString plainText(buffer, bufferLength); + + chosePlainText = true; + RefPtr 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 + * Copyright (C) 2008 Andrea Anzani + * Copyright (C) 2010 Stephan Aßmus + * + * 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 +#include +#include +#include + + +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 + * Copyright (C) 2009 Maxime Simon + * Copyright (C) 2010 Stephan Aßmus + * + * 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 +#include + +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 + * Copyright (C) 2009 Maxime Simon + * Copyright (C) 2010 Stephan Aßmus + * + * 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 +#include +#include + + +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