summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/wx/WebKitSupport
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit/wx/WebKitSupport')
-rw-r--r--Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp489
-rw-r--r--Source/WebKit/wx/WebKitSupport/ChromeClientWx.h160
-rw-r--r--Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp92
-rw-r--r--Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.h56
-rw-r--r--Source/WebKit/wx/WebKitSupport/DragClientWx.cpp77
-rw-r--r--Source/WebKit/wx/WebKitSupport/DragClientWx.h45
-rw-r--r--Source/WebKit/wx/WebKitSupport/EditCommandWx.h54
-rw-r--r--Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp566
-rw-r--r--Source/WebKit/wx/WebKitSupport/EditorClientWx.h123
-rw-r--r--Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp993
-rw-r--r--Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h245
-rw-r--r--Source/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h51
-rw-r--r--Source/WebKit/wx/WebKitSupport/InspectorClientWx.cpp81
-rw-r--r--Source/WebKit/wx/WebKitSupport/InspectorClientWx.h57
14 files changed, 3089 insertions, 0 deletions
diff --git a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
new file mode 100644
index 0000000..c89bb17
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
@@ -0,0 +1,489 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 "ChromeClientWx.h"
+#include "Console.h"
+#if ENABLE(DATABASE)
+#include "DatabaseTracker.h"
+#endif
+#include "FileChooser.h"
+#include "FloatRect.h"
+#include "Frame.h"
+#include "FrameLoadRequest.h"
+#include "Icon.h"
+#include "NavigationAction.h"
+#include "NotImplemented.h"
+#include "PlatformString.h"
+#include "SecurityOrigin.h"
+#include "PopupMenuWx.h"
+#include "SearchPopupMenuWx.h"
+#include "WindowFeatures.h"
+
+#include <stdio.h>
+
+#include <wx/wxprec.h>
+#ifndef WX_PRECOMP
+ #include <wx/wx.h>
+#endif
+#include <wx/textdlg.h>
+#include <wx/tooltip.h>
+
+#include "WebBrowserShell.h"
+#include "WebView.h"
+#include "WebViewPrivate.h"
+
+namespace WebCore {
+
+wxWebKitWindowFeatures wkFeaturesforWindowFeatures(const WindowFeatures& features)
+{
+ wxWebKitWindowFeatures wkFeatures;
+ wkFeatures.menuBarVisible = features.menuBarVisible;
+ wkFeatures.statusBarVisible = features.statusBarVisible;
+ wkFeatures.toolBarVisible = features.toolBarVisible;
+ wkFeatures.locationBarVisible = features.locationBarVisible;
+ wkFeatures.scrollbarsVisible = features.scrollbarsVisible;
+ wkFeatures.resizable = features.resizable;
+ wkFeatures.fullscreen = features.fullscreen;
+ wkFeatures.dialog = features.dialog;
+
+ return wkFeatures;
+}
+
+ChromeClientWx::ChromeClientWx(wxWebView* webView)
+{
+ m_webView = webView;
+}
+
+ChromeClientWx::~ChromeClientWx()
+{
+}
+
+void ChromeClientWx::chromeDestroyed()
+{
+ notImplemented();
+}
+
+void ChromeClientWx::setWindowRect(const FloatRect&)
+{
+ notImplemented();
+}
+
+FloatRect ChromeClientWx::windowRect()
+{
+ notImplemented();
+ return FloatRect();
+}
+
+FloatRect ChromeClientWx::pageRect()
+{
+ notImplemented();
+ return FloatRect();
+}
+
+float ChromeClientWx::scaleFactor()
+{
+ notImplemented();
+ return 1.0;
+}
+
+void ChromeClientWx::focus()
+{
+ notImplemented();
+}
+
+void ChromeClientWx::unfocus()
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::canTakeFocus(FocusDirection)
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::takeFocus(FocusDirection)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::focusedNodeChanged(Node*)
+{
+}
+
+void ChromeClientWx::focusedFrameChanged(Frame*)
+{
+}
+
+Page* ChromeClientWx::createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures& features, const NavigationAction&)
+{
+ Page* myPage = 0;
+ wxWebViewNewWindowEvent wkEvent(m_webView);
+
+ wxWebKitWindowFeatures wkFeatures = wkFeaturesforWindowFeatures(features);
+ wkEvent.SetWindowFeatures(wkFeatures);
+
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
+ if (wxWebView* webView = wkEvent.GetWebView()) {
+ WebViewPrivate* impl = webView->m_impl;
+ if (impl)
+ myPage = impl->page;
+ }
+ }
+
+ return myPage;
+}
+
+Page* ChromeClientWx::createModalDialog(Frame*, const FrameLoadRequest&)
+{
+ notImplemented();
+ return 0;
+}
+
+void ChromeClientWx::show()
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::canRunModal()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::runModal()
+{
+ notImplemented();
+}
+
+void ChromeClientWx::setToolbarsVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::toolbarsVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::setStatusbarVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::statusbarVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::setScrollbarsVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::scrollbarsVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::setMenubarVisible(bool)
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::menubarVisible()
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientWx::setResizable(bool)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::addMessageToConsole(MessageSource source,
+ MessageType type,
+ MessageLevel level,
+ const String& message,
+ unsigned int lineNumber,
+ const String& sourceID)
+{
+ if (m_webView) {
+ wxWebViewConsoleMessageEvent wkEvent(m_webView);
+ wkEvent.SetMessage(message);
+ wkEvent.SetLineNumber(lineNumber);
+ wkEvent.SetSourceID(sourceID);
+ wkEvent.SetLevel(static_cast<wxWebViewConsoleMessageLevel>(level));
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+bool ChromeClientWx::canRunBeforeUnloadConfirmPanel()
+{
+ notImplemented();
+ return true;
+}
+
+bool ChromeClientWx::runBeforeUnloadConfirmPanel(const String& string,
+ Frame* frame)
+{
+ wxMessageDialog dialog(NULL, string, wxT("Confirm Action?"), wxYES_NO);
+ return dialog.ShowModal() == wxYES;
+}
+
+void ChromeClientWx::closeWindowSoon()
+{
+ notImplemented();
+}
+
+/*
+ Sites for testing prompts:
+ Alert - just type in a bad web address or http://www.htmlite.com/JS002.php
+ Prompt - http://www.htmlite.com/JS007.php
+ Confirm - http://www.htmlite.com/JS006.php
+*/
+
+void ChromeClientWx::runJavaScriptAlert(Frame* frame, const String& string)
+{
+ if (m_webView) {
+ wxWebViewAlertEvent wkEvent(m_webView);
+ wkEvent.SetMessage(string);
+ if (!m_webView->GetEventHandler()->ProcessEvent(wkEvent))
+ wxMessageBox(string, wxT("JavaScript Alert"), wxOK);
+ }
+}
+
+bool ChromeClientWx::runJavaScriptConfirm(Frame* frame, const String& string)
+{
+ bool result = false;
+ if (m_webView) {
+ wxWebViewConfirmEvent wkEvent(m_webView);
+ wkEvent.SetMessage(string);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent))
+ result = wkEvent.GetReturnCode() == wxID_YES;
+ else {
+ wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO);
+ dialog.Centre();
+ result = (dialog.ShowModal() == wxID_YES);
+ }
+ }
+ return result;
+}
+
+bool ChromeClientWx::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
+{
+ if (m_webView) {
+ wxWebViewPromptEvent wkEvent(m_webView);
+ wkEvent.SetMessage(message);
+ wkEvent.SetResponse(defaultValue);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
+ result = wkEvent.GetResponse();
+ return true;
+ }
+ else {
+ wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL);
+ dialog.Centre();
+ if (dialog.ShowModal() == wxID_OK) {
+ result = dialog.GetValue();
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+void ChromeClientWx::setStatusbarText(const String&)
+{
+ notImplemented();
+}
+
+bool ChromeClientWx::shouldInterruptJavaScript()
+{
+ notImplemented();
+ return false;
+}
+
+bool ChromeClientWx::tabsToLinks() const
+{
+ notImplemented();
+ return false;
+}
+
+IntRect ChromeClientWx::windowResizerRect() const
+{
+ notImplemented();
+ return IntRect();
+}
+
+void ChromeClientWx::invalidateWindow(const IntRect& rect, bool immediate)
+{
+ if (immediate)
+ m_webView->Update();
+}
+
+void ChromeClientWx::invalidateContentsForSlowScroll(const IntRect& rect, bool immediate)
+{
+ invalidateContentsAndWindow(rect, immediate);
+}
+
+void ChromeClientWx::invalidateContentsAndWindow(const IntRect& rect, bool immediate)
+{
+ if (!m_webView)
+ return;
+
+ m_webView->RefreshRect(rect);
+
+ if (immediate) {
+ m_webView->Update();
+ }
+}
+
+IntRect ChromeClientWx::windowToScreen(const IntRect& rect) const
+{
+ notImplemented();
+ return rect;
+}
+
+IntPoint ChromeClientWx::screenToWindow(const IntPoint& point) const
+{
+ notImplemented();
+ return point;
+}
+
+PlatformPageClient ChromeClientWx::platformPageClient() const
+{
+ return m_webView;
+}
+
+void ChromeClientWx::contentsSizeChanged(Frame*, const IntSize&) const
+{
+ notImplemented();
+}
+
+void ChromeClientWx::scrollBackingStore(int dx, int dy,
+ const IntRect& scrollViewRect,
+ const IntRect& clipRect)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::updateBackingStore()
+{
+ notImplemented();
+}
+
+void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::setToolTip(const String& tip, TextDirection)
+{
+ wxToolTip* tooltip = m_webView->GetToolTip();
+ if (!tooltip || tooltip->GetTip() != wxString(tip))
+ m_webView->SetToolTip(tip);
+}
+
+void ChromeClientWx::print(Frame*)
+{
+ notImplemented();
+}
+
+#if ENABLE(DATABASE)
+void ChromeClientWx::exceededDatabaseQuota(Frame*, const String&)
+{
+ unsigned long long quota = 5 * 1024 * 1024;
+
+ if (wxWebFrame* webFrame = m_webView->GetMainFrame())
+ if (Frame* frame = webFrame->GetFrame())
+ if (Document* document = frame->document())
+ if (!DatabaseTracker::tracker().hasEntryForOrigin(document->securityOrigin()))
+ DatabaseTracker::tracker().setQuota(document->securityOrigin(), quota);
+}
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::reachedApplicationCacheOriginQuota(SecurityOrigin*)
+{
+ notImplemented();
+}
+#endif
+
+void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&)
+{
+ m_webView->Refresh();
+ notImplemented();
+}
+
+void ChromeClientWx::runOpenPanel(Frame*, PassRefPtr<FileChooser>)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::chooseIconForFiles(const Vector<String>& filenames, FileChooser* chooser)
+{
+ chooser->iconLoaded(Icon::createIconForFiles(filenames));
+}
+
+void ChromeClientWx::setCursor(const Cursor&)
+{
+ notImplemented();
+}
+
+void ChromeClientWx::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
+{
+ // See the comment in WebCore/page/ChromeClient.h
+ notImplemented();
+}
+
+bool ChromeClientWx::selectItemWritingDirectionIsNatural()
+{
+ return false;
+}
+
+PassRefPtr<PopupMenu> ChromeClientWx::createPopupMenu(PopupMenuClient* client) const
+{
+ return adoptRef(new PopupMenuWx(client));
+}
+
+PassRefPtr<SearchPopupMenu> ChromeClientWx::createSearchPopupMenu(PopupMenuClient* client) const
+{
+ return adoptRef(new SearchPopupMenuWx(client));
+}
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
new file mode 100644
index 0000000..2ccad43
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * 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 ChromeClientWx_H
+#define ChromeClientWx_H
+
+#include "ChromeClient.h"
+#include "FocusDirection.h"
+#include "IntRect.h"
+#include "WebView.h"
+
+namespace WebCore {
+
+class ChromeClientWx : public ChromeClient {
+public:
+ ChromeClientWx(wxWebView*);
+ virtual ~ChromeClientWx();
+ virtual void chromeDestroyed();
+
+ virtual void setWindowRect(const FloatRect&);
+ virtual FloatRect windowRect();
+
+ virtual FloatRect pageRect();
+
+ virtual float scaleFactor();
+
+ virtual void focus();
+ virtual void unfocus();
+
+ virtual bool canTakeFocus(FocusDirection);
+ virtual void takeFocus(FocusDirection);
+
+ virtual void focusedNodeChanged(Node*);
+ virtual void focusedFrameChanged(Frame*);
+
+ virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&);
+ virtual Page* createModalDialog(Frame*, const FrameLoadRequest&);
+ virtual void show();
+
+ virtual bool canRunModal();
+ virtual void runModal();
+
+ virtual void setToolbarsVisible(bool);
+ virtual bool toolbarsVisible();
+
+ virtual void setStatusbarVisible(bool);
+ virtual bool statusbarVisible();
+
+ virtual void setScrollbarsVisible(bool);
+ virtual bool scrollbarsVisible();
+
+ virtual void setMenubarVisible(bool);
+ virtual bool menubarVisible();
+
+ virtual void setResizable(bool);
+
+ virtual void addMessageToConsole(MessageSource source,
+ MessageType type,
+ MessageLevel level,
+ const String& message,
+ unsigned int lineNumber,
+ const String& sourceID);
+
+ virtual bool canRunBeforeUnloadConfirmPanel();
+ virtual bool runBeforeUnloadConfirmPanel(const String& message,
+ Frame* frame);
+
+ virtual void closeWindowSoon();
+
+ virtual void runJavaScriptAlert(Frame*, const String&);
+ virtual bool runJavaScriptConfirm(Frame*, const String&);
+ virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
+ virtual void setStatusbarText(const String&);
+ virtual bool shouldInterruptJavaScript();
+
+ virtual bool tabsToLinks() const;
+
+ virtual IntRect windowResizerRect() const;
+ virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
+ virtual void updateBackingStore();
+
+ virtual void invalidateWindow(const IntRect&, bool);
+ virtual void invalidateContentsAndWindow(const IntRect&, bool);
+ virtual void invalidateContentsForSlowScroll(const IntRect&, bool);
+ virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
+
+ virtual IntPoint screenToWindow(const IntPoint&) const;
+ virtual IntRect windowToScreen(const IntRect&) const;
+ virtual PlatformPageClient platformPageClient() const;
+ virtual void contentsSizeChanged(Frame*, const IntSize&) const;
+
+ virtual void scrollbarsModeDidChange() const { }
+ virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
+
+ virtual void setToolTip(const String&, TextDirection);
+
+ virtual void print(Frame*);
+
+#if ENABLE(DATABASE)
+ virtual void exceededDatabaseQuota(Frame*, const String&);
+#endif
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
+ virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*);
+#endif
+
+#if ENABLE(CONTEXT_MENUS)
+ virtual void showContextMenu() { }
+#endif
+
+ virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
+ virtual void chooseIconForFiles(const Vector<String>&, FileChooser*);
+
+ virtual void formStateDidChange(const Node*) { }
+
+ virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
+
+ virtual void setCursor(const Cursor&);
+
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
+
+ virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+ virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*) { }
+
+ virtual bool selectItemWritingDirectionIsNatural();
+ virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
+ virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
+
+private:
+ wxWebView* m_webView;
+};
+
+}
+#endif // ChromeClientWx_H
diff --git a/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp b/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
new file mode 100644
index 0000000..4b73b61
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 "ContextMenuClientWx.h"
+#include "NotImplemented.h"
+#include "ContextMenu.h"
+#include <stdio.h>
+
+namespace WebCore {
+
+ContextMenuClientWx::~ContextMenuClientWx()
+{
+}
+
+void ContextMenuClientWx::contextMenuDestroyed()
+{
+ delete this;
+}
+
+PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu* menu)
+{
+ return menu->releasePlatformDescription();
+}
+
+void ContextMenuClientWx::contextMenuItemSelected(ContextMenuItem*,
+ const ContextMenu*)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::downloadURL(const KURL&)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::copyImageToClipboard(const HitTestResult&)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::searchWithGoogle(const Frame*)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::lookUpInDictionary(Frame*)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::speak(const String&)
+{
+ notImplemented();
+}
+
+void ContextMenuClientWx::stopSpeaking()
+{
+ notImplemented();
+}
+
+bool ContextMenuClientWx::isSpeaking()
+{
+ notImplemented();
+ return false;
+}
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.h b/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.h
new file mode 100644
index 0000000..0030c1d
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/ContextMenuClientWx.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 ContextMenuClientWx_h
+#define ContextMenuClientWx_h
+
+#include "ContextMenuClient.h"
+#include "PlatformMenuDescription.h"
+
+namespace WebCore {
+
+class ContextMenuClientWx : public ContextMenuClient {
+public:
+ virtual ~ContextMenuClientWx();
+ virtual void contextMenuDestroyed();
+
+ virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*);
+ virtual void contextMenuItemSelected(ContextMenuItem*,
+ const ContextMenu*);
+
+ virtual void downloadURL(const KURL&);
+ virtual void copyImageToClipboard(const HitTestResult&);
+ virtual void searchWithGoogle(const Frame*);
+ virtual void lookUpInDictionary(Frame*);
+ virtual void speak(const String&);
+ virtual void stopSpeaking();
+ virtual bool isSpeaking();
+};
+
+}
+
+#endif // ContextMenuClientWx_h
diff --git a/Source/WebKit/wx/WebKitSupport/DragClientWx.cpp b/Source/WebKit/wx/WebKitSupport/DragClientWx.cpp
new file mode 100644
index 0000000..fb6905b
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/DragClientWx.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "DragClientWx.h"
+
+#include "NotImplemented.h"
+
+#include <stdio.h>
+
+namespace WebCore {
+
+DragDestinationAction DragClientWx::actionMaskForDrag(DragData*)
+{
+ notImplemented();
+ return DragDestinationActionAny;
+}
+
+void DragClientWx::willPerformDragDestinationAction(DragDestinationAction,
+ DragData*)
+{
+ notImplemented();
+}
+
+void DragClientWx::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*)
+{
+ notImplemented();
+}
+
+void DragClientWx::dragControllerDestroyed()
+{
+ notImplemented();
+}
+
+DragSourceAction DragClientWx::dragSourceActionMaskForPoint(const IntPoint&)
+{
+ notImplemented();
+ return DragSourceActionAny;
+}
+
+void DragClientWx::startDrag(DragImageRef dragImage,
+ const IntPoint& dragImageOrigin,
+ const IntPoint& eventPos, Clipboard*,
+ Frame*, bool linkDrag)
+{
+ notImplemented();
+}
+
+DragImageRef DragClientWx::createDragImageForLink(KURL&, const String& label, Frame*)
+{
+ notImplemented();
+ return 0;
+}
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/DragClientWx.h b/Source/WebKit/wx/WebKitSupport/DragClientWx.h
new file mode 100644
index 0000000..afb54fb
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/DragClientWx.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "DragClient.h"
+#include "DragData.h"
+
+namespace WebCore {
+
+class DragClientWx : public WebCore::DragClient {
+public:
+ virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction,
+ WebCore::DragData*);
+ virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
+
+ virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*);
+ virtual void dragControllerDestroyed();
+ virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
+
+ virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false);
+ virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WTF::String& label, WebCore::Frame*);
+};
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/EditCommandWx.h b/Source/WebKit/wx/WebKitSupport/EditCommandWx.h
new file mode 100644
index 0000000..e5deedd
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/EditCommandWx.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2008 Kevin Ollivier. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WXEDITCOMMAND_H
+#define WXEDITCOMMAND_H
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+ class EditCommand;
+}
+
+class EditCommandWx
+{
+public:
+ EditCommandWx(WTF::PassRefPtr<WebCore::EditCommand> command)
+ {
+ m_editCommand = command;
+ }
+
+ ~EditCommandWx() {}
+ WTF::PassRefPtr<WebCore::EditCommand> editCommand() { return m_editCommand; }
+
+private:
+ WTF::RefPtr<WebCore::EditCommand> m_editCommand;
+};
+
+#endif
diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp
new file mode 100644
index 0000000..5601364
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.cpp
@@ -0,0 +1,566 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 "EditorClientWx.h"
+
+#include "EditCommand.h"
+#include "Editor.h"
+#include "FocusController.h"
+#include "Frame.h"
+#include "FrameView.h"
+#include "HostWindow.h"
+#include "KeyboardEvent.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#include "PlatformKeyboardEvent.h"
+#include "PlatformString.h"
+#include "SelectionController.h"
+#include "WebFrame.h"
+#include "WebFramePrivate.h"
+#include "WebView.h"
+#include "WebViewPrivate.h"
+#include "WindowsKeyboardCodes.h"
+
+#include <stdio.h>
+
+namespace WebCore {
+
+static const unsigned CtrlKey = 1 << 0;
+static const unsigned AltKey = 1 << 1;
+static const unsigned ShiftKey = 1 << 2;
+
+struct KeyDownEntry {
+ unsigned virtualKey;
+ unsigned modifiers;
+ const char* name;
+};
+
+struct KeyPressEntry {
+ unsigned charCode;
+ unsigned modifiers;
+ const char* name;
+};
+
+static const KeyDownEntry keyDownEntries[] = {
+ { VK_LEFT, 0, "MoveLeft" },
+ { VK_LEFT, ShiftKey, "MoveLeftAndModifySelection" },
+ { VK_LEFT, CtrlKey, "MoveWordLeft" },
+ { VK_LEFT, CtrlKey | ShiftKey, "MoveWordLeftAndModifySelection" },
+ { VK_RIGHT, 0, "MoveRight" },
+ { VK_RIGHT, ShiftKey, "MoveRightAndModifySelection" },
+ { VK_RIGHT, CtrlKey, "MoveWordRight" },
+ { VK_RIGHT, CtrlKey | ShiftKey, "MoveWordRightAndModifySelection" },
+ { VK_UP, 0, "MoveUp" },
+ { VK_UP, ShiftKey, "MoveUpAndModifySelection" },
+ { VK_PRIOR, ShiftKey, "MovePageUpAndModifySelection" },
+ { VK_DOWN, 0, "MoveDown" },
+ { VK_DOWN, ShiftKey, "MoveDownAndModifySelection" },
+ { VK_NEXT, ShiftKey, "MovePageDownAndModifySelection" },
+ { VK_PRIOR, 0, "MovePageUp" },
+ { VK_NEXT, 0, "MovePageDown" },
+ { VK_HOME, 0, "MoveToBeginningOfLine" },
+ { VK_HOME, ShiftKey, "MoveToBeginningOfLineAndModifySelection" },
+ { VK_HOME, CtrlKey, "MoveToBeginningOfDocument" },
+ { VK_HOME, CtrlKey | ShiftKey, "MoveToBeginningOfDocumentAndModifySelection" },
+
+ { VK_END, 0, "MoveToEndOfLine" },
+ { VK_END, ShiftKey, "MoveToEndOfLineAndModifySelection" },
+ { VK_END, CtrlKey, "MoveToEndOfDocument" },
+ { VK_END, CtrlKey | ShiftKey, "MoveToEndOfDocumentAndModifySelection" },
+
+ { VK_BACK, 0, "DeleteBackward" },
+ { VK_BACK, ShiftKey, "DeleteBackward" },
+ { VK_DELETE, 0, "DeleteForward" },
+ { VK_BACK, CtrlKey, "DeleteWordBackward" },
+ { VK_DELETE, CtrlKey, "DeleteWordForward" },
+
+ { 'B', CtrlKey, "ToggleBold" },
+ { 'I', CtrlKey, "ToggleItalic" },
+
+ { VK_ESCAPE, 0, "Cancel" },
+ //FIXME: this'll never happen. We can trash it or make it a normal period
+ { VK_OEM_PERIOD, CtrlKey, "Cancel" },
+ { VK_TAB, 0, "InsertTab" },
+ { VK_TAB, ShiftKey, "InsertBacktab" },
+ { VK_RETURN, 0, "InsertNewline" },
+ { VK_RETURN, CtrlKey, "InsertNewline" },
+ { VK_RETURN, AltKey, "InsertNewline" },
+ { VK_RETURN, ShiftKey, "InsertLineBreak" },
+ { 'A', CtrlKey, "SelectAll" },
+ { 'Z', CtrlKey, "Undo" },
+ { 'Z', CtrlKey | ShiftKey, "Redo" },
+};
+
+static const KeyPressEntry keyPressEntries[] = {
+ { '\t', 0, "InsertTab" },
+ { '\t', ShiftKey, "InsertBacktab" },
+ { '\r', 0, "InsertNewline" },
+ { '\r', CtrlKey, "InsertNewline" },
+ { '\r', AltKey, "InsertNewline" },
+ { '\r', AltKey | ShiftKey, "InsertNewline" },
+};
+
+EditorClientWx::~EditorClientWx()
+{
+ m_page = NULL;
+}
+
+void EditorClientWx::setPage(Page* page)
+{
+ m_page = page;
+}
+
+void EditorClientWx::pageDestroyed()
+{
+ delete this;
+}
+
+bool EditorClientWx::shouldDeleteRange(Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldShowDeleteInterface(HTMLElement*)
+{
+ notImplemented();
+ return false;
+}
+
+bool EditorClientWx::smartInsertDeleteEnabled()
+{
+ notImplemented();
+ return false;
+}
+
+bool EditorClientWx::isSelectTrailingWhitespaceEnabled()
+{
+ notImplemented();
+ return false;
+}
+
+bool EditorClientWx::isContinuousSpellCheckingEnabled()
+{
+ notImplemented();
+ return false;
+}
+
+void EditorClientWx::toggleContinuousSpellChecking()
+{
+ notImplemented();
+}
+
+bool EditorClientWx::isGrammarCheckingEnabled()
+{
+ notImplemented();
+ return false;
+}
+
+void EditorClientWx::toggleGrammarChecking()
+{
+ notImplemented();
+}
+
+int EditorClientWx::spellCheckerDocumentTag()
+{
+ notImplemented();
+ return 0;
+}
+
+bool EditorClientWx::selectWordBeforeMenuEvent()
+{
+ notImplemented();
+ return false;
+}
+
+bool EditorClientWx::isEditable()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin)
+ return webKitWin->IsEditable();
+ }
+ return false;
+}
+
+bool EditorClientWx::shouldBeginEditing(Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldEndEditing(Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldInsertNode(Node*, Range*,
+ EditorInsertAction)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldInsertText(const String&, Range*,
+ EditorInsertAction)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldApplyStyle(CSSStyleDeclaration*,
+ Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldMoveRangeAfterDelete(Range*, Range*)
+{
+ notImplemented();
+ return true;
+}
+
+bool EditorClientWx::shouldChangeSelectedRange(Range* fromRange, Range* toRange,
+ EAffinity, bool stillSelecting)
+{
+ notImplemented();
+ return true;
+}
+
+void EditorClientWx::didBeginEditing()
+{
+ notImplemented();
+}
+
+void EditorClientWx::respondToChangedContents()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ wxWebViewContentsChangedEvent wkEvent(webKitWin);
+ webKitWin->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+ }
+}
+
+void EditorClientWx::didEndEditing()
+{
+ notImplemented();
+}
+
+void EditorClientWx::didWriteSelectionToPasteboard()
+{
+ notImplemented();
+}
+
+void EditorClientWx::didSetSelectionTypesForPasteboard()
+{
+ notImplemented();
+}
+
+void EditorClientWx::registerCommandForUndo(PassRefPtr<EditCommand> command)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ webKitWin->m_impl->undoStack.append(EditCommandWx(command));
+ }
+ }
+}
+
+void EditorClientWx::registerCommandForRedo(PassRefPtr<EditCommand> command)
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ webKitWin->m_impl->redoStack.insert(0, EditCommandWx(command));
+ }
+ }
+}
+
+void EditorClientWx::clearUndoRedoOperations()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ webKitWin->m_impl->redoStack.clear();
+ webKitWin->m_impl->undoStack.clear();
+ }
+ }
+}
+
+bool EditorClientWx::canUndo() const
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ return webKitWin->m_impl->undoStack.size() != 0;
+ }
+ }
+ return false;
+}
+
+bool EditorClientWx::canRedo() const
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin && webKitWin) {
+ return webKitWin->m_impl->redoStack.size() != 0;
+ }
+ }
+ return false;
+}
+
+void EditorClientWx::undo()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ webKitWin->m_impl->undoStack.last().editCommand()->unapply();
+ webKitWin->m_impl->undoStack.removeLast();
+ }
+ }
+}
+
+void EditorClientWx::redo()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ webKitWin->m_impl->redoStack.last().editCommand()->reapply();
+ webKitWin->m_impl->redoStack.removeLast();
+ }
+ }
+}
+
+bool EditorClientWx::handleEditingKeyboardEvent(KeyboardEvent* event)
+{
+ Node* node = event->target()->toNode();
+ ASSERT(node);
+ Frame* frame = node->document()->frame();
+ ASSERT(frame);
+
+ const PlatformKeyboardEvent* keyEvent = event->keyEvent();
+
+ //NB: this is what windows does, but they also have a keypress event for Alt+Enter which clearly won't get hit with this
+ if (!keyEvent || keyEvent->altKey()) // do not treat this as text input if Alt is down
+ return false;
+
+ Editor::Command command = frame->editor()->command(interpretKeyEvent(event));
+
+ if (keyEvent->type() == PlatformKeyboardEvent::RawKeyDown) {
+ // WebKit doesn't have enough information about mode to decide how commands that just insert text if executed via Editor should be treated,
+ // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or if not to let a CHAR event be generated
+ // (e.g. Tab that inserts a Tab character, or Enter).
+ return !command.isTextInsertion() && command.execute(event);
+ }
+
+ if (command.execute(event))
+ return true;
+
+ // Don't insert null or control characters as they can result in unexpected behaviour
+ if (event->charCode() < ' ')
+ return false;
+
+ return frame->editor()->insertText(event->keyEvent()->text(), event);
+}
+
+const char* EditorClientWx::interpretKeyEvent(const KeyboardEvent* evt)
+{
+ ASSERT(evt->keyEvent()->type() == PlatformKeyboardEvent::RawKeyDown || evt->keyEvent()->type() == PlatformKeyboardEvent::Char);
+
+ static HashMap<int, const char*>* keyDownCommandsMap = 0;
+ static HashMap<int, const char*>* keyPressCommandsMap = 0;
+
+ if (!keyDownCommandsMap) {
+ keyDownCommandsMap = new HashMap<int, const char*>;
+ keyPressCommandsMap = new HashMap<int, const char*>;
+
+ for (unsigned i = 0; i < WXSIZEOF(keyDownEntries); i++)
+ keyDownCommandsMap->set(keyDownEntries[i].modifiers << 16 | keyDownEntries[i].virtualKey, keyDownEntries[i].name);
+
+ for (unsigned i = 0; i < WXSIZEOF(keyPressEntries); i++)
+ keyPressCommandsMap->set(keyPressEntries[i].modifiers << 16 | keyPressEntries[i].charCode, keyPressEntries[i].name);
+ }
+
+ unsigned modifiers = 0;
+ if (evt->shiftKey())
+ modifiers |= ShiftKey;
+ if (evt->altKey())
+ modifiers |= AltKey;
+ if (evt->ctrlKey())
+ modifiers |= CtrlKey;
+
+ if (evt->keyEvent()->type() == PlatformKeyboardEvent::RawKeyDown) {
+ int mapKey = modifiers << 16 | evt->keyCode();
+ return mapKey ? keyDownCommandsMap->get(mapKey) : 0;
+ }
+
+ int mapKey = modifiers << 16 | evt->charCode();
+ return mapKey ? keyPressCommandsMap->get(mapKey) : 0;
+}
+
+
+void EditorClientWx::handleInputMethodKeydown(KeyboardEvent* event)
+{
+// NOTE: we don't currently need to handle this. When key events occur,
+// both this method and handleKeyboardEvent get a chance at handling them.
+// We might use this method later on for IME-specific handling.
+}
+
+void EditorClientWx::handleKeyboardEvent(KeyboardEvent* event)
+{
+ if (handleEditingKeyboardEvent(event))
+ event->setDefaultHandled();
+}
+
+void EditorClientWx::textFieldDidBeginEditing(Element*)
+{
+ notImplemented();
+}
+
+void EditorClientWx::textFieldDidEndEditing(Element*)
+{
+ notImplemented();
+}
+
+void EditorClientWx::textDidChangeInTextField(Element*)
+{
+ notImplemented();
+}
+
+bool EditorClientWx::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
+{
+ notImplemented();
+ return false;
+}
+
+void EditorClientWx::textWillBeDeletedInTextField(Element*)
+{
+ notImplemented();
+}
+
+void EditorClientWx::textDidChangeInTextArea(Element*)
+{
+ notImplemented();
+}
+
+void EditorClientWx::respondToChangedSelection()
+{
+ Frame* frame = m_page->focusController()->focusedOrMainFrame();
+ if (frame) {
+ wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient());
+ if (webKitWin) {
+ wxWebViewSelectionChangedEvent wkEvent(webKitWin);
+ webKitWin->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+ }
+}
+
+void EditorClientWx::ignoreWordInSpellDocument(const String&)
+{
+ notImplemented();
+}
+
+void EditorClientWx::learnWord(const String&)
+{
+ notImplemented();
+}
+
+void EditorClientWx::checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength)
+{
+ notImplemented();
+}
+
+void EditorClientWx::checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength)
+{
+ notImplemented();
+}
+
+void EditorClientWx::updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail)
+{
+ notImplemented();
+}
+
+void EditorClientWx::updateSpellingUIWithMisspelledWord(const String&)
+{
+ notImplemented();
+}
+
+void EditorClientWx::showSpellingUI(bool show)
+{
+ notImplemented();
+}
+
+bool EditorClientWx::spellingUIIsShowing()
+{
+ notImplemented();
+ return false;
+}
+
+void EditorClientWx::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses)
+{
+ notImplemented();
+}
+
+String EditorClientWx::getAutoCorrectSuggestionForMisspelledWord(const WTF::String&)
+{
+ notImplemented();
+ return String();
+}
+
+void EditorClientWx::willSetInputMethodState()
+{
+ notImplemented();
+}
+
+void EditorClientWx::setInputMethodState(bool enabled)
+{
+ notImplemented();
+}
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/EditorClientWx.h b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h
new file mode 100644
index 0000000..7dbee31
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/EditorClientWx.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 EditorClientWx_h
+#define EditorClientWx_h
+
+#include "EditorClient.h"
+#include "Page.h"
+
+#include "WebView.h"
+#include "WebFrame.h"
+
+namespace WebCore {
+
+class EditorClientWx : public EditorClient {
+friend class ::wxWebView;
+friend class ::wxWebFrame;
+
+public:
+ virtual ~EditorClientWx();
+ void setPage(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 selectWordBeforeMenuEvent();
+ 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 shouldApplyStyle(CSSStyleDeclaration*,
+ Range*);
+ virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
+ virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange,
+ EAffinity, bool stillSelecting);
+
+ 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 const char* interpretKeyEvent(const KeyboardEvent*);
+ virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
+ 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 void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
+ virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail);
+ virtual void updateSpellingUIWithMisspelledWord(const String&);
+ virtual void showSpellingUI(bool show);
+ virtual bool spellingUIIsShowing();
+ virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
+ virtual String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&);
+
+ virtual void willSetInputMethodState();
+ virtual void setInputMethodState(bool enabled);
+ virtual void requestCheckingOfString(WebCore::SpellChecker*, int, const WTF::String&) {}
+
+private:
+ Page* m_page;
+};
+
+}
+
+#endif // EditorClientWx_h
diff --git a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
new file mode 100644
index 0000000..362c726
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
@@ -0,0 +1,993 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 "FrameLoaderClientWx.h"
+
+#include <JavaScriptCore/JavaScript.h>
+#include <JavaScriptCore/APICast.h>
+
+#include "DocumentLoader.h"
+#include "FormState.h"
+#include "Frame.h"
+#include "FrameLoaderTypes.h"
+#include "FrameView.h"
+#include "FrameTree.h"
+#include "PluginView.h"
+#include "HTMLFormElement.h"
+#include "HTMLFrameOwnerElement.h"
+#include "NotImplemented.h"
+#include "Page.h"
+#include "PlatformString.h"
+#include "PluginView.h"
+#include "ProgressTracker.h"
+#include "RenderPart.h"
+#include "ResourceError.h"
+#include "ResourceResponse.h"
+#include "ScriptController.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+#include <stdio.h>
+
+#include "FrameNetworkingContextWx.h"
+#include "WebFrame.h"
+#include "WebFramePrivate.h"
+#include "WebView.h"
+#include "WebViewPrivate.h"
+
+namespace WebCore {
+
+inline int wxNavTypeFromWebNavType(NavigationType type){
+ if (type == NavigationTypeLinkClicked)
+ return wxWEBVIEW_NAV_LINK_CLICKED;
+
+ if (type == NavigationTypeFormSubmitted)
+ return wxWEBVIEW_NAV_FORM_SUBMITTED;
+
+ if (type == NavigationTypeBackForward)
+ return wxWEBVIEW_NAV_BACK_NEXT;
+
+ if (type == NavigationTypeReload)
+ return wxWEBVIEW_NAV_RELOAD;
+
+ if (type == NavigationTypeFormResubmitted)
+ return wxWEBVIEW_NAV_FORM_RESUBMITTED;
+
+ return wxWEBVIEW_NAV_OTHER;
+}
+
+FrameLoaderClientWx::FrameLoaderClientWx()
+ : m_frame(0)
+ , m_pluginView(0)
+ , m_hasSentResponseToPlugin(false)
+ , m_webFrame(0)
+{
+}
+
+
+FrameLoaderClientWx::~FrameLoaderClientWx()
+{
+}
+
+void FrameLoaderClientWx::setFrame(wxWebFrame *frame)
+{
+ m_webFrame = frame;
+ m_frame = m_webFrame->m_impl->frame;
+}
+
+void FrameLoaderClientWx::setWebView(wxWebView *webview)
+{
+ m_webView = webview;
+}
+
+bool FrameLoaderClientWx::hasWebView() const
+{
+ return m_webView != NULL;
+}
+
+bool FrameLoaderClientWx::hasBackForwardList() const
+{
+ notImplemented();
+ return true;
+}
+
+
+void FrameLoaderClientWx::resetBackForwardList()
+{
+ notImplemented();
+}
+
+
+bool FrameLoaderClientWx::provisionalItemIsTarget() const
+{
+ notImplemented();
+ return false;
+}
+
+void FrameLoaderClientWx::makeRepresentation(DocumentLoader*)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::forceLayout()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::forceLayoutForNonHTML()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryForCommit()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryForBackForwardNavigation()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryForReload()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryForStandardLoad()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryForInternalLoad()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::updateHistoryAfterClientRedirect()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::setCopiesOnScroll()
+{
+ // apparently mac specific
+ notImplemented();
+}
+
+
+LoadErrorResetToken* FrameLoaderClientWx::tokenForLoadErrorReset()
+{
+ notImplemented();
+ return 0;
+}
+
+
+void FrameLoaderClientWx::resetAfterLoadError(LoadErrorResetToken*)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::doNotResetAfterLoadError(LoadErrorResetToken*)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::willCloseDocument()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::detachedFromParent2()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::detachedFromParent3()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidHandleOnloadEvents()
+{
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_ONLOAD_HANDLED);
+ wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+
+void FrameLoaderClientWx::dispatchDidReceiveServerRedirectForProvisionalLoad()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchDidCancelClientRedirect()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchWillPerformClientRedirect(const KURL&,
+ double interval,
+ double fireDate)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchDidChangeLocationWithinPage()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidPushStateWithinPage()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidReplaceStateWithinPage()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidPopStateWithinPage()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchWillClose()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchDidStartProvisionalLoad()
+{
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_NEGOTIATING);
+ wkEvent.SetURL(m_frame->loader()->provisionalDocumentLoader()->request().url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+
+void FrameLoaderClientWx::dispatchDidReceiveTitle(const String& title)
+{
+ if (m_webView) {
+ m_webView->SetPageTitle(title);
+ wxWebViewReceivedTitleEvent wkEvent(m_webView);
+ wkEvent.SetTitle(title);
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+
+void FrameLoaderClientWx::dispatchDidCommitLoad()
+{
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_TRANSFERRING);
+ wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+void FrameLoaderClientWx::dispatchDidFinishDocumentLoad()
+{
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_DOC_COMPLETED);
+ wkEvent.SetURL(m_frame->loader()->url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+void FrameLoaderClientWx::dispatchDidChangeIcons()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidFinishLoad()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchDidFirstLayout()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchShow()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::cancelPolicyCheck()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::dispatchWillSubmitForm(FramePolicyFunction function,
+ PassRefPtr<FormState>)
+{
+ // FIXME: Send an event to allow for alerts and cancellation
+ if (!m_webFrame)
+ return;
+ (m_frame->loader()->policyChecker()->*function)(PolicyUse);
+}
+
+
+void FrameLoaderClientWx::dispatchDidLoadMainResource(DocumentLoader*)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::revertToProvisionalState(DocumentLoader*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::postProgressStartedNotification()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::postProgressEstimateChangedNotification()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::postProgressFinishedNotification()
+{
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_DL_COMPLETED);
+ wkEvent.SetURL(m_frame->loader()->url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+void FrameLoaderClientWx::progressStarted()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::progressCompleted()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::setMainFrameDocumentReady(bool b)
+{
+ notImplemented();
+ // this is only interesting once we provide an external API for the DOM
+}
+
+
+void FrameLoaderClientWx::willChangeTitle(DocumentLoader*)
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::didChangeTitle(DocumentLoader *l)
+{
+ setTitle(l->title(), l->url());
+}
+
+
+void FrameLoaderClientWx::finishedLoading(DocumentLoader* loader)
+{
+ if (!m_pluginView) {
+ if (m_firstData) {
+ FrameLoader* fl = loader->frameLoader();
+ fl->writer()->setEncoding(m_response.textEncodingName(), false);
+ m_firstData = false;
+ }
+ } else {
+ m_pluginView->didFinishLoading();
+ m_pluginView = 0;
+ m_hasSentResponseToPlugin = false;
+ }
+}
+
+bool FrameLoaderClientWx::canShowMIMETypeAsHTML(const String& MIMEType) const
+{
+ notImplemented();
+ return true;
+}
+
+
+bool FrameLoaderClientWx::canShowMIMEType(const String& MIMEType) const
+{
+ notImplemented();
+ return true;
+}
+
+
+bool FrameLoaderClientWx::representationExistsForURLScheme(const String& URLScheme) const
+{
+ notImplemented();
+ return false;
+}
+
+
+String FrameLoaderClientWx::generatedMIMETypeForURLScheme(const String& URLScheme) const
+{
+ notImplemented();
+ return String();
+}
+
+
+void FrameLoaderClientWx::frameLoadCompleted()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::saveViewStateToItem(HistoryItem*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::restoreViewState()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::restoreScrollPositionAndViewState()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::provisionalLoadStarted()
+{
+ notImplemented();
+}
+
+
+bool FrameLoaderClientWx::shouldTreatURLAsSameAsCurrent(const KURL&) const
+{
+ notImplemented();
+ return false;
+}
+
+
+void FrameLoaderClientWx::addHistoryItemForFragmentScroll()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::didFinishLoad()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::prepareForDataSourceReplacement()
+{
+ notImplemented();
+}
+
+
+void FrameLoaderClientWx::setTitle(const String& title, const KURL&)
+{
+ notImplemented();
+}
+
+
+String FrameLoaderClientWx::userAgent(const KURL&)
+{
+ // FIXME: Use the new APIs introduced by the GTK port to fill in these values.
+ return String("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3");
+}
+
+void FrameLoaderClientWx::dispatchDidReceiveIcon()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::frameLoaderDestroyed()
+{
+ if (m_webFrame)
+ delete m_webFrame;
+ m_webFrame = 0;
+ m_frame = 0;
+ delete this;
+}
+
+bool FrameLoaderClientWx::canHandleRequest(const WebCore::ResourceRequest&) const
+{
+ notImplemented();
+ return true;
+}
+
+void FrameLoaderClientWx::partClearedInBegin()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::updateGlobalHistory()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::updateGlobalHistoryRedirectLinks()
+{
+ notImplemented();
+}
+
+bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const
+{
+ notImplemented();
+ return true;
+}
+
+void FrameLoaderClientWx::dispatchDidAddBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientWx::dispatchDidRemoveBackForwardItem(WebCore::HistoryItem*) const
+{
+}
+
+void FrameLoaderClientWx::dispatchDidChangeBackForwardIndex() const
+{
+}
+
+void FrameLoaderClientWx::didDisplayInsecureContent()
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::didRunInsecureContent(WebCore::SecurityOrigin*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*)
+{
+ notImplemented();
+}
+
+bool FrameLoaderClientWx::canCachePage() const
+{
+ return false;
+}
+
+void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader* loader, const WebCore::ResourceError&)
+{
+ if (m_firstData) {
+ loader->frameLoader()->writer()->setEncoding(m_response.textEncodingName(), false);
+ m_firstData = false;
+ }
+}
+
+// FIXME: This function should be moved into WebCore.
+void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length)
+{
+ if (!m_webFrame)
+ return;
+ if (!m_pluginView)
+ loader->commitData(data, length);
+
+ // We re-check here as the plugin can have been created
+ if (m_pluginView) {
+ if (!m_hasSentResponseToPlugin) {
+ m_pluginView->didReceiveResponse(loader->response());
+ // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in
+ // setting up this stream can cause the main document load to be cancelled, setting m_pluginView
+ // to null
+ if (!m_pluginView)
+ return;
+ m_hasSentResponseToPlugin = true;
+ }
+ m_pluginView->didReceiveData(data, length);
+ }
+}
+
+WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest& request)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
+}
+
+WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest& request)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
+}
+
+WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest& request)
+{
+ return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String());
+}
+
+WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest& request)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String());
+}
+
+WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse& response)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String());
+}
+
+WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse& response)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String());
+}
+
+bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error)
+{
+ notImplemented();
+ return false;
+}
+
+WTF::PassRefPtr<DocumentLoader> FrameLoaderClientWx::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData)
+{
+ return DocumentLoader::create(request, substituteData);
+}
+
+void FrameLoaderClientWx::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request, const ResourceResponse& response)
+{
+ notImplemented();
+}
+
+bool FrameLoaderClientWx::shouldUseCredentialStorage(DocumentLoader*, unsigned long)
+{
+ notImplemented();
+ return false;
+}
+
+void FrameLoaderClientWx::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id, const ResourceResponse& response)
+{
+ notImplemented();
+ m_response = response;
+ m_firstData = true;
+}
+
+void FrameLoaderClientWx::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long id, int length)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned long)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader* loader, unsigned long, const ResourceError&)
+{
+ if (m_firstData) {
+ FrameLoader* fl = loader->frameLoader();
+ fl->writer()->setEncoding(m_response.textEncodingName(), false);
+ m_firstData = false;
+ }
+ if (m_webView) {
+ wxWebViewLoadEvent wkEvent(m_webView);
+ wkEvent.SetState(wxWEBVIEW_LOAD_FAILED);
+ wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string());
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int)
+{
+ notImplemented();
+ return false;
+}
+
+void FrameLoaderClientWx::dispatchDidFailProvisionalLoad(const ResourceError&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::dispatchDidFailLoad(const ResourceError&)
+{
+ notImplemented();
+}
+
+Frame* FrameLoaderClientWx::dispatchCreatePage(const NavigationAction&)
+{
+ notImplemented();
+ return false;
+}
+
+void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request)
+{
+ if (!m_webFrame)
+ return;
+
+ notImplemented();
+ (m_frame->loader()->policyChecker()->*function)(PolicyUse);
+}
+
+void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName)
+{
+ if (!m_webFrame)
+ return;
+
+ if (m_webView) {
+ wxWebViewNewWindowEvent wkEvent(m_webView);
+ wkEvent.SetURL(request.url().string());
+ wkEvent.SetTargetName(targetName);
+ if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) {
+ // if the app handles and doesn't skip the event,
+ // from WebKit's perspective treat it as blocked / ignored
+ (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
+ return;
+ }
+ }
+
+ (m_frame->loader()->policyChecker()->*function)(PolicyUse);
+}
+
+void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>)
+{
+ if (!m_webFrame)
+ return;
+
+ if (m_webView) {
+ wxWebViewBeforeLoadEvent wkEvent(m_webView);
+ wkEvent.SetNavigationType(wxNavTypeFromWebNavType(action.type()));
+ wkEvent.SetURL(request.url().string());
+
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ if (wkEvent.IsCancelled())
+ (m_frame->loader()->policyChecker()->*function)(PolicyIgnore);
+ else
+ (m_frame->loader()->policyChecker()->*function)(PolicyUse);
+
+ }
+}
+
+void FrameLoaderClientWx::dispatchUnableToImplementPolicy(const ResourceError&)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::startDownload(const ResourceRequest&)
+{
+ notImplemented();
+}
+
+PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight)
+{
+ WebViewFrameData* data = new WebViewFrameData();
+ data->name = name;
+ data->ownerElement = ownerElement;
+ data->url = url;
+ data->referrer = referrer;
+ data->allowsScrolling = allowsScrolling;
+ data->marginWidth = marginWidth;
+ data->marginHeight = marginHeight;
+
+ wxWebFrame* newFrame = new wxWebFrame(m_webView, m_webFrame, data);
+
+ RefPtr<Frame> childFrame = adoptRef(newFrame->m_impl->frame);
+
+ // The creation of the frame may have run arbitrary JavaScript that removed it from the page already.
+ if (!childFrame->page())
+ return 0;
+
+ 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();
+}
+
+void FrameLoaderClientWx::didTransferChildFrameToNewDocument(Page*)
+{
+}
+
+void FrameLoaderClientWx::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*)
+{
+}
+
+ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const String& mimeType)
+{
+ notImplemented();
+ return ObjectContentType();
+}
+
+PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize& size, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
+{
+#if __WXMSW__ || __WXMAC__
+ RefPtr<PluginView> pv = PluginView::create(m_frame, size, element, url, paramNames, paramValues, mimeType, loadManually);
+ if (pv->status() == PluginStatusLoadedSuccessfully)
+ return pv;
+#endif
+ return 0;
+}
+
+void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget)
+{
+ ASSERT(!m_pluginView);
+ m_pluginView = static_cast<PluginView*>(pluginWidget);
+ m_hasSentResponseToPlugin = false;
+}
+
+ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse& response)
+{
+ notImplemented();
+ return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String());
+}
+
+PassRefPtr<Widget> FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
+ const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ notImplemented();
+ return 0;
+}
+
+String FrameLoaderClientWx::overrideMediaType() const
+{
+ notImplemented();
+ return String();
+}
+
+void FrameLoaderClientWx::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld* world)
+{
+ if (world != mainThreadNormalWorld())
+ return;
+
+ if (m_webView) {
+ wxWebViewWindowObjectClearedEvent wkEvent(m_webView);
+ Frame* coreFrame = m_webView->GetMainFrame()->GetFrame();
+ JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject(mainThreadNormalWorld())->globalExec());
+ JSObjectRef windowObject = toRef(coreFrame->script()->globalObject(mainThreadNormalWorld()));
+ wkEvent.SetJSContext(context);
+ wkEvent.SetWindowObject(windowObject);
+ m_webView->GetEventHandler()->ProcessEvent(wkEvent);
+ }
+}
+
+void FrameLoaderClientWx::documentElementAvailable()
+{
+}
+
+void FrameLoaderClientWx::didPerformFirstNavigation() const
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::registerForIconNotification(bool listen)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::savePlatformDataToCachedFrame(CachedFrame*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::transitionToCommittedFromCachedFrame(CachedFrame*)
+{
+ notImplemented();
+}
+
+void FrameLoaderClientWx::transitionToCommittedForNewPage()
+{
+ ASSERT(m_webFrame);
+ ASSERT(m_frame);
+ ASSERT(m_webView);
+
+ IntSize size = IntRect(m_webView->GetRect()).size();
+ // FIXME: This value should be gotten from m_webView->IsTransparent();
+ // but transitionToCommittedForNewPage() can be called while m_webView is
+ // still being initialized.
+ bool transparent = false;
+ Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white;
+
+ if (m_frame)
+ m_frame->createView(size, backgroundColor, transparent, IntSize(), false);
+}
+
+void FrameLoaderClientWx::didSaveToPageCache()
+{
+}
+
+void FrameLoaderClientWx::didRestoreFromPageCache()
+{
+}
+
+void FrameLoaderClientWx::dispatchDidBecomeFrameset(bool)
+{
+}
+
+bool FrameLoaderClientWx::shouldUsePluginDocument(const String &mimeType) const
+{
+ // NOTE: Plugin Documents are used for viewing PDFs, etc. inline, and should
+ // not be used for pages with plugins in them.
+ return false;
+}
+
+PassRefPtr<FrameNetworkingContext> FrameLoaderClientWx::createNetworkingContext()
+{
+ return FrameNetworkingContextWx::create(m_frame);
+}
+
+}
diff --git a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
new file mode 100644
index 0000000..b56a900
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h
@@ -0,0 +1,245 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.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 FrameLoaderClientWx_H
+#define FrameLoaderClientWx_H
+
+#include "FrameLoaderClient.h"
+#include "FrameLoader.h"
+#include "KURL.h"
+#include "PluginView.h"
+#include "ResourceResponse.h"
+#include "HTMLPlugInElement.h"
+#include <wtf/Forward.h>
+
+class wxWebFrame;
+class wxWebView;
+
+namespace WebCore {
+
+ class AuthenticationChallenge;
+ class DocumentLoader;
+ class Element;
+ class FormState;
+ class NavigationAction;
+ class ResourceLoader;
+
+ struct LoadErrorResetToken;
+
+ class FrameLoaderClientWx : public FrameLoaderClient {
+ public:
+ FrameLoaderClientWx();
+ ~FrameLoaderClientWx();
+ void setFrame(wxWebFrame *frame);
+ void setWebView(wxWebView *webview);
+
+ virtual bool hasWebView() const; // mainly for assertions
+
+ 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 dispatchDidPushStateWithinPage();
+ virtual void dispatchDidReplaceStateWithinPage();
+ virtual void dispatchDidPopStateWithinPage();
+ 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 dispatchDidChangeIcons();
+
+ virtual void dispatchShow();
+ virtual void cancelPolicyCheck();
+
+ virtual void dispatchWillSendSubmitEvent(HTMLFormElement*) { }
+ 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 canShowMIMETypeAsHTML(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 didSaveToPageCache();
+ virtual void didRestoreFromPageCache();
+
+ virtual void dispatchDidBecomeFrameset(bool);
+
+ virtual void updateGlobalHistory();
+ virtual void updateGlobalHistoryRedirectLinks();
+ virtual bool shouldGoToHistoryItem(HistoryItem*) const;
+ virtual void dispatchDidAddBackForwardItem(HistoryItem*) const;
+ virtual void dispatchDidRemoveBackForwardItem(HistoryItem*) const;
+ virtual void dispatchDidChangeBackForwardIndex() const;
+ virtual void saveScrollPositionAndViewStateToItem(HistoryItem*);
+ virtual bool canCachePage() const;
+
+ virtual void didDisplayInsecureContent();
+ virtual void didRunInsecureContent(SecurityOrigin*);
+
+ 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 dispatchDidFailProvisionalLoad(const ResourceError&);
+ virtual void dispatchDidFailLoad(const ResourceError&);
+ virtual Frame* dispatchCreatePage(const WebCore::NavigationAction&);
+ virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String&, const ResourceRequest&);
+ virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&);
+ virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, 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* ownerElement,
+ const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight);
+ virtual void didTransferChildFrameToNewDocument(Page*);
+ virtual void transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*);
+ 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 dispatchDidClearWindowObjectInWorld(DOMWrapperWorld*);
+ virtual void documentElementAvailable();
+
+ virtual void didPerformFirstNavigation() const;
+
+ virtual void registerForIconNotification(bool listen = true);
+
+ virtual bool shouldUsePluginDocument(const String &mimeType) const;
+
+ virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext();
+
+ private:
+ wxWebFrame *m_webFrame;
+ Frame* m_frame;
+ wxWebView *m_webView;
+ PluginView* m_pluginView;
+ bool m_hasSentResponseToPlugin;
+ ResourceResponse m_response;
+ bool m_firstData;
+ };
+
+}
+
+#endif
diff --git a/Source/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h b/Source/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h
new file mode 100644
index 0000000..3aa2374
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/FrameNetworkingContextWx.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Kevin Ollivier <kevino@theolliviers.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 FrameNetworkingContextWx_h
+#define FrameNetworkingContextWx_h
+
+#include "FrameNetworkingContext.h"
+
+namespace WebCore {
+
+class FrameNetworkingContextWx : public WebCore::FrameNetworkingContext {
+public:
+ static PassRefPtr<FrameNetworkingContextWx> create(WebCore::Frame* frame)
+ {
+ return adoptRef(new FrameNetworkingContextWx(frame));
+ }
+
+ WebCore::Frame* coreFrame() const { return frame(); }
+
+private:
+ FrameNetworkingContextWx(WebCore::Frame* frame)
+ : WebCore::FrameNetworkingContext(frame)
+ {
+ }
+};
+
+}
+
+#endif
diff --git a/Source/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/Source/WebKit/wx/WebKitSupport/InspectorClientWx.cpp
new file mode 100644
index 0000000..c949d77
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/InspectorClientWx.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2007 Kevin Ollivier 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 "InspectorClientWx.h"
+
+#include "NotImplemented.h"
+#include "Page.h"
+#include "PlatformString.h"
+
+namespace WebCore {
+
+InspectorClientWx::InspectorClientWx()
+{
+ notImplemented();
+}
+
+InspectorClientWx::~InspectorClientWx()
+{
+ notImplemented();
+}
+
+void InspectorClientWx::inspectorDestroyed()
+{
+ notImplemented();
+}
+
+void InspectorClientWx::openInspectorFrontend(WebCore::InspectorController*)
+{
+ notImplemented();
+}
+
+void InspectorClientWx::highlight(Node*)
+{
+ notImplemented();
+}
+
+void InspectorClientWx::hideHighlight()
+{
+ notImplemented();
+}
+
+void InspectorClientWx::populateSetting(const String& key, String* setting)
+{
+ notImplemented();
+}
+
+void InspectorClientWx::storeSetting(const String& key, const String& setting)
+{
+ notImplemented();
+}
+
+bool InspectorClientWx::sendMessageToFrontend(const String&)
+{
+ notImplemented();
+ return false;
+}
+
+};
diff --git a/Source/WebKit/wx/WebKitSupport/InspectorClientWx.h b/Source/WebKit/wx/WebKitSupport/InspectorClientWx.h
new file mode 100644
index 0000000..799e954
--- /dev/null
+++ b/Source/WebKit/wx/WebKitSupport/InspectorClientWx.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) Kevin Ollivier 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 InspectorClientWx_h
+#define InspectorClientWx_h
+
+#include "InspectorClient.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class Node;
+class Page;
+
+class InspectorClientWx : public InspectorClient {
+public:
+ InspectorClientWx();
+ ~InspectorClientWx();
+
+ virtual void inspectorDestroyed();
+
+ virtual void openInspectorFrontend(WebCore::InspectorController*);
+
+ virtual void highlight(Node*);
+ virtual void hideHighlight();
+
+ virtual void populateSetting(const String& key, String* value);
+ virtual void storeSetting(const String& key, const String& value);
+
+ virtual bool sendMessageToFrontend(const String&);
+};
+
+} // namespace WebCore
+
+#endif // !defined(InspectorClient_h)