diff options
Diffstat (limited to 'WebKit/haiku/WebCoreSupport')
-rw-r--r-- | WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp | 365 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h | 147 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp | 85 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.h | 53 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/DragClientHaiku.cpp | 74 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/DragClientHaiku.h | 46 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/EditorClientHaiku.cpp | 479 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/EditorClientHaiku.h | 124 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp | 826 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h | 248 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp | 124 | ||||
-rw-r--r-- | WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h | 73 |
12 files changed, 2644 insertions, 0 deletions
diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp new file mode 100644 index 0000000..8932da1 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * 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 "ChromeClientHaiku.h" + +#include "Frame.h" +#include "FrameLoadRequest.h" +#include "FrameView.h" +#include "HitTestResult.h" +#include "NotImplemented.h" +#include "PlatformString.h" + +#include <Alert.h> +#include <String.h> + + +namespace WebCore { + +ChromeClientHaiku::ChromeClientHaiku() +{ +} + +ChromeClientHaiku::~ChromeClientHaiku() +{ +} + +void ChromeClientHaiku::chromeDestroyed() +{ + notImplemented(); +} + +void ChromeClientHaiku::setWindowRect(const FloatRect&) +{ + notImplemented(); +} + +FloatRect ChromeClientHaiku::windowRect() +{ + notImplemented(); + return FloatRect(0, 0, 200, 200); +} + +FloatRect ChromeClientHaiku::pageRect() +{ + notImplemented(); + return FloatRect(0, 0, 200, 200); +} + +float ChromeClientHaiku::scaleFactor() +{ + notImplemented(); + return 1.0; +} + +void ChromeClientHaiku::focus() +{ + notImplemented(); +} + +void ChromeClientHaiku::unfocus() +{ + notImplemented(); +} + +bool ChromeClientHaiku::canTakeFocus(FocusDirection) +{ + notImplemented(); + return true; +} + +void ChromeClientHaiku::takeFocus(FocusDirection) +{ + notImplemented(); +} + +Page* ChromeClientHaiku::createWindow(Frame*, const FrameLoadRequest&, const WebCore::WindowFeatures&) +{ + notImplemented(); + return 0; +} + +Page* ChromeClientHaiku::createModalDialog(Frame*, const FrameLoadRequest&) +{ + notImplemented(); + return 0; +} + +void ChromeClientHaiku::show() +{ + notImplemented(); +} + +bool ChromeClientHaiku::canRunModal() +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::runModal() +{ + notImplemented(); +} + +void ChromeClientHaiku::setToolbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientHaiku::toolbarsVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::setStatusbarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientHaiku::statusbarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::setScrollbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientHaiku::scrollbarsVisible() +{ + notImplemented(); + return true; +} + +void ChromeClientHaiku::setMenubarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientHaiku::menubarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::setResizable(bool) +{ + notImplemented(); +} + +void ChromeClientHaiku::addMessageToConsole(const String& message, unsigned int lineNumber, + const String& sourceID) +{ + printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String()); +} + +void ChromeClientHaiku::addMessageToConsole(MessageSource, MessageLevel, const String& message, + unsigned int lineNumber, const String& sourceID) +{ + printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String()); +} + +void ChromeClientHaiku::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, + unsigned int lineNumber, const String& sourceID) +{ + printf("MESSAGE %s:%i %s\n", BString(sourceID).String(), lineNumber, BString(message).String()); +} + +bool ChromeClientHaiku::canRunBeforeUnloadConfirmPanel() +{ + notImplemented(); + return false; +} + +bool ChromeClientHaiku::runBeforeUnloadConfirmPanel(const String& message, Frame* frame) +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::closeWindowSoon() +{ + notImplemented(); +} + +void ChromeClientHaiku::runJavaScriptAlert(Frame*, const String& msg) +{ + BAlert* alert = new BAlert("JavaScript", BString(msg).String(), "OK"); + alert->Go(); +} + +bool ChromeClientHaiku::runJavaScriptConfirm(Frame*, const String& msg) +{ + BAlert* alert = new BAlert("JavaScript", BString(msg).String(), "Yes", "No"); + return !alert->Go(); +} + +bool ChromeClientHaiku::runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) +{ + notImplemented(); + return false; +} + +void ChromeClientHaiku::setStatusbarText(const String&) +{ + notImplemented(); +} + +bool ChromeClientHaiku::shouldInterruptJavaScript() +{ + notImplemented(); + return false; +} + +bool ChromeClientHaiku::tabsToLinks() const +{ + return false; +} + +IntRect ChromeClientHaiku::windowResizerRect() const +{ + return IntRect(); +} + +void ChromeClientHaiku::repaint(const IntRect&, bool contentChanged, bool immediate, bool repaintContentOnly) +{ + notImplemented(); +} + +void ChromeClientHaiku::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) +{ + notImplemented(); +} + +IntPoint ChromeClientHaiku::screenToWindow(const IntPoint&) const +{ + notImplemented(); + return IntPoint(); +} + +IntRect ChromeClientHaiku::windowToScreen(const IntRect&) const +{ + notImplemented(); + return IntRect(); +} + +PlatformWidget ChromeClientHaiku::platformWindow() const +{ + notImplemented(); + return PlatformWidget(); +} + +void ChromeClientHaiku::contentsSizeChanged(Frame*, const IntSize&) const +{ + notImplemented(); +} + +void ChromeClientHaiku::scrollRectIntoView(const IntRect&, const ScrollView*) const +{ + notImplemented(); +} + +void ChromeClientHaiku::addToDirtyRegion(const IntRect&) +{ +} + +void ChromeClientHaiku::scrollBackingStore(int, int, const IntRect&, const IntRect&) +{ +} + +void ChromeClientHaiku::updateBackingStore() +{ +} + +void ChromeClientHaiku::mouseDidMoveOverElement(const HitTestResult& hit, unsigned /*modifierFlags*/) +{ + // Some extra info + notImplemented(); +} + +void ChromeClientHaiku::setToolTip(const String& tip) +{ + notImplemented(); +} + +void ChromeClientHaiku::setToolTip(const String& tip, TextDirection) +{ + notImplemented(); +} + +void ChromeClientHaiku::print(Frame*) +{ + notImplemented(); +} + +void ChromeClientHaiku::exceededDatabaseQuota(Frame*, const String& databaseName) +{ + notImplemented(); +} + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded) +{ + notImplemented(); +} +#endif + +void ChromeClientHaiku::requestGeolocationPermissionForFrame(Frame*, Geolocation*) +{ + notImplemented(); +} + +void ChromeClientHaiku::runOpenPanel(Frame*, PassRefPtr<FileChooser>) +{ + notImplemented(); +} + +bool ChromeClientHaiku::setCursor(PlatformCursorHandle) +{ + notImplemented(); + return false; +} + +// Notification that the given form element has changed. This function +// will be called frequently, so handling should be very fast. +void ChromeClientHaiku::formStateDidChange(const Node*) +{ + notImplemented(); +} + +PassOwnPtr<HTMLParserQuirks> ChromeClientHaiku::createHTMLParserQuirks() +{ + notImplemented(); + return 0; +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h new file mode 100644 index 0000000..386c380 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@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. + */ + +#ifndef ChromeClientHaiku_h +#define ChromeClientHaiku_h + +#include "ChromeClient.h" +#include "FloatRect.h" +#include "RefCounted.h" + +namespace WebCore { + + class FloatRect; + class Page; + struct FrameLoadRequest; + + class ChromeClientHaiku : public ChromeClient { + public: + ChromeClientHaiku(); + virtual ~ChromeClientHaiku(); + void chromeDestroyed(); + + void setWindowRect(const FloatRect&); + FloatRect windowRect(); + + FloatRect pageRect(); + + float scaleFactor(); + + void focus(); + void unfocus(); + + bool canTakeFocus(FocusDirection); + void takeFocus(FocusDirection); + + Page* createWindow(Frame*, const FrameLoadRequest&, const WebCore::WindowFeatures&); + Page* createModalDialog(Frame*, const FrameLoadRequest&); + void show(); + + bool canRunModal(); + void runModal(); + + void setToolbarsVisible(bool); + bool toolbarsVisible(); + + void setStatusbarVisible(bool); + bool statusbarVisible(); + + void setScrollbarsVisible(bool); + bool scrollbarsVisible(); + + void setMenubarVisible(bool); + bool menubarVisible(); + + void setResizable(bool); + + void addMessageToConsole(const String& message, unsigned int lineNumber, + const String& sourceID); + void addMessageToConsole(MessageSource, MessageLevel, const String& message, + unsigned int lineNumber, const String& sourceID); + void addMessageToConsole(MessageSource, MessageType, MessageLevel, + const String&, unsigned int, const String&); + + bool canRunBeforeUnloadConfirmPanel(); + + bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame); + + void closeWindowSoon(); + + void runJavaScriptAlert(Frame*, const String&); + bool runJavaScriptConfirm(Frame*, const String&); + bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result); + bool shouldInterruptJavaScript(); + + void setStatusbarText(const WebCore::String&); + bool tabsToLinks() const; + IntRect windowResizerRect() const; + + void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); + void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); + IntPoint screenToWindow(const IntPoint&) const; + IntRect windowToScreen(const IntRect&) const; + PlatformWidget platformWindow() const; + void contentsSizeChanged(Frame*, const IntSize&) const; + void scrollRectIntoView(const IntRect&, const ScrollView*) const; + + void addToDirtyRegion(const IntRect&); + void scrollBackingStore(int, int, const IntRect&, const IntRect&); + void updateBackingStore(); + + void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); + + void setToolTip(const String&); + + virtual void setToolTip(const String&, TextDirection); + + void print(Frame*); + + void exceededDatabaseQuota(Frame*, const String& databaseName); + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); +#endif + + // This is an asynchronous call. The ChromeClient can display UI asking the user for permission + // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately. + void requestGeolocationPermissionForFrame(Frame*, Geolocation*); + + void runOpenPanel(Frame*, PassRefPtr<FileChooser>); + + bool setCursor(PlatformCursorHandle); + + // Notification that the given form element has changed. This function + // will be called frequently, so handling should be very fast. + void formStateDidChange(const Node*); + + PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks(); + }; + +} // namespace WebCore + +#endif + diff --git a/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp new file mode 100644 index 0000000..228adc7 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.cpp @@ -0,0 +1,85 @@ +/* + * 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 "ContextMenuClientHaiku.h" + +#include "ContextMenu.h" +#include "HitTestResult.h" +#include "KURL.h" + +#include "NotImplemented.h" + + +namespace WebCore { + +void ContextMenuClientHaiku::contextMenuDestroyed() +{ + notImplemented(); +} + +PlatformMenuDescription ContextMenuClientHaiku::getCustomMenuFromDefaultItems(ContextMenu* menu) +{ + return menu->platformDescription(); +} + +void ContextMenuClientHaiku::contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) +{ + notImplemented(); +} + +void ContextMenuClientHaiku::downloadURL(const KURL& url) +{ + notImplemented(); +} + +void ContextMenuClientHaiku::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +void ContextMenuClientHaiku::speak(const String&) +{ + notImplemented(); +} + +bool ContextMenuClientHaiku::isSpeaking() +{ + notImplemented(); + return false; +} + +void ContextMenuClientHaiku::stopSpeaking() +{ + notImplemented(); +} + +void ContextMenuClientHaiku::searchWithGoogle(const Frame*) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.h b/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.h new file mode 100644 index 0000000..756b3cf --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/ContextMenuClientHaiku.h @@ -0,0 +1,53 @@ +/* + * 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. + */ + +#ifndef ContextMenuClientHaiku_h +#define ContextMenuClientHaiku_h + +#include "ContextMenuClient.h" + + +namespace WebCore { + class ContextMenu; + + class ContextMenuClientHaiku : public ContextMenuClient { + public: + virtual void contextMenuDestroyed(); + + virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); + virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*); + + virtual void downloadURL(const KURL& url); + virtual void searchWithGoogle(const Frame*); + virtual void lookUpInDictionary(Frame*); + virtual void speak(const String&); + virtual bool isSpeaking(); + virtual void stopSpeaking(); + }; +} // namespace WebCore + +#endif // ContextMenuClientHaiku_h + diff --git a/WebKit/haiku/WebCoreSupport/DragClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/DragClientHaiku.cpp new file mode 100644 index 0000000..8964c69 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/DragClientHaiku.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 "DragClientHaiku.h" + +#include "NotImplemented.h" + + +namespace WebCore { + +DragDestinationAction DragClientHaiku::actionMaskForDrag(DragData*) +{ + notImplemented(); + return DragDestinationActionAny; +} + +void DragClientHaiku::willPerformDragDestinationAction(DragDestinationAction, DragData*) +{ + notImplemented(); +} + +void DragClientHaiku::dragControllerDestroyed() +{ + notImplemented(); +} + +DragSourceAction DragClientHaiku::dragSourceActionMaskForPoint(const IntPoint&) +{ + notImplemented(); + return DragSourceActionAny; +} + +void DragClientHaiku::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) +{ + notImplemented(); +} + +void DragClientHaiku::startDrag(DragImageRef dragImage, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) +{ + notImplemented(); +} + +DragImageRef DragClientHaiku::createDragImageForLink(KURL&, const String&, Frame*) +{ + notImplemented(); + return 0; +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/DragClientHaiku.h b/WebKit/haiku/WebCoreSupport/DragClientHaiku.h new file mode 100644 index 0000000..b184322 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/DragClientHaiku.h @@ -0,0 +1,46 @@ +/* + * 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 "DragClient.h" + + +namespace WebCore { + + class DragClientHaiku : public DragClient { + public: + virtual void willPerformDragDestinationAction(DragDestinationAction, + DragData*); + virtual WebCore::DragDestinationAction actionMaskForDrag(DragData*); + virtual void dragControllerDestroyed(); + virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&); + virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*); + virtual void startDrag(DragImageRef dragImage, const IntPoint& dragImageOrigin, + const IntPoint& eventPos, Clipboard*, Frame*, bool linkDrag = false); + virtual DragImageRef createDragImageForLink(KURL&, const String& label, Frame*); + }; + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/EditorClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/EditorClientHaiku.cpp new file mode 100644 index 0000000..a51e361 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/EditorClientHaiku.cpp @@ -0,0 +1,479 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * Copyright (C) 2007 Andrea Anzani <andrea.anzani@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 "EditorClientHaiku.h" + +#include "Document.h" +#include "Editor.h" +#include "FocusController.h" +#include "Frame.h" +#include "KeyboardCodes.h" +#include "KeyboardEvent.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" + +#include "NotImplemented.h" + + +namespace WebCore { + +EditorClientHaiku::EditorClientHaiku() + : m_editing(false) + , m_inUndoRedo(false) +{ +} + +void EditorClientHaiku::setPage(Page* page) +{ + m_page = page; +} + +void EditorClientHaiku::pageDestroyed() +{ + notImplemented(); +} + +bool EditorClientHaiku::shouldDeleteRange(Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldShowDeleteInterface(HTMLElement*) +{ + notImplemented(); + return false; +} + +bool EditorClientHaiku::smartInsertDeleteEnabled() +{ + notImplemented(); + return false; +} + +bool EditorClientHaiku::isSelectTrailingWhitespaceEnabled() +{ + notImplemented(); + return false; +} + +bool EditorClientHaiku::isContinuousSpellCheckingEnabled() +{ + notImplemented(); + return false; +} + +void EditorClientHaiku::toggleContinuousSpellChecking() +{ + notImplemented(); +} + +bool EditorClientHaiku::isGrammarCheckingEnabled() +{ + notImplemented(); + return false; +} + +void EditorClientHaiku::toggleGrammarChecking() +{ + notImplemented(); +} + +int EditorClientHaiku::spellCheckerDocumentTag() +{ + notImplemented(); + return 0; +} + +bool EditorClientHaiku::isEditable() +{ + // FIXME: should be controllable + return false; +} + +bool EditorClientHaiku::shouldBeginEditing(WebCore::Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldEndEditing(WebCore::Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldInsertNode(Node*, Range*, EditorInsertAction) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldInsertText(const String&, Range*, EditorInsertAction) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldChangeSelectedRange(Range* fromRange, Range* toRange, + EAffinity, bool stillSelecting) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldApplyStyle(WebCore::CSSStyleDeclaration*, + WebCore::Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientHaiku::shouldMoveRangeAfterDelete(Range*, Range*) +{ + notImplemented(); + return true; +} + +void EditorClientHaiku::didBeginEditing() +{ + notImplemented(); + m_editing = true; +} + +void EditorClientHaiku::respondToChangedContents() +{ + notImplemented(); +} + +void EditorClientHaiku::respondToChangedSelection() +{ + notImplemented(); +} + +void EditorClientHaiku::didEndEditing() +{ + notImplemented(); + m_editing = false; +} + +void EditorClientHaiku::didWriteSelectionToPasteboard() +{ + notImplemented(); +} + +void EditorClientHaiku::didSetSelectionTypesForPasteboard() +{ + notImplemented(); +} + +void EditorClientHaiku::registerCommandForUndo(WTF::PassRefPtr<WebCore::EditCommand> cmd) +{ + notImplemented(); +} + +void EditorClientHaiku::registerCommandForRedo(WTF::PassRefPtr<WebCore::EditCommand>) +{ + notImplemented(); +} + +void EditorClientHaiku::clearUndoRedoOperations() +{ + notImplemented(); +} + +bool EditorClientHaiku::canUndo() const +{ + notImplemented(); + return false; +} + +bool EditorClientHaiku::canRedo() const +{ + notImplemented(); + return false; +} + +void EditorClientHaiku::undo() +{ + notImplemented(); + m_inUndoRedo = true; + m_inUndoRedo = false; +} + +void EditorClientHaiku::redo() +{ + notImplemented(); + m_inUndoRedo = true; + m_inUndoRedo = false; +} + +void EditorClientHaiku::handleKeyboardEvent(KeyboardEvent* event) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->document()->focusedNode()) + return; + + const PlatformKeyboardEvent* kevent = event->keyEvent(); + if (!kevent || kevent->type() == PlatformKeyboardEvent::KeyUp) + return; + + Node* start = frame->selection()->start().node(); + if (!start) + return; + + if (start->isContentEditable()) { + switch(kevent->windowsVirtualKeyCode()) { + case VK_BACK: + frame->editor()->deleteWithDirection(SelectionController::BACKWARD, + kevent->ctrlKey() ? WordGranularity : CharacterGranularity, + false, true); + break; + case VK_DELETE: + frame->editor()->deleteWithDirection(SelectionController::FORWARD, + kevent->ctrlKey() ? WordGranularity : CharacterGranularity, + false, true); + break; + case VK_LEFT: + frame->selection()->modify(kevent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, + SelectionController::LEFT, + kevent->ctrlKey() ? WordGranularity : CharacterGranularity, + true); + break; + case VK_RIGHT: + frame->selection()->modify(kevent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, + SelectionController::RIGHT, + kevent->ctrlKey() ? WordGranularity : CharacterGranularity, + true); + break; + case VK_UP: + frame->selection()->modify(kevent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, + SelectionController::BACKWARD, + kevent->ctrlKey() ? ParagraphGranularity : LineGranularity, + true); + break; + case VK_DOWN: + frame->selection()->modify(kevent->shiftKey() ? SelectionController::EXTEND : SelectionController::MOVE, + SelectionController::FORWARD, + kevent->ctrlKey() ? ParagraphGranularity : LineGranularity, + true); + break; + case VK_PRIOR: // PageUp + frame->editor()->command("MoveUpByPageAndModifyCaret"); + break; + case VK_NEXT: // PageDown + frame->editor()->command("MoveDownByPageAndModifyCaret"); + break; + case VK_RETURN: + frame->editor()->command("InsertLineBreak"); + break; + case VK_TAB: + return; + default: + if (!kevent->ctrlKey() && !kevent->altKey() && !kevent->text().isEmpty()) { + if (kevent->text().length() == 1) { + UChar ch = kevent->text()[0]; + // Don't insert null or control characters as they can result in unexpected behaviour + if (ch < ' ') + break; + } + frame->editor()->insertText(kevent->text(), event); + } else if (kevent->ctrlKey()) { + switch (kevent->windowsVirtualKeyCode()) { + case VK_A: + frame->editor()->command("SelectAll"); + break; + case VK_B: + frame->editor()->command("ToggleBold"); + break; + case VK_C: + frame->editor()->command("Copy"); + break; + case VK_I: + frame->editor()->command("ToggleItalic"); + break; + case VK_V: + frame->editor()->command("Paste"); + break; + case VK_X: + frame->editor()->command("Cut"); + break; + case VK_Y: + frame->editor()->command("Redo"); + break; + case VK_Z: + frame->editor()->command("Undo"); + break; + default: + return; + } + } else return; + } + } else { + switch (kevent->windowsVirtualKeyCode()) { + case VK_UP: + frame->editor()->command("MoveUp"); + break; + case VK_DOWN: + frame->editor()->command("MoveDown"); + break; + case VK_PRIOR: // PageUp + frame->editor()->command("MoveUpByPageAndModifyCaret"); + break; + case VK_NEXT: // PageDown + frame->editor()->command("MoveDownByPageAndModifyCaret"); + break; + case VK_HOME: + if (kevent->ctrlKey()) + frame->editor()->command("MoveToBeginningOfDocument"); + break; + case VK_END: + if (kevent->ctrlKey()) + frame->editor()->command("MoveToEndOfDocument"); + break; + default: + if (kevent->ctrlKey()) { + switch(kevent->windowsVirtualKeyCode()) { + case VK_A: + frame->editor()->command("SelectAll"); + break; + case VK_C: case VK_X: + frame->editor()->command("Copy"); + break; + default: + return; + } + } else return; + } + } + event->setDefaultHandled(); +} + +void EditorClientHaiku::handleInputMethodKeydown(KeyboardEvent*) +{ + notImplemented(); +} + +void EditorClientHaiku::textFieldDidBeginEditing(Element*) +{ + m_editing = true; +} + +void EditorClientHaiku::textFieldDidEndEditing(Element*) +{ + m_editing = false; +} + +void EditorClientHaiku::textDidChangeInTextField(Element*) +{ + notImplemented(); +} + +bool EditorClientHaiku::doTextFieldCommandFromEvent(Element*, KeyboardEvent*) +{ + return false; +} + +void EditorClientHaiku::textWillBeDeletedInTextField(Element*) +{ + notImplemented(); +} + +void EditorClientHaiku::textDidChangeInTextArea(Element*) +{ + notImplemented(); +} + +void EditorClientHaiku::ignoreWordInSpellDocument(const String&) +{ + notImplemented(); +} + +void EditorClientHaiku::learnWord(const String&) +{ + notImplemented(); +} + +void EditorClientHaiku::checkSpellingOfString(const UChar*, int, int*, int*) +{ + notImplemented(); +} + +String EditorClientHaiku::getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord) +{ + notImplemented(); + return String(); +} + +void EditorClientHaiku::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*) +{ + notImplemented(); +} + +void EditorClientHaiku::updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) +{ + notImplemented(); +} + +void EditorClientHaiku::updateSpellingUIWithMisspelledWord(const String&) +{ + notImplemented(); +} + +void EditorClientHaiku::showSpellingUI(bool) +{ + notImplemented(); +} + +bool EditorClientHaiku::spellingUIIsShowing() +{ + notImplemented(); + return false; +} + +void EditorClientHaiku::getGuessesForWord(const String&, Vector<String>&) +{ + notImplemented(); +} + +void EditorClientHaiku::setInputMethodState(bool enabled) +{ + notImplemented(); +} + +bool EditorClientHaiku::isEditing() const +{ + return m_editing; +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/EditorClientHaiku.h b/WebKit/haiku/WebCoreSupport/EditorClientHaiku.h new file mode 100644 index 0000000..eda9597 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/EditorClientHaiku.h @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. + * 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. + */ + +#ifndef EditorClientHaiku_H +#define EditorClientHaiku_H + +#include "EditorClient.h" +#include "RefCounted.h" +#include "Page.h" + +#include <wtf/Forward.h> + + +namespace WebCore { + + class EditorClientHaiku : public EditorClient { + public: + EditorClientHaiku(); + void setPage( Page* page ); + + virtual void pageDestroyed(); + + virtual bool shouldDeleteRange(Range*); + virtual bool shouldShowDeleteInterface(HTMLElement*); + virtual bool smartInsertDeleteEnabled(); + virtual bool isSelectTrailingWhitespaceEnabled(); + virtual bool isContinuousSpellCheckingEnabled(); + virtual void toggleContinuousSpellChecking(); + virtual bool isGrammarCheckingEnabled(); + virtual void toggleGrammarChecking(); + virtual int spellCheckerDocumentTag(); + + virtual bool isEditable(); + + virtual bool shouldBeginEditing(Range*); + virtual bool shouldEndEditing(Range*); + virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction); + virtual bool shouldInsertText(const String&, Range*, EditorInsertAction); + virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, + EAffinity, bool stillSelecting); + + virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*); + virtual bool shouldMoveRangeAfterDelete(Range*, Range*); + + virtual void didBeginEditing(); + virtual void respondToChangedContents(); + virtual void respondToChangedSelection(); + virtual void didEndEditing(); + virtual void didWriteSelectionToPasteboard(); + virtual void didSetSelectionTypesForPasteboard(); + + virtual void registerCommandForUndo(PassRefPtr<EditCommand>); + virtual void registerCommandForRedo(PassRefPtr<EditCommand>); + virtual void clearUndoRedoOperations(); + + virtual bool canUndo() const; + virtual bool canRedo() const; + + virtual void undo(); + virtual void redo(); + + virtual void handleKeyboardEvent(KeyboardEvent*); + virtual void handleInputMethodKeydown(KeyboardEvent*); + + virtual void textFieldDidBeginEditing(Element*); + virtual void textFieldDidEndEditing(Element*); + virtual void textDidChangeInTextField(Element*); + virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); + virtual void textWillBeDeletedInTextField(Element*); + virtual void textDidChangeInTextArea(Element*); + + virtual void ignoreWordInSpellDocument(const String&); + virtual void learnWord(const String&); + virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, + int* misspellingLength); + virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord); + virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, + int* badGrammarLocation, int* badGrammarLength); + virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&); + virtual void updateSpellingUIWithMisspelledWord(const String&); + virtual void showSpellingUI(bool show); + virtual bool spellingUIIsShowing(); + virtual void getGuessesForWord(const String&, Vector<String>& guesses); + virtual void setInputMethodState(bool enabled); + + bool isEditing() const; + + private: + Page* m_page; + bool m_editing; + bool m_inUndoRedo; // our undo stack works differently - don't re-enter! + }; + +} // namespace WebCore + +#endif // EditorClientHaiku_h + diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp new file mode 100644 index 0000000..d2683c0 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.cpp @@ -0,0 +1,826 @@ +/* + * Copyright (C) 2006 Don Gibson <dgibson77@gmail.com> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Trolltech ASA + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> All rights reserved. + * 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 "FrameLoaderClientHaiku.h" + +#include "DocumentLoader.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameTree.h" +#include "FrameView.h" +#include "HTMLFrameOwnerElement.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformString.h" +#include "ResourceRequest.h" +#include "WebView.h" + +#include <Message.h> +#include <String.h> + +#include <app/Messenger.h> + + +namespace WebCore { + +FrameLoaderClientHaiku::FrameLoaderClientHaiku() + : m_frame(0) +{ +} + +void FrameLoaderClientHaiku::setFrame(Frame* frame) +{ + m_frame = frame; +} + +void FrameLoaderClientHaiku::setWebView(WebView* webview) +{ + m_webView = webview; + m_messenger = new BMessenger(m_webView); + ASSERT(m_messenger->IsValid()); +} + +void FrameLoaderClientHaiku::detachFrameLoader() +{ + m_frame = 0; +} + +bool FrameLoaderClientHaiku::hasWebView() const +{ + return m_webView; +} + +bool FrameLoaderClientHaiku::hasBackForwardList() const +{ + notImplemented(); + return true; +} + +void FrameLoaderClientHaiku::resetBackForwardList() +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::provisionalItemIsTarget() const +{ + notImplemented(); + return false; +} + +void FrameLoaderClientHaiku::makeRepresentation(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::forceLayout() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::forceLayoutForNonHTML() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryForCommit() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryForBackForwardNavigation() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryForReload() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryForStandardLoad() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryForInternalLoad() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateHistoryAfterClientRedirect() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::setCopiesOnScroll() +{ + // apparently mac specific + notImplemented(); +} + +LoadErrorResetToken* FrameLoaderClientHaiku::tokenForLoadErrorReset() +{ + notImplemented(); + return 0; +} + +void FrameLoaderClientHaiku::resetAfterLoadError(LoadErrorResetToken*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::doNotResetAfterLoadError(LoadErrorResetToken*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::willCloseDocument() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::detachedFromParent2() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::detachedFromParent3() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidHandleOnloadEvents() +{ + if (m_webView) { + BMessage message(LOAD_ONLOAD_HANDLE); + message.AddString("url", m_frame->loader()->documentLoader()->request().url().string()); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::dispatchDidReceiveServerRedirectForProvisionalLoad() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidCancelClientRedirect() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidChangeLocationWithinPage() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchWillClose() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidStartProvisionalLoad() +{ + if (m_webView) { + BMessage message(LOAD_NEGOCIATING); + message.AddString("url", m_frame->loader()->provisionalDocumentLoader()->request().url().string()); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::dispatchDidReceiveTitle(const String& title) +{ + if (m_webView) { + m_webView->SetPageTitle(title); + + BMessage message(TITLE_CHANGED); + message.AddString("title", title); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::dispatchDidCommitLoad() +{ + if (m_webView) { + BMessage message(LOAD_TRANSFERRING); + message.AddString("url", m_frame->loader()->documentLoader()->request().url().string()); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::dispatchDidFinishDocumentLoad() +{ + if (m_webView) { + BMessage message(LOAD_DOC_COMPLETED); + message.AddString("url", m_frame->loader()->url().string()); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::dispatchDidFinishLoad() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFirstLayout() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFirstVisuallyNonEmptyLayout() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchShow() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::cancelPolicyCheck() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>) +{ + // FIXME: Send an event to allow for alerts and cancellation. + if (!m_frame) + return; + (m_frame->loader()->*function)(PolicyUse); +} + +void FrameLoaderClientHaiku::dispatchDidLoadMainResource(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::revertToProvisionalState(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::postProgressStartedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::postProgressEstimateChangedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::postProgressFinishedNotification() +{ + if (m_webView) { + BMessage message(LOAD_DL_COMPLETED); + message.AddString("url", m_frame->loader()->url().string()); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::progressStarted() +{ + notImplemented(); +} + + +void FrameLoaderClientHaiku::progressCompleted() +{ + notImplemented(); +} + + +void FrameLoaderClientHaiku::setMainFrameDocumentReady(bool) +{ + notImplemented(); + // this is only interesting once we provide an external API for the DOM +} + +void FrameLoaderClientHaiku::willChangeTitle(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::didChangeTitle(DocumentLoader* docLoader) +{ + setTitle(docLoader->title(), docLoader->url()); +} + +void FrameLoaderClientHaiku::finishedLoading(DocumentLoader*) +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::canShowMIMEType(const String& MIMEType) const +{ + notImplemented(); + return true; +} + +bool FrameLoaderClientHaiku::representationExistsForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return false; +} + +String FrameLoaderClientHaiku::generatedMIMETypeForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return String(); +} + +void FrameLoaderClientHaiku::frameLoadCompleted() +{ + if (m_webView->LockLooper()) { + m_webView->Draw(m_webView->Bounds()); + m_webView->UnlockLooper(); + } +} + +void FrameLoaderClientHaiku::saveViewStateToItem(HistoryItem*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::restoreViewState() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::restoreScrollPositionAndViewState() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::provisionalLoadStarted() +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::shouldTreatURLAsSameAsCurrent(const KURL&) const +{ + notImplemented(); + return false; +} + +void FrameLoaderClientHaiku::addHistoryItemForFragmentScroll() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::didFinishLoad() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::prepareForDataSourceReplacement() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::setTitle(const String& title, const KURL&) +{ + notImplemented(); +} + +String FrameLoaderClientHaiku::userAgent(const KURL&) +{ + return String("Mozilla/5.0 (compatible; U; InfiNet 0.1; Haiku) AppleWebKit/420+ (KHTML, like Gecko)"); +} + +void FrameLoaderClientHaiku::dispatchDidReceiveIcon() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::frameLoaderDestroyed() +{ + m_frame = 0; + m_messenger = 0; + delete this; +} + +bool FrameLoaderClientHaiku::canHandleRequest(const WebCore::ResourceRequest&) const +{ + notImplemented(); + return true; +} + +void FrameLoaderClientHaiku::partClearedInBegin() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateGlobalHistory() +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::updateGlobalHistoryRedirectLinks() +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::shouldGoToHistoryItem(WebCore::HistoryItem*) const +{ + notImplemented(); + return true; +} + +void FrameLoaderClientHaiku::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*) +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::canCachePage() const +{ + return false; +} + +void FrameLoaderClientHaiku::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) +{ + if (!m_frame) + return; + + FrameLoader* frameLoader = loader->frameLoader(); + frameLoader->setEncoding(m_response.textEncodingName(), false); + frameLoader->addData(data, length); +} + +WebCore::ResourceError FrameLoaderClientHaiku::cancelledError(const WebCore::ResourceRequest& request) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); +} + +WebCore::ResourceError FrameLoaderClientHaiku::blockedError(const ResourceRequest& request) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); +} + +WebCore::ResourceError FrameLoaderClientHaiku::cannotShowURLError(const WebCore::ResourceRequest& request) +{ + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); +} + +WebCore::ResourceError FrameLoaderClientHaiku::interruptForPolicyChangeError(const WebCore::ResourceRequest& request) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String()); +} + +WebCore::ResourceError FrameLoaderClientHaiku::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String()); +} + +WebCore::ResourceError FrameLoaderClientHaiku::fileDoesNotExistError(const WebCore::ResourceResponse& response) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String()); +} + +bool FrameLoaderClientHaiku::shouldFallBack(const WebCore::ResourceError& error) +{ + notImplemented(); + return false; +} + +WTF::PassRefPtr<DocumentLoader> FrameLoaderClientHaiku::createDocumentLoader(const ResourceRequest& request, + const SubstituteData& substituteData) +{ + return DocumentLoader::create(request, substituteData); +} + +void FrameLoaderClientHaiku::download(ResourceHandle*, const ResourceRequest&, + const ResourceRequest&, const ResourceResponse&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, + const ResourceRequest&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request, + const ResourceResponse& response) +{ + notImplemented(); +} + +bool FrameLoaderClientHaiku::shouldUseCredentialStorage(DocumentLoader*, unsigned long) +{ + notImplemented(); + return false; +} + +void FrameLoaderClientHaiku::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, + unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, + unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id, + const ResourceResponse& response) +{ + notImplemented(); + m_response = response; + m_firstData = true; +} + +void FrameLoaderClientHaiku::dispatchDidReceiveContentLength(DocumentLoader* loader, + unsigned long id, int length) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFinishLoading(DocumentLoader*, unsigned long) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFailLoading(DocumentLoader* loader, + unsigned long, const ResourceError&) +{ + if (m_webView) { + BMessage message(LOAD_FAILED); + message.AddString("url", m_frame->loader()->documentLoader()->request().url().string()); + m_messenger->SendMessage(&message); + } +} + +bool FrameLoaderClientHaiku::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, + const ResourceRequest&, + const ResourceResponse&, int) +{ + notImplemented(); + return false; +} + +void FrameLoaderClientHaiku::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFailProvisionalLoad(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::dispatchDidFailLoad(const ResourceError&) +{ + notImplemented(); +} + +Frame* FrameLoaderClientHaiku::dispatchCreatePage() +{ + notImplemented(); + return false; +} + +void FrameLoaderClientHaiku::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, + const String& mimetype, + const ResourceRequest& request) +{ + if (!m_frame) + return; + + notImplemented(); + (m_frame->loader()->*function)(PolicyUse); +} + +void FrameLoaderClientHaiku::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, + const NavigationAction&, + const ResourceRequest& request, + PassRefPtr<FormState>, const String& targetName) +{ + if (!m_frame) + return; + + if (m_webView) { + BMessage message(NEW_WINDOW_REQUESTED); + message.AddString("url", request.url().string()); + if (m_messenger->SendMessage(&message)) { + (m_frame->loader()->*function)(PolicyIgnore); + return; + } + } + + (m_frame->loader()->*function)(PolicyUse); +} + +void FrameLoaderClientHaiku::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, + const NavigationAction& action, + const ResourceRequest& request, + PassRefPtr<FormState>) +{ + if (!m_frame || !function) + return; + + if (m_webView) { + BMessage message(NAVIGATION_REQUESTED); + message.AddString("url", request.url().string()); + m_messenger->SendMessage(&message); + + (m_frame->loader()->*function)(PolicyUse); + } +} + +void FrameLoaderClientHaiku::dispatchUnableToImplementPolicy(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::startDownload(const ResourceRequest&) +{ + notImplemented(); +} + +PassRefPtr<Frame> FrameLoaderClientHaiku::createFrame(const KURL& url, const String& name, + HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, + int marginWidth, int marginHeight) +{ + // FIXME: We should apply the right property to the frameView. (scrollbar,margins) + + RefPtr<Frame> childFrame = Frame::create(m_frame->page(), ownerElement, this); + setFrame(childFrame.get()); + + RefPtr<FrameView> frameView = FrameView::create(childFrame.get()); + + frameView->setAllowsScrolling(allowsScrolling); + frameView->deref(); + childFrame->setView(frameView.get()); + childFrame->init(); + + childFrame->tree()->setName(name); + m_frame->tree()->appendChild(childFrame); + + childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); + + // The frame's onload handler may have removed it from the document. + if (!childFrame->tree()->parent()) + return 0; + + return childFrame.release(); + + notImplemented(); + return 0; +} + +ObjectContentType FrameLoaderClientHaiku::objectContentType(const KURL& url, const String& mimeType) +{ + notImplemented(); + return ObjectContentType(); +} + +PassRefPtr<Widget> FrameLoaderClientHaiku::createPlugin(const IntSize&, HTMLPlugInElement*, + const KURL&, const Vector<String>&, + const Vector<String>&, const String&, + bool loadManually) +{ + notImplemented(); + return 0; +} + +void FrameLoaderClientHaiku::redirectDataToPlugin(Widget* pluginWidget) +{ + notImplemented(); + return; +} + +ResourceError FrameLoaderClientHaiku::pluginWillHandleLoadError(const ResourceResponse& response) +{ + notImplemented(); + return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String()); +} + +PassRefPtr<Widget> FrameLoaderClientHaiku::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, + const KURL& baseURL, + const Vector<String>& paramNames, + const Vector<String>& paramValues) +{ + notImplemented(); + return 0; +} + +String FrameLoaderClientHaiku::overrideMediaType() const +{ + notImplemented(); + return String(); +} + +void FrameLoaderClientHaiku::windowObjectCleared() +{ + if (m_webView) { + BMessage message(JAVASCRIPT_WINDOW_OBJECT_CLEARED); + m_messenger->SendMessage(&message); + } +} + +void FrameLoaderClientHaiku::documentElementAvailable() +{ +} + +void FrameLoaderClientHaiku::didPerformFirstNavigation() const +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::registerForIconNotification(bool listen) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::savePlatformDataToCachedFrame(CachedFrame*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::transitionToCommittedFromCachedFrame(CachedFrame*) +{ + notImplemented(); +} + +void FrameLoaderClientHaiku::transitionToCommittedForNewPage() +{ + ASSERT(m_frame); + ASSERT(m_webView); + + Page* page = m_frame->page(); + ASSERT(page); + + bool isMainFrame = m_frame == page->mainFrame(); + + m_frame->setView(0); + + RefPtr<FrameView> frameView; + if (isMainFrame) { + if (m_webView->LockLooper()) { + // We lock the looper in order to get the bounds of the WebView. + frameView = FrameView::create(m_frame, IntRect(m_webView->Bounds()).size()); + m_webView->UnlockLooper(); + } + } else + frameView = FrameView::create(m_frame); + + ASSERT(frameView); + m_frame->setView(frameView); + + frameView->setPlatformWidget(m_webView); + + if (HTMLFrameOwnerElement* owner = m_frame->ownerElement()) + m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode()); +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h new file mode 100644 index 0000000..33af321 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/FrameLoaderClientHaiku.h @@ -0,0 +1,248 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * 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. + */ + +#ifndef FrameLoaderClientHaiku_h +#define FrameLoaderClientHaiku_h + +#include "FrameLoader.h" +#include "FrameLoaderClient.h" +#include "KURL.h" +#include "ResourceResponse.h" + +class BMessenger; +class WebView; + +namespace WebCore { + class AuthenticationChallenge; + class DocumentLoader; + class Element; + class FormState; + class NavigationAction; + class ResourceLoader; + class String; + + struct LoadErrorResetToken; + + class FrameLoaderClientHaiku : public FrameLoaderClient { + public: + FrameLoaderClientHaiku(); + ~FrameLoaderClientHaiku() { } + void setFrame(Frame*); + void setWebView(WebView*); + virtual void detachFrameLoader(); + + virtual bool hasWebView() const; + + virtual bool hasBackForwardList() const; + virtual void resetBackForwardList(); + + virtual bool provisionalItemIsTarget() const; + + virtual void makeRepresentation(DocumentLoader*); + virtual void forceLayout(); + virtual void forceLayoutForNonHTML(); + + virtual void updateHistoryForCommit(); + + virtual void updateHistoryForBackForwardNavigation(); + virtual void updateHistoryForReload(); + virtual void updateHistoryForStandardLoad(); + virtual void updateHistoryForInternalLoad(); + + virtual void updateHistoryAfterClientRedirect(); + + virtual void setCopiesOnScroll(); + + virtual LoadErrorResetToken* tokenForLoadErrorReset(); + virtual void resetAfterLoadError(LoadErrorResetToken*); + virtual void doNotResetAfterLoadError(LoadErrorResetToken*); + + virtual void willCloseDocument(); + + virtual void detachedFromParent2(); + virtual void detachedFromParent3(); + + virtual void frameLoaderDestroyed(); + + virtual bool canHandleRequest(const ResourceRequest&) const; + + virtual void dispatchDidHandleOnloadEvents(); + virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); + virtual void dispatchDidCancelClientRedirect(); + virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, + double fireDate); + virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchWillClose(); + virtual void dispatchDidReceiveIcon(); + virtual void dispatchDidStartProvisionalLoad(); + virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidCommitLoad(); + virtual void dispatchDidFinishDocumentLoad(); + virtual void dispatchDidFinishLoad(); + virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + + virtual void dispatchShow(); + virtual void cancelPolicyCheck(); + + virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>); + + virtual void dispatchDidLoadMainResource(DocumentLoader*); + virtual void revertToProvisionalState(DocumentLoader*); + + virtual void postProgressStartedNotification(); + virtual void postProgressEstimateChangedNotification(); + virtual void postProgressFinishedNotification(); + + virtual void progressStarted(); + virtual void progressCompleted(); + virtual void setMainFrameDocumentReady(bool); + virtual void willChangeTitle(DocumentLoader*); + virtual void didChangeTitle(DocumentLoader*); + virtual void finishedLoading(DocumentLoader*); + + virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool representationExistsForURLScheme(const String& URLScheme) const; + virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; + + virtual void frameLoadCompleted(); + virtual void saveViewStateToItem(HistoryItem*); + virtual void restoreViewState(); + virtual void restoreScrollPositionAndViewState(); + virtual void provisionalLoadStarted(); + virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const; + virtual void addHistoryItemForFragmentScroll(); + virtual void didFinishLoad(); + virtual void prepareForDataSourceReplacement(); + virtual void setTitle(const String& title, const KURL&); + + virtual String userAgent(const KURL&); + + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedForNewPage(); + + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryRedirectLinks(); + virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); + virtual bool canCachePage() const; + + virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); + virtual void committedLoad(DocumentLoader*, const char*, int); + virtual ResourceError cancelledError(const ResourceRequest&); + virtual ResourceError blockedError(const ResourceRequest&); + virtual ResourceError cannotShowURLError(const ResourceRequest&); + virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&); + virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&); + virtual ResourceError fileDoesNotExistError(const ResourceResponse&); + virtual bool shouldFallBack(const ResourceError&); + virtual WTF::PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest&, + const SubstituteData&); + virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, + const ResourceResponse&); + + virtual void assignIdentifierToInitialRequest(unsigned long identifier, + DocumentLoader*, + const ResourceRequest&); + + virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, + const ResourceResponse&); + virtual bool shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier); + virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, + unsigned long identifier, + const AuthenticationChallenge&); + virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, + unsigned long identifier, + const AuthenticationChallenge&); + virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, + const ResourceResponse&); + virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int); + virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long); + virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, + const ResourceError&); + virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, + const ResourceRequest&, + const ResourceResponse&, int); + virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&); + + virtual void dispatchDidFailProvisionalLoad(const ResourceError&); + virtual void dispatchDidFailLoad(const ResourceError&); + virtual Frame* dispatchCreatePage(); + virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, + const String&, + const ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, + const NavigationAction&, + const ResourceRequest&, + PassRefPtr<FormState>, const String&); + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, + const NavigationAction&, + const ResourceRequest&, + PassRefPtr<FormState>); + virtual void dispatchUnableToImplementPolicy(const ResourceError&); + + virtual void startDownload(const ResourceRequest&); + + // FIXME: This should probably not be here, but it's needed for the tests currently. + virtual void partClearedInBegin(); + + virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, + HTMLFrameOwnerElement*, const String& referrer, + bool allowsScrolling, int marginWidth, int marginHeight); + virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, + const Vector<String>&, const Vector<String>&, const String&, + bool loadManually); + virtual void redirectDataToPlugin(Widget* pluginWidget); + virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&); + + virtual PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, + const KURL& baseURL, const Vector<String>& paramNames, + const Vector<String>& paramValues); + + virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); + virtual String overrideMediaType() const; + + virtual void windowObjectCleared(); + virtual void documentElementAvailable(); + + virtual void didPerformFirstNavigation() const; + + virtual void registerForIconNotification(bool listen = true); + + private: + Frame* m_frame; + WebView* m_webView; + BMessenger* m_messenger; + ResourceResponse m_response; + bool m_firstData; + }; +} // namespace WebCore + +#endif // FrameLoaderClientHaiku_h + diff --git a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp new file mode 100644 index 0000000..4064c51 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.cpp @@ -0,0 +1,124 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InspectorClientHaiku.h" + +#include "PlatformString.h" + +#include "NotImplemented.h" + + +namespace WebCore { + +void InspectorClientHaiku::inspectorDestroyed() +{ + notImplemented(); +} + +Page* InspectorClientHaiku::createPage() +{ + notImplemented(); + return 0; +} + +String InspectorClientHaiku::localizedStringsURL() +{ + notImplemented(); + return String(); +} + +String InspectorClientHaiku::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void InspectorClientHaiku::showWindow() +{ + notImplemented(); +} + +void InspectorClientHaiku::closeWindow() +{ + notImplemented(); +} + +void InspectorClientHaiku::attachWindow() +{ + notImplemented(); +} + +void InspectorClientHaiku::detachWindow() +{ + notImplemented(); +} + +void InspectorClientHaiku::setAttachedWindowHeight(unsigned height) +{ + notImplemented(); +} + +void InspectorClientHaiku::highlight(Node* node) +{ + notImplemented(); +} + +void InspectorClientHaiku::hideHighlight() +{ + notImplemented(); +} + +void InspectorClientHaiku::inspectedURLChanged(const String&) +{ + notImplemented(); +} + +void InspectorClientHaiku::inspectorWindowObjectCleared() +{ + notImplemented(); +} + +void InspectorClientHaiku::populateSetting(const String& key, InspectorController::Setting&) +{ + notImplemented(); +} + +void InspectorClientHaiku::storeSetting(const String& key, const InspectorController::Setting&) +{ + notImplemented(); +} + +void InspectorClientHaiku::removeSetting(const String& key) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h new file mode 100644 index 0000000..792ef40 --- /dev/null +++ b/WebKit/haiku/WebCoreSupport/InspectorClientHaiku.h @@ -0,0 +1,73 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InspectorClientHaiku_h +#define InspectorClientHaiku_h + +#include "InspectorClient.h" + + +namespace WebCore { + class Node; + class Page; + class String; + + class InspectorClientHaiku : public InspectorClient { + public: + virtual void inspectorDestroyed(); + + virtual Page* createPage(); + + virtual String localizedStringsURL(); + + virtual String hiddenPanels(); + + virtual void showWindow(); + virtual void closeWindow(); + + virtual void attachWindow(); + virtual void detachWindow(); + + virtual void setAttachedWindowHeight(unsigned height); + + virtual void highlight(Node*); + virtual void hideHighlight(); + + virtual void inspectedURLChanged(const String& newURL); + + virtual void populateSetting(const String& key, InspectorController::Setting&); + virtual void storeSetting(const String& key, const InspectorController::Setting&); + virtual void removeSetting(const String& key); + + virtual void inspectorWindowObjectCleared(); + }; +} // namespace WebCore + +#endif // InspectorClientHaiku_h + |