diff options
Diffstat (limited to 'WebKit/wx')
26 files changed, 1314 insertions, 176 deletions
diff --git a/WebKit/wx/Bakefiles.bkgen b/WebKit/wx/Bakefiles.bkgen index 44cc496..be544d6 100644 --- a/WebKit/wx/Bakefiles.bkgen +++ b/WebKit/wx/Bakefiles.bkgen @@ -36,6 +36,7 @@ Build configuration script for Bakefile. ../../WebCore/webcore-wx.bkl wxwebkit.bkl bindings/python/wxwebkit-py.bkl + ../../WebKitTools/DumpRenderTree/wx/DumpRenderTree.bkl ../../WebKitTools/wx/browser/browser.bkl </input> @@ -105,6 +106,16 @@ Build configuration script for Bakefile. -o../WebCore/Projects/wx/wxWebCore.xcode </add-flags> --> + + <add-flags files="../../WebKitTools/DumpRenderTree/wx/DumpRenderTree.bkl" formats="gnu"> + -o../../WebKitTools/DumpRenderTree/wx/GNUmakefile + </add-flags> + <add-flags files="../../WebKitTools/DumpRenderTree/wx/DumpRenderTree.bkl" formats="msvs2005prj"> + -o../../WebKitTools/DumpRenderTree/wx/DumpRenderTree.sln + </add-flags> + <add-flags files="../../WebKitTools/DumpRenderTree/wx/DumpRenderTree.bkl" formats="msvc"> + -o../../WebKitTools/DumpRenderTree/wx/makefile.vc + </add-flags> <!-- Personal customizations (not in SVN): --> <include file="Bakefiles.local.bkgen" ignore_missing="1"/> diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index c82850a..455aebd 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,412 @@ +2009-08-05 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Eric Seidel. + + Adding support for building wx Python bindings using the waf build system. + + https://bugs.webkit.org/show_bug.cgi?id=27619 + + * bindings/python/wscript: Added. + +2009-08-04 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix after InspectorClient API change. + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::inspectorWindowObjectCleared): + * WebKitSupport/InspectorClientWx.h: + +2009-08-02 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Jan Alonzo. + + Script for building the WebKit library for wx. + https://bugs.webkit.org/show_bug.cgi?id=27619 + + * wscript: Added. + +2009-07-24 Andrei Popescu <andreip@google.com> + + Reviewed by Anders Carlsson. + + ApplicationCache should have size limit + https://bugs.webkit.org/show_bug.cgi?id=22700 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::reachedMaxAppCacheSize): + Adds empty implementation of the reachedMaxAppCacheSize callback. + * WebKitSupport/ChromeClientWx.h: + +2009-07-21 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Missing header added. + + * WebFrame.cpp: + +2009-07-21 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Adding isSpeaking() to ContextMenuClientWx. + + * WebKitSupport/ContextMenuClientWx.cpp: + (WebCore::ContextMenuClientWx::isSpeaking): + * WebKitSupport/ContextMenuClientWx.h: + +2009-07-16 Xiaomei Ji <xji@chromium.org> + + Reviewed by Darin Adler. + + Fix tooltip does not get its directionality from its element's directionality. + https://bugs.webkit.org/show_bug.cgi?id=24187 + + Per mitz's suggestion in comment #6, while getting the plain-text + title, we also get the directionality of the title. How to handle + the directionality is up to clients. Clients could ignore it, + or use attribute or unicode control characters to display the title + as what they want. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::setToolTip): Add directionality as 2nd parameter to setToopTip() (without handling it yet). + * WebKitSupport/ChromeClientWx.h: Add directionality as 2nd parameter to setToolTip(). + +2009-07-12 Brent Fulgham <bfulgham@gmail.com> + + Speculative build fix after http://trac.webkit.org/changeset/45786. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::addMessageToConsole): + * WebKitSupport/ChromeClientWx.h: + +2009-07-09 Beth Dakin and Jon Honeycutt <bdakin@apple.com> + + Reviewed by Dave Hyatt. + + Make Widget RefCounted to fix: + + <rdar://problem/7038831> REGRESSION (TOT): In Mail, a crash occurs + at WebCore::Widget::afterMouseDown() after clicking To Do's close + box + <rdar://problem/6978804> WER #16: Repro Access Violation in + WebCore::PluginView::bindingInstance (1310178023) + -and- + <rdar://problem/6991251> WER #13: Crash in WebKit! + WebCore::PluginView::performRequest+203 (1311461169) + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createPlugin): + (WebCore::FrameLoaderClientWx::createJavaAppletWidget): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-06-09 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix, adding JSCore/assembler to the list of include dirs. + + * presets/wxwebkit.bkl: + +2009-06-03 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix, remove no longer needed function call. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + +2009-06-02 Darin Adler <darin@apple.com> + + Reviewed by David Hyatt. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): Use FrameView::create + and RefPtr instead of the old "crazy" reference counting. + +2009-05-23 David Kilzer <ddkilzer@apple.com> + + Part 2 of 2: Bug 25495: Implement PassOwnPtr and replace uses of std::auto_ptr + + <https://bugs.webkit.org/show_bug.cgi?id=25495> + + Reviewed by Oliver Hunt. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::createHTMLParserQuirks): Return a + PassOwnPtr<> instead of a raw HTMLParserQuirks pointer. + +2009-05-22 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Triple-click support for wx port. Also, switch to allocating GraphicsContext + on the stack in OnPaint since we only need it within that function. + + https://bugs.webkit.org/show_bug.cgi?id=25962 + + * WebView.cpp: + (wxWebView::OnPaint): + (getDoubleClickTime): + (wxWebView::OnMouseEvents): + (wxWebView::OnContextMenuEvents): + * WebView.h: + * WebViewPrivate.h: + +2009-05-21 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix after method added to EditorClient. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::getAutoCorrectSuggestionForMisspelledWord): + * WebKitSupport/EditorClientWx.h: + +2009-05-20 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=25834 + + Make ChromeClient a interface again + + With recent additions to ChromeClient.h empty defaults were + added. This is bad for porters as these changes go unnoticed + and at runtime no notImplemented warning is logged and grepping + for notImplemented will not show anything. Change this Client + to be like the other Clients again and always have pure virtuals + (but for stuff inside #ifdef PLATFORM(MAC)). + + Update the various WebKit/* implementations to compile again. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::setCursor): + (WebCore::ChromeClientWx::requestGeolocationPermissionForFrame): + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::scrollRectIntoView): + +2009-05-18 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Use python-config to get Python linking info on Unix OSes. + + * bindings/python/wxwebkit-py.bkl: + +2009-03-29 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Maciej Stachowiak. + + WebCore::DocumentLoader::mainReceivedError now asserts if error.isNull(), so + make sure wx does not create empty ResourceError() objects. + + Also make sure we fire a state changed event to notify when the load fails. + + https://bugs.webkit.org/show_bug.cgi?id=24927 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::cancelledError): + (WebCore::FrameLoaderClientWx::blockedError): + (WebCore::FrameLoaderClientWx::cannotShowURLError): + (WebCore::FrameLoaderClientWx::interruptForPolicyChangeError): + (WebCore::FrameLoaderClientWx::cannotShowMIMETypeError): + (WebCore::FrameLoaderClientWx::fileDoesNotExistError): + (WebCore::FrameLoaderClientWx::dispatchDidFailLoading): + (WebCore::FrameLoaderClientWx::pluginWillHandleLoadError): + * WebView.h: + +2009-05-07 Kevin Ollivier <kevino@theolliviers.com> + + Fix for building the Python extension. + + * bindings/python/wxwebkit-py.bkl: + +2009-05-05 Ben Murdoch <benm@google.com> + + Reviewed by Eric Seidel. + + Add #if ENABLE(DATABASE) guards around database code so toggling ENABLE_DATABASE off does not break builds. + https://bugs.webkit.org/show_bug.cgi?id=24776 + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2009-04-01 miggilin <mr.diggilin@gmail.com> + + Reviewed by Kevin Ollivier. + + Full Keyboard shortcut support. + Implement wxBrowser Cut/Copy/Paste menu items. + + https://bugs.webkit.org/show_bug.cgi?id=24797 + + * WebBrowserShell.cpp: + (wxWebBrowserShell::OnSearchCtrlEnter): + (wxWebBrowserShell::OnCut): + (wxWebBrowserShell::OnCopy): + (wxWebBrowserShell::OnPaste): + * WebBrowserShell.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::): + (WebCore::EditorClientWx::handleEditingKeyboardEvent): + (WebCore::EditorClientWx::interpretKeyEvent): + (WebCore::EditorClientWx::handleKeyboardEvent): + * WebKitSupport/EditorClientWx.h: + * WebView.cpp: + (wxWebView::CanCut): + (wxWebView::CanPaste): + (wxWebView::Paste): + (wxWebView::OnKeyEvents): + +2009-05-05 Maclolm MacLeod <mmacleod@webmail.co.za> + + Reviewed by Kevin Ollivier. + + Have wxWebkit make use of gcc(4 and greater) hidden visibility feature + + https://bugs.webkit.org/show_bug.cgi?id=24345 + + * WebFrame.h: + * WebView.h: + +2009-05-01 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + STATE_CHANGED event is now named LOAD + + https://bugs.webkit.org/show_bug.cgi?id=25549 + + * bindings/python/samples/simple.py: + +2009-05-04 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Eric Seidel. + + Initial DRT implementation for wx. + + * Bakefiles.bkgen: + +2009-05-01 Geoffrey Garen <ggaren@apple.com> + + Rubber Stamped by Sam Weinig. + + Renamed JSValuePtr => JSValue. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-05-01 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Add a FrameLoaderClient callback for the ResourceRetrievedByXMLHttpRequest. + + https://bugs.webkit.org/show_bug.cgi?id=25347 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidLoadResourceByXMLHttpRequest): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-04-30 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix, remove references to JSCore shared library. + + * bindings/python/wxwebkit-py.bkl: + * wxwebkit.bkl: + +2009-04-30 David Kilzer <ddkilzer@apple.com> + + Provide a mechanism to create a quirks delegate for HTMLParser + + Reviewed by David Hyatt. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::createHTMLParserQuirks): Added. The + default implementation of this factory method returns 0. + +2009-04-30 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Dimitri Glazkov. + + https://bugs.webkit.org/show_bug.cgi?id=25342 + Add MessageSource and MessageLevel parameters to the ChromeClient::addMessageToConsole. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::addMessageToConsole): + * WebKitSupport/ChromeClientWx.h: + +2009-04-28 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add a function for resetting the zoom factor to 1.0. + + https://bugs.webkit.org/show_bug.cgi?id=25447 + + * WebFrame.cpp: + (wxWebFrame::ResetTextSize): + * WebFrame.h: + * WebView.cpp: + (wxWebView::ResetTextSize): + * WebView.h: + +2009-04-24 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Switching JSCore from a static lib to a dynamic lib + to match the Apple build and fix symbol exports. + + * bindings/python/wxwebkit-py.bkl: + * presets/wxwebkit.bkl: + * wxwebkit.bkl: + +2009-04-15 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Implement support for wxWebViewNewWindowEvent. + + https://bugs.webkit.org/show_bug.cgi?id=19043 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + +2009-04-04 Kevin Ollivier <kevino@theolliviers.com> + + Build fixes for wxMac/Tiger. + + * dependencies.bkl: + * wxwk-settings.bkl: + +2009-04-04 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add missing header. + + * WebKitSupport/FrameLoaderClientWx.cpp: + +2009-03-30 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add events to allow apps to override handling for JS prompts and + window object cleared events. + + https://bugs.webkit.org/show_bug.cgi?id=24948 + + * WebFrame.h: + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::runJavaScriptAlert): + (WebCore::ChromeClientWx::runJavaScriptConfirm): + (WebCore::ChromeClientWx::runJavaScriptPrompt): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::pageDestroyed): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::hasWebView): + (WebCore::FrameLoaderClientWx::windowObjectCleared): + * WebView.cpp: + (wxWebViewAlertEvent::wxWebViewAlertEvent): + (wxWebViewConfirmEvent::wxWebViewConfirmEvent): + (wxWebViewPromptEvent::wxWebViewPromptEvent): + (wxWebViewWindowObjectClearedEvent::wxWebViewWindowObjectClearedEvent): + * WebView.h: + +2009-03-28 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Remove call to now private method. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::prepareForDataSourceReplacement): + 2009-03-02 Kevin Ollivier <kevino@theolliviers.com> Build fixes for wxWidgets Mac trunk build. diff --git a/WebKit/wx/WebBrowserShell.cpp b/WebKit/wx/WebBrowserShell.cpp index d2a30d5..8853051 100644 --- a/WebKit/wx/WebBrowserShell.cpp +++ b/WebKit/wx/WebBrowserShell.cpp @@ -67,6 +67,9 @@ enum { }; BEGIN_EVENT_TABLE(wxWebBrowserShell, wxFrame) + EVT_MENU(wxID_CUT, wxWebBrowserShell::OnCut) + EVT_MENU(wxID_COPY, wxWebBrowserShell::OnCopy) + EVT_MENU(wxID_PASTE, wxWebBrowserShell::OnPaste) EVT_MENU(wxID_EXIT, wxWebBrowserShell::OnQuit) EVT_MENU(wxID_ABOUT, wxWebBrowserShell::OnAbout) EVT_MENU(ID_LOADFILE, wxWebBrowserShell::OnLoadFile) @@ -252,6 +255,24 @@ void wxWebBrowserShell::OnSearchCtrlEnter(wxCommandEvent& event) } } +void wxWebBrowserShell::OnCut(wxCommandEvent& event) +{ + if (webview && webview->CanCut()) + webview->Cut(); +} + +void wxWebBrowserShell::OnCopy(wxCommandEvent& event) +{ + if (webview && webview->CanCopy()) + webview->Copy(); +} + +void wxWebBrowserShell::OnPaste(wxCommandEvent& event) +{ + if (webview && webview->CanPaste()) + webview->Paste(); +} + void wxWebBrowserShell::OnBack(wxCommandEvent& event) { if (webview) diff --git a/WebKit/wx/WebBrowserShell.h b/WebKit/wx/WebBrowserShell.h index 9b48314..edda9e4 100644 --- a/WebKit/wx/WebBrowserShell.h +++ b/WebKit/wx/WebBrowserShell.h @@ -55,6 +55,9 @@ public: protected: // event handlers (these functions should _not_ be virtual) + void OnCut(wxCommandEvent& event); + void OnCopy(wxCommandEvent& event); + void OnPaste(wxCommandEvent& event); void OnQuit(wxCommandEvent& event); void OnAbout(wxCommandEvent& event); void OnLoadFile(wxCommandEvent& event); diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index b479a41..630eb8f 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -36,6 +36,7 @@ #include "HTMLFrameOwnerElement.h" #include "markup.h" #include "Page.h" +#include "PlatformString.h" #include "RenderTreeAsText.h" #include "RenderObject.h" #include "RenderView.h" @@ -177,7 +178,7 @@ wxString wxWebFrame::RunScript(const wxString& javascript) { wxString returnValue = wxEmptyString; if (m_impl->frame) { - JSC::JSValuePtr result = m_impl->frame->loader()->executeScript(javascript, true).jsValue(); + JSC::JSValue result = m_impl->frame->loader()->executeScript(javascript, true).jsValue(); if (result) returnValue = wxString(result.toString(m_impl->frame->script()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8); } @@ -308,6 +309,13 @@ void wxWebFrame::DecreaseTextSize() } } +void wxWebFrame::ResetTextSize() +{ + m_textMagnifier = 1.0; + if (m_impl->frame) + m_impl->frame->setZoomFactor(m_textMagnifier, true); +} + void wxWebFrame::MakeEditable(bool enable) { m_isEditable = enable; diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index 5c697d6..9bf21cd 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -46,15 +46,15 @@ namespace WebCore { #ifndef SWIG -#if WXMAKINGDLL_WEBKIT +#if !wxCHECK_VERSION(2,9,0) && wxCHECK_GCC_VERSION(4,0) +#define WXDLLIMPEXP_WEBKIT __attribute__ ((visibility("default"))) +#elif WXMAKINGDLL_WEBKIT #define WXDLLIMPEXP_WEBKIT WXEXPORT #elif defined(WXUSINGDLL_WEBKIT) #define WXDLLIMPEXP_WEBKIT WXIMPORT -#else -#define WXDLLIMPEXP_WEBKIT #endif -#else +#else #define WXDLLIMPEXP_WEBKIT #endif // SWIG @@ -98,6 +98,7 @@ class WXDLLIMPEXP_WEBKIT wxWebFrame friend class WebCore::EditorClientWx; friend class wxWebView; +public: wxWebFrame(wxWebView* container, wxWebFrame* parent = NULL, WebViewFrameData* data = NULL); ~wxWebFrame(); @@ -142,6 +143,7 @@ class WXDLLIMPEXP_WEBKIT wxWebFrame void IncreaseTextSize(); bool CanDecreaseTextSize() const; void DecreaseTextSize(); + void ResetTextSize(); void MakeEditable(bool enable); bool IsEditable() const { return m_isEditable; } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index 411f795..b25fce9 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "ChromeClientWx.h" +#include "Console.h" #include "FileChooser.h" #include "FloatRect.h" #include "FrameLoadRequest.h" @@ -199,7 +200,10 @@ void ChromeClientWx::setResizable(bool) notImplemented(); } -void ChromeClientWx::addMessageToConsole(const String& message, +void ChromeClientWx::addMessageToConsole(MessageSource source, + MessageType type, + MessageLevel level, + const String& message, unsigned int lineNumber, const String& sourceID) { @@ -239,25 +243,50 @@ void ChromeClientWx::closeWindowSoon() void ChromeClientWx::runJavaScriptAlert(Frame* frame, const String& string) { - wxMessageBox(string, wxT("JavaScript Alert"), wxOK); + 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) { - wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO); - dialog.Centre(); - return (dialog.ShowModal() == wxID_YES); + 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) { - wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL); - dialog.Centre(); - if (dialog.ShowModal() == wxID_OK) { - result = dialog.GetValue(); - return true; + 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; } @@ -336,7 +365,7 @@ void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modi notImplemented(); } -void ChromeClientWx::setToolTip(const String& tip) +void ChromeClientWx::setToolTip(const String& tip, TextDirection) { wxToolTip* tooltip = m_webView->GetToolTip(); if (!tooltip || tooltip->GetTip() != wxString(tip)) @@ -372,4 +401,16 @@ void ChromeClientWx::runOpenPanel(Frame*, PassRefPtr<FileChooser>) notImplemented(); } +bool ChromeClientWx::setCursor(PlatformCursorHandle) +{ + notImplemented(); + return false; +} + +void ChromeClientWx::requestGeolocationPermissionForFrame(Frame*, Geolocation*) +{ + // See the comment in WebCore/page/ChromeClient.h + notImplemented(); +} + } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index d7f4152..85335c8 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -75,7 +75,10 @@ public: virtual void setResizable(bool); - virtual void addMessageToConsole(const String& message, + virtual void addMessageToConsole(MessageSource source, + MessageType type, + MessageLevel level, + const String& message, unsigned int lineNumber, const String& sourceID); @@ -106,7 +109,7 @@ public: virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); - virtual void setToolTip(const String&); + virtual void setToolTip(const String&, TextDirection); virtual void print(Frame*); @@ -122,6 +125,14 @@ public: virtual void formStateDidChange(const Node*) { } + virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; } + + virtual bool setCursor(PlatformCursorHandle); + + virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {} + + virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); + private: wxWebView* m_webView; }; diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp index e3d8e5a..4b73b61 100644 --- a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp @@ -83,4 +83,10 @@ void ContextMenuClientWx::stopSpeaking() notImplemented(); } +bool ContextMenuClientWx::isSpeaking() +{ + notImplemented(); + return false; +} + } diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.h b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h index 2655974..0030c1d 100644 --- a/WebKit/wx/WebKitSupport/ContextMenuClientWx.h +++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h @@ -48,6 +48,7 @@ public: virtual void lookUpInDictionary(Frame*); virtual void speak(const String&); virtual void stopSpeaking(); + virtual bool isSpeaking(); }; } diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index 6c443ed..3808bfe 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -49,6 +49,81 @@ 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, AltKey | ShiftKey, "InsertNewline" }, + { '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; @@ -61,7 +136,7 @@ void EditorClientWx::setPage(Page* page) void EditorClientWx::pageDestroyed() { - notImplemented(); + delete this; } bool EditorClientWx::shouldDeleteRange(Range*) @@ -286,6 +361,74 @@ void EditorClientWx::redo() } } +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, @@ -295,63 +438,8 @@ void EditorClientWx::handleInputMethodKeydown(KeyboardEvent* event) void EditorClientWx::handleKeyboardEvent(KeyboardEvent* event) { - Frame* frame = m_page->focusController()->focusedOrMainFrame(); - if (!frame) - return; - - const PlatformKeyboardEvent* kevent = event->keyEvent(); - if (kevent->type() != PlatformKeyboardEvent::KeyUp) { - Node* start = frame->selection()->start().node(); - if (!start || !start->isContentEditable()) - return; - - if (kevent->type() == PlatformKeyboardEvent::Char && !kevent->ctrlKey() && !kevent->altKey()) { - switch (kevent->windowsVirtualKeyCode()) { - // we handled these on key down, ignore them for char events - case VK_BACK: - case VK_DELETE: - case VK_LEFT: - case VK_RIGHT: - case VK_UP: - case VK_DOWN: - case VK_RETURN: - break; - default: - frame->editor()->insertText(kevent->text(), event); - } - event->setDefaultHandled(); - return; - } - - switch (kevent->windowsVirtualKeyCode()) { - case VK_BACK: - frame->editor()->deleteWithDirection(SelectionController::BACKWARD, - CharacterGranularity, false, true); - break; - case VK_DELETE: - frame->editor()->deleteWithDirection(SelectionController::FORWARD, - CharacterGranularity, false, true); - break; - case VK_LEFT: - frame->editor()->command("MoveLeft").execute(); - break; - case VK_RIGHT: - frame->editor()->command("MoveRight").execute(); - break; - case VK_UP: - frame->editor()->command("MoveUp").execute(); - break; - case VK_DOWN: - frame->editor()->command("MoveDown").execute(); - break; - case VK_RETURN: - frame->editor()->command("InsertLineBreak").execute(); - default: - break; - } - + if (handleEditingKeyboardEvent(event)) event->setDefaultHandled(); - } } void EditorClientWx::textFieldDidBeginEditing(Element*) @@ -436,6 +524,12 @@ void EditorClientWx::getGuessesForWord(const String&, Vector<String>& guesses) notImplemented(); } +String EditorClientWx::getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&) +{ + notImplemented(); + return String(); +} + void EditorClientWx::setInputMethodState(bool enabled) { notImplemented(); diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.h b/WebKit/wx/WebKitSupport/EditorClientWx.h index 0f98167..93cf961 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -87,6 +87,8 @@ public: virtual void undo(); virtual void redo(); + virtual const char* interpretKeyEvent(const KeyboardEvent*); + virtual bool handleEditingKeyboardEvent(KeyboardEvent*); virtual void handleKeyboardEvent(KeyboardEvent*); virtual void handleInputMethodKeydown(KeyboardEvent*); @@ -106,6 +108,8 @@ public: virtual void showSpellingUI(bool show); virtual bool spellingUIIsShowing(); virtual void getGuessesForWord(const String&, Vector<String>& guesses); + virtual String getAutoCorrectSuggestionForMisspelledWord(const WebCore::String&); + virtual void setInputMethodState(bool enabled); private: diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 3cfd86e..9603bd5 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -28,7 +28,11 @@ #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" @@ -42,9 +46,12 @@ #include "RenderPart.h" #include "ResourceError.h" #include "ResourceResponse.h" +#include "ScriptController.h" +#include "ScriptString.h" #include <stdio.h> +#include "WebFrame.h" #include "WebView.h" #include "WebViewPrivate.h" @@ -96,8 +103,7 @@ void FrameLoaderClientWx::detachFrameLoader() bool FrameLoaderClientWx::hasWebView() const { - notImplemented(); - return true; + return m_webView != NULL; } bool FrameLoaderClientWx::hasBackForwardList() const @@ -476,8 +482,7 @@ void FrameLoaderClientWx::didFinishLoad() void FrameLoaderClientWx::prepareForDataSourceReplacement() { - if (m_frame && m_frame->loader()) - m_frame->loader()->detachChildren(); + notImplemented(); } @@ -555,40 +560,39 @@ void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const c fl->addData(data, length); } -WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest&) +WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest& request) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); } -WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest&) +WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest& request) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); } -WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest&) +WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest& request) { - notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotShowURL, request.url().string(), String()); } -WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest&) +WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest& request) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorFrameLoadInterruptedByPolicyChange, request.url().string(), String()); } -WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse&) +WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse& response) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotShowMIMEType, response.url().string(), String()); } -WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse&) +WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse& response) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotShowURL, response.url().string(), String()); } bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error) @@ -652,7 +656,12 @@ void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned lon void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) { - notImplemented(); + 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) @@ -661,6 +670,11 @@ bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* return false; } +void FrameLoaderClientWx::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&) +{ + notImplemented(); +} + void FrameLoaderClientWx::dispatchDidFailProvisionalLoad(const ResourceError&) { notImplemented(); @@ -686,12 +700,23 @@ void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu (m_frame->loader()->*function)(PolicyUse); } -void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&) +void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName) { if (!m_frame) return; - notImplemented(); + 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()->*function)(PolicyIgnore); + return; + } + } + (m_frame->loader()->*function)(PolicyUse); } @@ -785,7 +810,7 @@ ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const return ObjectContentType(); } -Widget* FrameLoaderClientWx::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) +PassRefPtr<Widget> FrameLoaderClientWx::createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) { notImplemented(); return 0; @@ -797,13 +822,13 @@ void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget) return; } -ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse&) +ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse& response) { notImplemented(); - return ResourceError(); + return ResourceError(String(), WebKitErrorCannotLoadPlugIn, response.url().string(), String()); } -Widget* FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, +PassRefPtr<Widget> FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { notImplemented(); @@ -818,7 +843,15 @@ String FrameLoaderClientWx::overrideMediaType() const void FrameLoaderClientWx::windowObjectCleared() { - notImplemented(); + if (m_webView) { + wxWebViewWindowObjectClearedEvent wkEvent(m_webView); + Frame* coreFrame = m_webView->GetMainFrame()->GetFrame(); + JSGlobalContextRef context = toGlobalRef(coreFrame->script()->globalObject()->globalExec()); + JSObjectRef windowObject = toRef(coreFrame->script()->globalObject()); + wkEvent.SetJSContext(context); + wkEvent.SetWindowObject(windowObject); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); + } } void FrameLoaderClientWx::documentElementAvailable() @@ -857,21 +890,17 @@ void FrameLoaderClientWx::transitionToCommittedForNewPage() m_frame->setView(0); - FrameView* frameView; + RefPtr<FrameView> frameView; if (isMainFrame) - frameView = new FrameView(m_frame, IntRect(m_webView->GetRect()).size()); + frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size()); else - frameView = new FrameView(m_frame); + frameView = FrameView::create(m_frame); ASSERT(frameView); m_frame->setView(frameView); - frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame. frameView->setPlatformWidget(m_webView); - if (m_frame->ownerRenderer()) - m_frame->ownerRenderer()->setWidget(frameView); - if (HTMLFrameOwnerElement* owner = m_frame->ownerElement()) m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode()); } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 43b3a8f..7b44149 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -172,8 +172,9 @@ namespace WebCore { virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int); virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long); virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&); - virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int); + virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const ScriptString&); + virtual void dispatchDidFailProvisionalLoad(const ResourceError&); virtual void dispatchDidFailLoad(const ResourceError&); virtual Frame* dispatchCreatePage(); @@ -189,11 +190,11 @@ namespace WebCore { virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); - virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) ; + 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 Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); + 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; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp index 75e4595..d55ad04 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp @@ -120,4 +120,9 @@ void InspectorClientWx::removeSetting(const String& key) notImplemented(); } +void InspectorClientWx::inspectorWindowObjectCleared() +{ + notImplemented(); +} + }; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.h b/WebKit/wx/WebKitSupport/InspectorClientWx.h index ad3ad5b..182df1b 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.h +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.h @@ -63,6 +63,8 @@ public: virtual void populateSetting(const String& key, InspectorController::Setting&); virtual void storeSetting(const String& key, const InspectorController::Setting&); virtual void removeSetting(const String& key); + + virtual void inspectorWindowObjectCleared(); }; } // namespace WebCore diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 94c760b..6bb1f7c 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -46,6 +46,7 @@ #include "PlatformWheelEvent.h" #include "RenderObject.h" #include "RenderView.h" +#include "Scrollbar.h" #include "SelectionController.h" #include "Settings.h" #include "SubstituteData.h" @@ -147,6 +148,42 @@ wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win) SetId(win->GetId()); } +IMPLEMENT_DYNAMIC_CLASS(wxWebViewAlertEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_JS_ALERT) + +wxWebViewAlertEvent::wxWebViewAlertEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_JS_ALERT); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewConfirmEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_JS_CONFIRM) + +wxWebViewConfirmEvent::wxWebViewConfirmEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_JS_CONFIRM); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewPromptEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_JS_PROMPT) + +wxWebViewPromptEvent::wxWebViewPromptEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_JS_PROMPT); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + IMPLEMENT_DYNAMIC_CLASS(wxWebViewReceivedTitleEvent, wxCommandEvent) DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_RECEIVED_TITLE) @@ -159,6 +196,19 @@ wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent(wxWindow* win) SetId(win->GetId()); } +IMPLEMENT_DYNAMIC_CLASS(wxWebViewWindowObjectClearedEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED) + +wxWebViewWindowObjectClearedEvent::wxWebViewWindowObjectClearedEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + + //--------------------------------------------------------- // DOM Element info data type //--------------------------------------------------------- @@ -416,6 +466,12 @@ void wxWebView::DecreaseTextSize() m_mainFrame->DecreaseTextSize(); } +void wxWebView::ResetTextSize() +{ + if (m_mainFrame) + m_mainFrame->ResetTextSize(); +} + void wxWebView::MakeEditable(bool enable) { m_isEditable = enable; @@ -454,17 +510,16 @@ void wxWebView::OnPaint(wxPaintEvent& event) paintRect.Offset(offset.width(), offset.height()); #if USE(WXGC) - WebCore::GraphicsContext* gc = new WebCore::GraphicsContext(&gcdc); + WebCore::GraphicsContext gc(&gcdc); #else - WebCore::GraphicsContext* gc = new WebCore::GraphicsContext((wxWindowDC*)&dc); + WebCore::GraphicsContext gc(&dc); #endif - if (gc && frame->contentRenderer()) { + if (frame->contentRenderer()) { if (frame->view()->needsLayout()) frame->view()->layout(); - frame->view()->paintContents(gc, paintRect); + frame->view()->paintContents(&gc, paintRect); } - delete gc; } } } @@ -489,10 +544,22 @@ void wxWebView::OnSize(wxSizeEvent& event) event.Skip(); } +static int getDoubleClickTime() +{ +#if __WXMSW__ + return ::GetDoubleClickTime(); +#else + return 500; +#endif +} + void wxWebView::OnMouseEvents(wxMouseEvent& event) { event.Skip(); + if (m_beingDestroyed) + return; + if (!m_mainFrame) return; @@ -510,7 +577,20 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) return; } - WebCore::PlatformMouseEvent wkEvent(event, globalPoint); + int clickCount = event.ButtonDClick() ? 2 : 1; + + if (clickCount == 1 && m_impl->tripleClickTimer.IsRunning()) { + wxPoint diff(event.GetPosition() - m_impl->tripleClickPos); + if (abs(diff.x) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_X) && + abs(diff.y) <= wxSystemSettings::GetMetric(wxSYS_DCLICK_Y)) { + clickCount = 3; + } + } else if (clickCount == 2) { + m_impl->tripleClickTimer.Start(getDoubleClickTime(), false); + m_impl->tripleClickPos = event.GetPosition(); + } + + WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount); if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) @@ -539,7 +619,7 @@ void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN); mouseEvent.m_x = localEventPoint.x; mouseEvent.m_y = localEventPoint.y; - WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition()); + WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition(), 1); bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent); if (!handledEvent) @@ -583,7 +663,7 @@ void wxWebView::Copy() bool wxWebView::CanCut() { if (m_mainFrame) - m_mainFrame->CanCut(); + return m_mainFrame->CanCut(); return false; } @@ -597,7 +677,7 @@ void wxWebView::Cut() bool wxWebView::CanPaste() { if (m_mainFrame) - m_mainFrame->CanPaste(); + return m_mainFrame->CanPaste(); return false; } @@ -606,7 +686,6 @@ void wxWebView::Paste() { if (m_mainFrame) m_mainFrame->Paste(); - } void wxWebView::OnKeyEvents(wxKeyEvent& event) @@ -614,40 +693,137 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event) WebCore::Frame* frame = 0; if (m_mainFrame) frame = m_mainFrame->GetFrame(); - - if (frame && frame->view()) { - // WebCore doesn't handle these events itself, so we need to do - // it and not send the event down or else CTRL+C will erase the text - // and replace it with c. - if (event.CmdDown() && event.GetEventType() == wxEVT_KEY_UP) { - if (event.GetKeyCode() == static_cast<int>('C')) + + if (!(frame && frame->view())) + return; + + if (event.GetKeyCode() == WXK_CAPITAL) + frame->eventHandler()->capsLockStateMayHaveChanged(); + + WebCore::PlatformKeyboardEvent wkEvent(event); + + if (frame->eventHandler()->keyEvent(wkEvent)) + return; + + //Some things WebKit won't do for us... Copy/Cut/Paste and KB scrolling + if (event.GetEventType() == wxEVT_KEY_DOWN) { + switch (event.GetKeyCode()) { + case 67: //"C" + if (CanCopy() && event.GetModifiers() == wxMOD_CMD) { Copy(); - else if (event.GetKeyCode() == static_cast<int>('X')) + return; + } + break; + case 86: //"V" + if (CanPaste() && event.GetModifiers() == wxMOD_CMD) { + Paste(); + return; + } + break; + case 88: //"X" + if (CanCut() && event.GetModifiers() == wxMOD_CMD) { Cut(); - else if (event.GetKeyCode() == static_cast<int>('V')) + return; + } + break; + case WXK_INSERT: + if (CanCopy() && event.GetModifiers() == wxMOD_CMD) { + Copy(); + return; + } + if (CanPaste() && event.GetModifiers() == wxMOD_SHIFT) { Paste(); - else if (event.GetKeyCode() == static_cast<int>('Z')) { - if (event.ShiftDown()) { - if (m_mainFrame->CanRedo()) - m_mainFrame->Redo(); - } - else { - if (m_mainFrame->CanUndo()) - m_mainFrame->Undo(); - } + return; + } + return; //Insert shall not become a char + case WXK_DELETE: + if (CanCut() && event.GetModifiers() == wxMOD_SHIFT) { + Cut(); + return; } - } else { - WebCore::PlatformKeyboardEvent wkEvent(event); - if (wkEvent.type() == WebCore::PlatformKeyboardEvent::Char && wkEvent.altKey()) - frame->eventHandler()->handleAccessKey(wkEvent); - else - frame->eventHandler()->keyEvent(wkEvent); + break; + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + frame->view()->scrollBy(WebCore::IntSize(-WebCore::cScrollbarPixelsPerLineStep, 0)); + return; + case WXK_UP: + case WXK_NUMPAD_UP: + frame->view()->scrollBy(WebCore::IntSize(0, -WebCore::cScrollbarPixelsPerLineStep)); + return; + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + frame->view()->scrollBy(WebCore::IntSize(WebCore::cScrollbarPixelsPerLineStep, 0)); + return; + case WXK_DOWN: + case WXK_NUMPAD_DOWN: + frame->view()->scrollBy(WebCore::IntSize(0, WebCore::cScrollbarPixelsPerLineStep)); + return; + case WXK_END: + case WXK_NUMPAD_END: + frame->view()->setScrollPosition(WebCore::IntPoint(frame->view()->scrollX(), frame->view()->maximumScrollPosition().y())); + return; + case WXK_HOME: + case WXK_NUMPAD_HOME: + frame->view()->setScrollPosition(WebCore::IntPoint(frame->view()->scrollX(), 0)); + return; + case WXK_PAGEUP: + case WXK_NUMPAD_PAGEUP: + frame->view()->scrollBy(WebCore::IntSize(0, -frame->view()->visibleHeight() + WebCore::cAmountToKeepWhenPaging)); + return; + case WXK_PAGEDOWN: + case WXK_NUMPAD_PAGEDOWN: + frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() - WebCore::cAmountToKeepWhenPaging)); + return; + //These we don't want turning into char events, stuff 'em + case WXK_ESCAPE: + case WXK_LBUTTON: + case WXK_RBUTTON: + case WXK_CANCEL: + case WXK_MENU: + case WXK_MBUTTON: + case WXK_CLEAR: + case WXK_PAUSE: + case WXK_SELECT: + case WXK_PRINT: + case WXK_EXECUTE: + case WXK_SNAPSHOT: + case WXK_HELP: + case WXK_F1: + case WXK_F2: + case WXK_F3: + case WXK_F4: + case WXK_F5: + case WXK_F6: + case WXK_F7: + case WXK_F8: + case WXK_F9: + case WXK_F10: + case WXK_F11: + case WXK_F12: + case WXK_F13: + case WXK_F14: + case WXK_F15: + case WXK_F16: + case WXK_F17: + case WXK_F18: + case WXK_F19: + case WXK_F20: + case WXK_F21: + case WXK_F22: + case WXK_F23: + case WXK_F24: + case WXK_NUMPAD_F1: + case WXK_NUMPAD_F2: + case WXK_NUMPAD_F3: + case WXK_NUMPAD_F4: + //When numlock is off Numpad 5 becomes BEGIN, or HOME on Char + case WXK_NUMPAD_BEGIN: + case WXK_NUMPAD_INSERT: + return; } } - - // make sure we get the character event. - if (event.GetEventType() != wxEVT_CHAR) - event.Skip(); + + event.Skip(); } void wxWebView::OnSetFocus(wxFocusEvent& event) diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index b041b08..3e6b8f2 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -39,6 +39,9 @@ class WebViewPrivate; class WebViewFrameData; class wxWebFrame; +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSValue* JSObjectRef; + namespace WebCore { class ChromeClientWx; class FrameLoaderClientWx; @@ -46,15 +49,15 @@ namespace WebCore { #ifndef SWIG -#if WXMAKINGDLL_WEBKIT +#if !wxCHECK_VERSION(2,9,0) && wxCHECK_GCC_VERSION(4,0) +#define WXDLLIMPEXP_WEBKIT __attribute__ ((visibility("default"))) +#elif WXMAKINGDLL_WEBKIT #define WXDLLIMPEXP_WEBKIT WXEXPORT #elif defined(WXUSINGDLL_WEBKIT) #define WXDLLIMPEXP_WEBKIT WXIMPORT -#else -#define WXDLLIMPEXP_WEBKIT #endif -#else +#else #define WXDLLIMPEXP_WEBKIT #endif // SWIG @@ -62,6 +65,17 @@ namespace WebCore { extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; #endif +// copied from WebKit/mac/Misc/WebKitErrors[Private].h +enum { + WebKitErrorCannotShowMIMEType = 100, + WebKitErrorCannotShowURL = 101, + WebKitErrorFrameLoadInterruptedByPolicyChange = 102, + WebKitErrorCannotUseRestrictedPort = 103, + WebKitErrorCannotFindPlugIn = 200, + WebKitErrorCannotLoadPlugIn = 201, + WebKitErrorJavaUnavailable = 202, +}; + class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow { // ChromeClientWx needs to get the Page* stored by the wxWebView @@ -94,7 +108,7 @@ public: const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing #ifndef SWIG - ~wxWebView(); + virtual ~wxWebView(); #endif void LoadURL(const wxString& url); @@ -135,6 +149,7 @@ public: void IncreaseTextSize(); bool CanDecreaseTextSize() const; void DecreaseTextSize(); + void ResetTextSize(); void MakeEditable(bool enable); bool IsEditable() const { return m_isEditable; } @@ -143,7 +158,7 @@ public: wxWebFrame* GetMainFrame() { return m_mainFrame; } - wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; + wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const; protected: @@ -309,6 +324,57 @@ private: wxString m_sourceID; }; +class WXDLLIMPEXP_WEBKIT wxWebViewAlertEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewAlertEvent ) +#endif + +public: + wxString GetMessage() const { return m_message; } + void SetMessage(const wxString& message) { m_message = message; } + + wxWebViewAlertEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewAlertEvent(*this); } + +private: + wxString m_message; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewConfirmEvent : public wxWebViewAlertEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewConfirmEvent ) +#endif + +public: + int GetReturnCode() const { return m_returnCode; } + void SetReturnCode(int code) { m_returnCode = code; } + + wxWebViewConfirmEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewConfirmEvent(*this); } + +private: + int m_returnCode; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewPromptEvent : public wxWebViewConfirmEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewPromptEvent ) +#endif + +public: + wxString GetResponse() const { return m_response; } + void SetResponse(const wxString& response) { m_response = response; } + + wxWebViewPromptEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewPromptEvent(*this); } + +private: + wxString m_response; +}; + class WXDLLIMPEXP_WEBKIT wxWebViewReceivedTitleEvent : public wxCommandEvent { #ifndef SWIG @@ -326,13 +392,58 @@ private: wxString m_title; }; +class WXDLLIMPEXP_WEBKIT wxWebViewWindowObjectClearedEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewWindowObjectClearedEvent ) +#endif + +public: + JSGlobalContextRef GetJSContext() const { return m_jsContext; } + void SetJSContext(JSGlobalContextRef context) { m_jsContext = context; } + + JSObjectRef GetWindowObject() const { return m_windowObject; } + void SetWindowObject(JSObjectRef object) { m_windowObject = object; } + + wxWebViewWindowObjectClearedEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); + wxEvent *Clone(void) const { return new wxWebViewWindowObjectClearedEvent(*this); } + +private: + JSGlobalContextRef m_jsContext; + JSObjectRef m_windowObject; +}; typedef void (wxEvtHandler::*wxWebViewLoadEventFunction)(wxWebViewLoadEvent&); typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&); typedef void (wxEvtHandler::*wxWebViewNewWindowEventFunction)(wxWebViewNewWindowEvent&); typedef void (wxEvtHandler::*wxWebViewRightClickEventFunction)(wxWebViewRightClickEvent&); typedef void (wxEvtHandler::*wxWebViewConsoleMessageEventFunction)(wxWebViewConsoleMessageEvent&); +typedef void (wxEvtHandler::*wxWebViewAlertEventFunction)(wxWebViewAlertEvent&); +typedef void (wxEvtHandler::*wxWebViewConfirmEventFunction)(wxWebViewConfirmEvent&); +typedef void (wxEvtHandler::*wxWebViewPromptEventFunction)(wxWebViewPromptEvent&); typedef void (wxEvtHandler::*wxWebViewReceivedTitleEventFunction)(wxWebViewReceivedTitleEvent&); +typedef void (wxEvtHandler::*wxWebViewWindowObjectClearedFunction)(wxWebViewWindowObjectClearedEvent&); + +#define wxWebViewLoadEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewLoadEventFunction, &func) +#define wxWebViewBeforeLoadEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewBeforeLoadEventFunction, &func) +#define wxWebViewNewWindowEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewNewWindowEventFunction, &func) +#define wxWebViewRightClickEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewRightClickEventFunction, &func) +#define wxWebViewConsoleMessageEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConsoleMessageEventFunction, &func) +#define wxWebViewAlertEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewAlertEventFunction, &func) +#define wxWebViewConfirmEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewConfirmEventFunction, &func) +#define wxWebViewPromptEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewPromptEventFunction, &func) +#define wxWebViewReceivedTitleEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewReceivedTitleEventFunction, &func) +#define wxWebViewWindowObjectClearedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewWindowObjectClearedFunction, &func) #ifndef SWIG BEGIN_DECLARE_EVENT_TYPES() @@ -341,7 +452,11 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONSOLE_MESSAGE, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_ALERT, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_CONFIRM, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_JS_PROMPT, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RECEIVED_TITLE, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, wxID_ANY) END_DECLARE_EVENT_TYPES() #endif @@ -385,6 +500,30 @@ END_DECLARE_EVENT_TYPES() (wxWebViewConsoleMessageEventFunction) & func, \ static_cast<wxObject*>(NULL)), +#define EVT_WEBVIEW_JS_ALERT(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_ALERT, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewAlertEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_JS_CONFIRM(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_CONFIRM, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewConfirmEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_JS_PROMPT(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_JS_PROMPT, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewPromptEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + #define EVT_WEBVIEW_RECEIVED_TITLE(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RECEIVED_TITLE, \ winid, \ @@ -392,5 +531,13 @@ END_DECLARE_EVENT_TYPES() (wxObjectEventFunction) \ (wxWebViewReceivedTitleEventFunction) & func, \ static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_WINDOW_OBJECT_CLEARED(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_WINDOW_OBJECT_CLEARED, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewWindowObjectClearedFunction) & func, \ + static_cast<wxObject*>(NULL)), #endif // ifndef WXWEBVIEW_H diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h index 9ad8a3e..c6f24d1 100644 --- a/WebKit/wx/WebViewPrivate.h +++ b/WebKit/wx/WebViewPrivate.h @@ -35,6 +35,8 @@ #include "wtf/RefPtr.h" #include "KURL.h" +#include <wx/timer.h> + class WebViewPrivate { public: @@ -43,6 +45,9 @@ public: {} WebCore::Page* page; + + wxTimer tripleClickTimer; + wxPoint tripleClickPos; }; class WebViewFrameData diff --git a/WebKit/wx/bindings/python/samples/simple.py b/WebKit/wx/bindings/python/samples/simple.py index 2ebdf9c..52d4e1b 100644 --- a/WebKit/wx/bindings/python/samples/simple.py +++ b/WebKit/wx/bindings/python/samples/simple.py @@ -85,7 +85,7 @@ class TestPanel(wx.Panel): self.webview.LoadURL(self.current) self.location.Append(self.current) - self.webview.Bind(wx.webview.EVT_WEBVIEW_STATE_CHANGED, self.OnStateChanged) + self.webview.Bind(wx.webview.EVT_WEBVIEW_LOAD, self.OnStateChanged) self.SetSizer(sizer) diff --git a/WebKit/wx/bindings/python/wscript b/WebKit/wx/bindings/python/wscript new file mode 100644 index 0000000..f9d73c3 --- /dev/null +++ b/WebKit/wx/bindings/python/wscript @@ -0,0 +1,89 @@ +#! /usr/bin/env python + +# Copyright (C) 2009 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. +# +# wxWebKit Python bindings build script for the waf build system + +from settings import * +import Logs +import Options + +include_paths = [ + os.path.join(wk_root, 'WebKit', 'wx'), + os.path.join(wx_root, 'wxPython', 'include'), + os.path.join(wx_root, '..', 'wxPython', 'include'), + ] + +def wxpy_swig_include(): + dirs = [ + 'include/wx-2.9/wx/wxPython/i_files', + 'include/wx-2.8/wx/wxPython/i_files', + 'include/wx/wxPython/i_files', + 'wxPython/src', + '../wxPython/src', + ] + + for adir in dirs: + fullpath = os.path.join(wx_root, adir) + if os.path.exists(fullpath): + return fullpath + + return '' + +def set_options(opt): + common_set_options(opt) + +def configure(conf): + common_configure(conf) + conf.check_tool('swig', tooldir='.') + conf.check_swig_version('1.3.29') + +def build(bld): + if Options.options.wxpython: + wx_swig_args = ['-DSWIG_TYPE_TABLE=_wxPython_table', '-DWXP_USE_THREAD=1', '-DSWIG_PYTHON_OUTPUT_TUPLE'] + try: + import wx.build.config + wx_swig_args += wx.build.config.swig_args + except: + Logs.warn("Cannot find wxPython, wxPython extension will not be built.") + return + + wxpy_include = wxpy_swig_include() + if os.path.exists(wxpy_include): + include_paths.append(wxpy_include) + else: + Logs.warn("Cannot find location of wxPython .i files, wxPython extension will not be built.") + return + + obj = bld.new_task_gen( + features = 'cxx cshlib pyext', + includes = ' '.join(include_paths), + source = 'webview.i', + swig_flags = ' '.join(wx_swig_args), + target = '_webview', + uselib = 'WX CURL ICU XSLT XML SQLITE3 WXWEBKIT ' + waf_configname, + + libpath = [output_dir], + uselib_local = '', + install_path = output_dir) diff --git a/WebKit/wx/bindings/python/wxwebkit-py.bkl b/WebKit/wx/bindings/python/wxwebkit-py.bkl index 8c49a67..2fade58 100644 --- a/WebKit/wx/bindings/python/wxwebkit-py.bkl +++ b/WebKit/wx/bindings/python/wxwebkit-py.bkl @@ -40,12 +40,11 @@ Bakefile for wxWebKit Python bindings. <set var="WX_PYTHON">1</set> </if> - <if cond="not isdefined('PYTHON_VERSION')"> - <option name="PYTHON_VERSION"> - <values>24,25</values> - <default-value>25</default-value> + <if cond="not isdefined('PYTHON_LIB')"> + <option name="PYTHON_LIB" never_empty="1"> + <default-value>python26</default-value> <description> - Python version we're building against. + The name of the Python library file. </description> </option> </if> @@ -83,25 +82,18 @@ Bakefile for wxWebKit Python bindings. <set var="MAC_FLAGS"> <if cond="PLATFORM_OS=='mac'">-bundle -undefined dynamic_lookup</if> </set> - - <sys-lib>python2.5</sys-lib> + <ldflags>$(PYTHON_LIB)</ldflags> <ldflags>$(MAC_FLAGS)</ldflags> </if> <if cond="FORMAT in ['msvc','msvs2005prj']"> - <set var="PY_LIBNAME"> - <if cond="PYTHON_VERSION=='24'"> - python24 - </if> - <if cond="PYTHON_VERSION=='25'"> - python25 - </if> - </set> <sys-lib>libpng</sys-lib> - <sys-lib>$(PY_LIBNAME)</sys-lib> <lib-path>$(WK_ROOT)/libpng</lib-path> - <lib-path>$(PYTHON_LIBDIR)</lib-path> + <sys-lib>$(PYTHON_LIB)</sys-lib> </if> + <lib-path>$(PYTHON_LIBDIR)</lib-path> + + <sys-lib>wxwebkit</sys-lib> <lib-path>$(WKOUTPUTDIR)</lib-path> diff --git a/WebKit/wx/dependencies.bkl b/WebKit/wx/dependencies.bkl index cbdb7e3..dc82c3f 100644 --- a/WebKit/wx/dependencies.bkl +++ b/WebKit/wx/dependencies.bkl @@ -44,12 +44,14 @@ and WebCore. Include this file to use these settings. </option> <template id="sqlite3"> - <sys-lib>sqlite3</sys-lib> <if cond="FORMAT=='gnu'"> - <ldflags>$(SQLITE3_LIBS)</ldflags> - <cxxflags>$(SQLITE3_CFLAGS)</cxxflags> + <set var="SQLITE_LDFLAGS"><if cond="PLATFORM_OS=='mac'">-lWebCoreSQLite3</if><if cond="PLATFORM_OS=='linux'">$(SQLITE3_LIBS)</if></set> + <set var="SQLITE_CFLAGS"><if cond="PLATFORM_OS=='mac'">-I$(WK_ROOT)/WebKitLibraries/WebCoreSQLite3</if><if cond="PLATFORM_OS=='linux'">$(SQLITE3_CFLAGS)</if></set> + <ldflags>$(SQLITE_LDFLAGS)</ldflags> + <cxxflags>$(SQLITE_CFLAGS)</cxxflags> </if> <if cond="FORMAT in ['msvc','msvs2005prj']"> + <sys-lib>sqlite3</sys-lib> <include>$(WK_ROOT)/WebKitLibraries/win/include/SQLite</include> </if> </template> diff --git a/WebKit/wx/presets/wxwebkit.bkl b/WebKit/wx/presets/wxwebkit.bkl index 026ac55..029441f 100644 --- a/WebKit/wx/presets/wxwebkit.bkl +++ b/WebKit/wx/presets/wxwebkit.bkl @@ -98,6 +98,8 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/JavaScriptCore/os-win32</include><!-- stdint.h is here --> <include>$(WKOUTPUTDIR)</include> </if> + <lib-path>$(WKOUTPUTDIR)</lib-path> + <sys-lib>jscore</sys-lib> </template> <template id="webcore"> @@ -147,6 +149,7 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/WebCore/xml</include> <include>$(WK_ROOT)/JavaScriptCore</include> + <include>$(WK_ROOT)/JavaScriptCore/assembler</include> <include>$(WK_ROOT)/JavaScriptCore/bytecode</include> <include>$(WK_ROOT)/JavaScriptCore/bytecompiler</include> <include>$(WK_ROOT)/JavaScriptCore/jit</include> diff --git a/WebKit/wx/wscript b/WebKit/wx/wscript new file mode 100644 index 0000000..695ddc3 --- /dev/null +++ b/WebKit/wx/wscript @@ -0,0 +1,68 @@ +#! /usr/bin/env python + +# Copyright (C) 2009 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. +# +# wxWebKit build script for the waf build system + +from settings import * + +webkit_dirs = ['.', 'WebKitSupport'] +include_paths = webkit_dirs + common_includes + ['.', '..', + wk_root, + os.path.join(wk_root, 'JavaScriptCore'), + os.path.join(wk_root, 'WebCore'), + os.path.join(output_dir), + os.path.join(wk_root, 'WebCore', 'page', 'wx'), + os.path.join(wk_root, 'WebCore', 'platform', 'network', 'curl'), + os.path.join(wk_root, 'WebCore', 'platform', 'wx'), + os.path.join(wk_root, 'WebCore', 'platform', 'bridge', 'wx'), + os.path.join(wk_root, 'WebCore', 'platform', 'graphics', 'wx'), +] + +webcore_include_dirs = [] +for dir in webcore_dirs + ['DerivedSources']: + include_paths.append(os.path.join(wk_root, 'WebCore', dir)) + +js_include_dirs = [os.path.join(wk_root, 'JavaScriptCore', 'assembler')] +for dir in jscore_dirs: + js_include_dirs.append(os.path.join(wk_root, 'JavaScriptCore', dir)) + +def set_options(opt): + common_set_options(opt) + +def configure(conf): + common_configure(conf) + +def build(bld): + obj = bld.new_task_gen( + features = 'cxx cshlib implib', + includes = ' '.join(include_paths + js_include_dirs), + target = 'wxwebkit', + defines = ['WXMAKINGDLL_WEBKIT'], + uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + waf_configname, + libpath = [output_dir], + uselib_local = '', + install_path = output_dir) + + obj.find_sources_in_dirs(webkit_dirs) diff --git a/WebKit/wx/wxwk-settings.bkl b/WebKit/wx/wxwk-settings.bkl index 4328576..d51c18a 100644 --- a/WebKit/wx/wxwk-settings.bkl +++ b/WebKit/wx/wxwk-settings.bkl @@ -76,6 +76,7 @@ JavaScriptCore Bakefile project file. <if cond="FORMAT=='gnu'"> <include>$(WK_ROOT)/WebKitLibraries/unix/include</include> <lib-path>$(WK_ROOT)/WebKitLibraries/unix/lib</lib-path> + <lib-path>$(WK_ROOT)/WebKitLibraries</lib-path> </if> <if cond="FORMAT in ['msvc', 'msvs2005prj']"> <include>$(WK_ROOT)/WebKitLibraries/win/include</include> @@ -91,6 +92,13 @@ JavaScriptCore Bakefile project file. <if cond="FORMAT=='gnu'"> <ldflags>-ljpeg -lpng</ldflags> </if> + + <set var="WEBCORE_LIBS"> + <if cond="PLATFORM_OS=='mac'"> + WebKitSystemInterfaceTiger + </if> + </set> + <sys-lib>$(WEBCORE_LIBS)</sys-lib> <wx-lib>core</wx-lib> <wx-lib>base</wx-lib> <if cond="PLATFORM_WIN32=='1'"> |