diff options
author | Ben Murdoch <benm@google.com> | 2011-05-13 16:23:25 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-16 11:35:02 +0100 |
commit | 65f03d4f644ce73618e5f4f50dd694b26f55ae12 (patch) | |
tree | f478babb801e720de7bfaee23443ffe029f58731 /Source/WebKit/wx | |
parent | 47de4a2fb7262c7ebdb9cd133ad2c54c187454d0 (diff) | |
download | external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.zip external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.gz external_webkit-65f03d4f644ce73618e5f4f50dd694b26f55ae12.tar.bz2 |
Merge WebKit at r75993: Initial merge by git.
Change-Id: I602bbdc3974787a3b0450456a30a7868286921c3
Diffstat (limited to 'Source/WebKit/wx')
34 files changed, 11015 insertions, 0 deletions
diff --git a/Source/WebKit/wx/ChangeLog b/Source/WebKit/wx/ChangeLog new file mode 100644 index 0000000..4862225 --- /dev/null +++ b/Source/WebKit/wx/ChangeLog @@ -0,0 +1,3544 @@ +2011-01-14 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Antti Koivisto. + + Rename cache() to memoryCache() + https://bugs.webkit.org/show_bug.cgi?id=52433 + + * WebView.cpp: + (wxWebView::SetCachePolicy): + +2011-01-09 Xianzhu Wang <phnixwxz@gmail.com> + + Reviewed by Darin Fisher. + + https://bugs.webkit.org/show_bug.cgi?id=41441 + createWindow method should only do window-creating without URL navigation + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + +2011-01-07 Adam Barth <abarth@webkit.org> + + Rubber-stamped by Eric Seidel. + + Move WebCore to Source + https://bugs.webkit.org/show_bug.cgi?id=52050 + + * bindings/python/wscript: + * wscript: + +2011-01-01 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move JavaScriptCore to Source + https://bugs.webkit.org/show_bug.cgi?id=51604 + + * bindings/python/wscript: + * wscript: + - Point to JavaScriptCore in its new location. + +2010-12-22 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + WebKit2 needs to mirror the frame tree in the UIProcess + https://bugs.webkit.org/show_bug.cgi?id=51546 + + - Add client functions to notify that a frame has been added or + removed from the page cache. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didSaveToPageCache): + (WebCore::FrameLoaderClientWx::didRestoreFromPageCache): + * WebKitSupport/FrameLoaderClientWx.h: + +2010-12-20 Eric Seidel <eric@webkit.org> + + Unreviewed. + + Removed a non-utf8 character from this file. + Looks like it was accidentally added in: + http://trac.webkit.org/changeset/72669 + Which caused troubles for the contributor working on bug 51382. + +2010-10-28 MORITA Hajime <morrita@google.com> + + Reviewed by Ojan Vafai. + + spellcheck does not check pasted text + https://bugs.webkit.org/show_bug.cgi?id=40092 + + Added a stub implememntation. + + * WebKitSupport/EditorClientWx.h: + (WebCore::EditorClientWx::requestCheckingOfString): + +2010-12-07 Martin Robinson <mrobinson@igalia.com> + + Unreviewed, rolling out r73392. + http://trac.webkit.org/changeset/73392 + https://bugs.webkit.org/show_bug.cgi?id=50489 + + This commit caused crashes on the GTK+ bots + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::finishedLoading): + +2010-12-06 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Update calls to DocumentWriter. + https://bugs.webkit.org/show_bug.cgi?id=50489 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::finishedLoading): + +2010-12-01 Jia Pu <jpu@apple.com> + + Reviewed by Darin Adler. + + Support multiple correction candidates panel for misspelled word on Mac OS X. + https://bugs.webkit.org/show_bug.cgi?id=50137 + <rdar://problem/8568059> + + Adopted new function signature defined in base class. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::getGuessesForWord): + * WebKitSupport/EditorClientWx.h: + +2010-11-24 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Csaba Osztrogonác. + + Remove Bakefile build system files + https://bugs.webkit.org/show_bug.cgi?id=49983 + + r53757 only removed the content, but not the files. + This patch removes that empty files. + + * Bakefiles.bkgen: Removed. + * bindings/python/wxwebkit-py.bkl: Removed. + * dependencies.bkl: Removed. + * presets: Removed. + * presets/wxwebkit.bkl: Removed. + * wxwebkit.bkl: Removed. + * wxwk-settings.bkl: Removed. + +2010-11-08 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48685 + Notify UI process about focused frame + + Added an empty implementation of the new ChromeClient method. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::focusedFrameChanged): + * WebKitSupport/ChromeClientWx.h: + +2010-11-07 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Rename Cache to MemoryCache + https://bugs.webkit.org/show_bug.cgi?id=49159 + + * WebView.cpp: + (wxWebView::SetCachePolicy): + * WebView.h: + +2010-11-01 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + <rdar://problem/7660547> and https://bugs.webkit.org/show_bug.cgi?id=48699 + Context menu support for WebKit 2. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::showContextMenu): + +2010-10-29 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Change BackForwardList clients to use BackForwardListImpl to prepare for further refactoring + https://bugs.webkit.org/show_bug.cgi?id=48574 + + * WebFrame.cpp: + (wxWebFrame::CanGoBack): Use canGoBackOrForward. + (wxWebFrame::CanGoForward): Ditto. + +2010-10-29 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48576 + Let WebKit2 client know when a frame is a frameset + + Added a blank implementation of the new FrameLoaderClient method. + + * WebKitSupport/FrameLoaderClientWx.h: + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidBecomeFrameset): + +2010-10-26 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Resource tracking failure when trying to move a frame between documents + https://bugs.webkit.org/show_bug.cgi?id=44713 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transferLoadingResourceFromPage): + Empty method. + * WebKitSupport/FrameLoaderClientWx.h: + +2010-10-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 needs to pass the current event modifier flags when requesting a new window + https://bugs.webkit.org/show_bug.cgi?id=48140 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + * WebKitSupport/ChromeClientWx.h: + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchCreatePage): + * WebKitSupport/FrameLoaderClientWx.h: + Add NavigationAction parameter. + +2010-10-13 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + https://bugs.webkit.org/show_bug.cgi?id=43987 + Switch XMLHttpRequest, FileReader, and FileReaderSync to use a Stringbuilder + to construct their internal result string. Remove ScriptString (this is now + redundant). + + * WebKitSupport/FrameLoaderClientWx.cpp: + +2010-09-28 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Added oldPage param to FrameLoaderClient::didTransferChildFrameToNewDocument. + https://bugs.webkit.org/show_bug.cgi?id=46663 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didTransferChildFrameToNewDocument): + * WebKitSupport/FrameLoaderClientWx.h: + +2010-09-24 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Andreas Kling. + + [wx] ChromeClientWx::scaleFactor must return 1.0 + https://bugs.webkit.org/show_bug.cgi?id=46542 + + The default value of ChromeClientWx::scaleFactor must be 1.0. + Otherwise, canvas element won't be painted. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::scaleFactor): + +2010-09-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + REGRESSION (r60104): Zoom level is unexpectedly reset on page reload + https://bugs.webkit.org/show_bug.cgi?id=42863 + + * WebFrame.cpp: + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::ResetTextSize): + Call functions on Frame instead of FrameView. + +2010-09-14 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after FrameNetworkingContext changes and setZoomLevel changes. + + * WebFrame.cpp: + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::ResetTextSize): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createNetworkingContext): + * WebKitSupport/FrameLoaderClientWx.h: + * WebKitSupport/FrameNetworkingContextWx.h: Added. + (WebCore::FrameNetworkingContextWx::create): + (WebCore::FrameNetworkingContextWx::coreFrame): + (WebCore::FrameNetworkingContextWx::FrameNetworkingContextWx): + +2010-09-13 Enrica Casucci <enrica@apple.com> + + Reviewed by Sam Weinig. + + Paste should be implemented in WebCore like Copy and Cut for Mac also. + https://bugs.webkit.org/show_bug.cgi?id=45494 + <rdar://problem/7660537> + + On the Mac platform, the implementation of the paste operation is all done + at the WebKit level. In order to support it on WebKit2 it is necessary to + refactor the code and move this functionality at the level of WebCore like + we already have on Windows. + The original code relies on some in AppKit functions that call back into + WebKit causing problems in WebKit2. All this functionality has been moved + at the level of the editor client where it can be dealt with appropriately. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::canShowMIMETypeAsHTML): Added stub. + * WebKitSupport/FrameLoaderClientWx.h: + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Fisher. + + Move code from WebKit-layer to DocumentLoader + https://bugs.webkit.org/show_bug.cgi?id=45569 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-09-10 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Main resource bytes shouldn't bounce through FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=45496 + + Now return the bytes to the DocumentLoader. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-09-08 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions from Frame to Editor as planned + https://bugs.webkit.org/show_bug.cgi?id=45218 + + * WebFrame.cpp: + (wxWebFrame::FindString): + Changed call sites to use editor(). + +2010-08-31 Dave Hyatt <hyatt@apple.com> + + Reviewed by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=44863, disentangle style recalc from layout, so that + the former can occur in more places without having to do the latter. + + * WebView.cpp: + (wxWebView::OnPaint): + +2010-08-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after parseMode -> compatibilityMode rename. + + * WebFrame.cpp: + (wxWebFrame::GetCompatibilityMode): + * WebFrame.h: + * WebView.cpp: + (wxWebView::GetCompatibilityMode): + * WebView.h: + +2010-08-26 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + A few tweaks to the wxWebView editing APIs after addition of DOM bindings. + https://bugs.webkit.org/show_bug.cgi?id=44656 + + 1. adoptRef fix for WebCore::EditCommand wrapper API. + 2. Add the mimetype as an argument to SetPageSource to allow XHTML documents to be loaded. + 3. Add notification events for contents / selection changed editing events. + 4. Improved wxPython binding typemaps support for DOM APIs. + + * WebEdit.cpp: + (WebCoreEditCommandPrivate::WebCoreEditCommandPrivate): + (WebCoreEditCommandPrivate::~WebCoreEditCommandPrivate): + (WebCoreEditCommandPrivate::command): + (wxWebEditCommand::wxWebEditCommand): + (wxWebEditCommand::~wxWebEditCommand): + (wxWebEditCommand::SetNodeAttribute): + (wxWebEditCommand::Apply): + * WebEdit.h: + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + * WebFrame.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::respondToChangedContents): + (WebCore::EditorClientWx::respondToChangedSelection): + * WebSettings.h: + * WebView.cpp: + (wxWebViewContentsChangedEvent::wxWebViewContentsChangedEvent): + (wxWebViewSelectionChangedEvent::wxWebViewSelectionChangedEvent): + (wxWebView::SetPageSource): + * WebView.h: + * bindings/python/webview.i: + +2010-08-16 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, do not build WebCore as a convenience library as this leads to + errors in the Win build w/export symbols and causes problems with DOM bindings + debugging in gdb. + + * WebKitDefines.h: + * bindings/python/wscript: + +2010-08-16 Kevin Ollivier <kevino@theolliviers.com> + + wxMSW build fix. Don't build the Python DOM bindings until we get the export issues + sorted out. + + * bindings/python/webview.i: + +2010-08-13 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2010-08-12 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r65295. + http://trac.webkit.org/changeset/65295 + https://bugs.webkit.org/show_bug.cgi?id=43950 + + It broke 4 sputnik tests (Requested by Ossy on #webkit). + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2010-08-12 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + + Unify UString::UTF8String() & String::utf8() methods, + remove UString::cost() & make atArrayIndex a free function. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2010-08-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix. WebCore::String -> WTF::String fixes. + + * WebEdit.cpp: + (wxWebEditCommand::SetNodeAttribute): + +2010-08-10 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + Bug 43786 - Move AtomicStringHash from WebCore to WTF + Also remove deprecated string headers from WebCore/platform/text. + + * WebEdit.cpp: + +2010-08-06 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig + + Bug 43594 - Add string forwards to Forward.h + This allows us to remove forward declarations for these classes from + WebCore/WebKit (a step in moving these class from WebCore:: to WTF::). + + * WebKitSupport/FrameLoaderClientWx.h: + * WebKitSupport/InspectorClientWx.h: + +2010-08-06 Jessie Berlin <jberlin@apple.com> + + Roll out http://trac.webkit.org/changeset/64801, which broke the Safari Windows Build. + Unreviewed. + + * WebKitSupport/FrameLoaderClientWx.h: + * WebKitSupport/InspectorClientWx.h: + +2010-08-04 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix for gcc not importing all symbols from convenience libraries. + Works on 10.6 only for Mac until the build system is reworked. + + * bindings/python/webview.i: + +2010-08-03 Malcolm MacLeod <mmacleod@webmail.co.za> + + Reviewed by Kevin Ollivier. + + Fix crash during HitTest call. + https://bugs.webkit.org/show_bug.cgi?id=43372 + + * WebFrame.cpp: + (wxWebFrame::HitTest): + * WebView.cpp: + (wxWebViewDOMElementInfo::wxWebViewDOMElementInfo): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + As ChromeClient was made responsible for providing PopupMenu and SearchPopupMenu + instances, concrete classes that inherit from ChromeClient needed to be changed to + implement the new methods. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::selectItemWritingDirectionIsNatural): + (WebCore::ChromeClientWx::createPopupMenu): + (WebCore::ChromeClientWx::createSearchPopupMenu): + * WebKitSupport/ChromeClientWx.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::reachedApplicationCacheOriginQuota): + * WebKitSupport/ChromeClientWx.h: + +2010-07-29 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, add file missing from DOM bindings commit. + + * WebEdit.cpp: Added. + (WebCore::): + (wxWebEditCommand::wxWebEditCommand): + (wxWebEditCommand::~wxWebEditCommand): + (wxWebEditCommand::SetNodeAttribute): + (wxWebEditCommand::Apply): + +2010-07-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] wxPython build fix that was missed in last commit. + + * bindings/python/webview.i: + +2010-07-28 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after recent changes. + + * WebEdit.h: Added. + * bindings/python/webview.i: + +2010-07-28 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Add DOM bindings support for wx port. + + * WebBrowserShell.cpp: + (wxWebBrowserShell::wxWebBrowserShell): + (wxWebBrowserShell::OnEditCommand): + (wxWebBrowserShell::OnGetEditCommandState): + * WebBrowserShell.h: + * WebDOMSelection.cpp: Added. + (wxWebKitSelection::wxWebKitSelection): + (wxWebKitSelection::GetRootEditableElement): + (wxWebKitSelection::GetAsRange): + * WebDOMSelection.h: Added. + * WebFrame.cpp: + (wxWebFrame::GetSelectionAsHTML): + (wxWebFrame::GetSelectionAsText): + (wxWebFrame::GetSelection): + (wxWebFrame::ExecuteEditCommand): + (wxWebFrame::GetEditCommandState): + (wxWebFrame::GetEditCommandValue): + (wxWebFrame::HitTest): + * WebFrame.h: + * WebKitDefines.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::): + (WebCore::EditorClientWx::redo): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::finishedLoading): + (WebCore::FrameLoaderClientWx::setMainDocumentError): + (WebCore::FrameLoaderClientWx::dispatchDidFailLoading): + * WebView.cpp: + (wxWebViewDOMElementInfo::wxWebViewDOMElementInfo): + (wxWebViewDOMElementInfo::~wxWebViewDOMElementInfo): + (wxWebView::Create): + (wxWebView::GetSelection): + (wxWebView::GetSelectionAsHTML): + (wxWebView::GetSelectionAsText): + (wxWebView::ExecuteEditCommand): + (wxWebView::GetEditCommandState): + (wxWebView::GetEditCommandValue): + (wxWebView::MakeEditable): + (wxWebView::IsEditable): + * WebView.h: + * bindings/python/webview.i: + * bindings/python/wscript: + * wscript: + +2010-07-26 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Page clients should be passed to Page constructor via structure of pointers + https://bugs.webkit.org/show_bug.cgi?id=42834 + + * WebView.cpp: + (wxWebView::Create): + +2010-07-16 Zhe Su <suzhe@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION(r61484): Broke focus behaviour on Qt and probably other platforms + https://bugs.webkit.org/show_bug.cgi?id=42253 + + Dummy implementation of EditorClient::willSetInputMethodState. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::willSetInputMethodState): + * WebKitSupport/EditorClientWx.h: + +2010-07-14 Sam Weinig <sam@webkit.org> + + Reviewed by Darin Adler. + + Patch for https://bugs.webkit.org/show_bug.cgi?id=42232 + Make changing Cursors work in WebKit2. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::setCursor): + * WebKitSupport/ChromeClientWx.h: + Change prototype to match new one. + +2010-07-07 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after change in Page constructor. + + * WebView.cpp: + (wxWebView::Create): + +2010-06-21 Kevin Ollivier <kevino@theolliviers.com> + + Build fix after conversion of WebInterfaceSystem to Obj-C++. + + * WebView.cpp: + * wscript: + +2010-06-15 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Adam Barth. + + Move isAvailable()/setIsAvailable() from Database/DatabaseSync to AbstractDatabase. + https://bugs.webkit.org/show_bug.cgi?id=39041 + + * WebView.cpp: + (wxWebView::SetDatabasesEnabled): + (wxWebView::AreDatabasesEnabled): + +2010-06-15 Darin Adler <darin@apple.com> + + Reviewed by Adam Barth. + + Move functions out of Frame class that were marked "move to Chrome" + https://bugs.webkit.org/show_bug.cgi?id=39636 + + * WebFrame.cpp: + (wxWebFrame::ShouldClose): Call shouldClose on FrameLoader instead + of going through Frame. + +2010-06-14 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::sendMessageToFrontend): + * WebKitSupport/InspectorClientWx.h: + +2010-06-09 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r60889. + http://trac.webkit.org/changeset/60889 + https://bugs.webkit.org/show_bug.cgi?id=40365 + + gtk bot has some kind of memory corruption (Requested by + loislo on #webkit). + + * WebKitSupport/InspectorClientWx.cpp: + * WebKitSupport/InspectorClientWx.h: + +2010-06-07 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + WebInspector: On the way to Remote Debugging we want to transfer dom/timeline/etc + data from inspected page to WebInspector as JSON string via http. The native + serialization to JSON string is supported by InspectorValue's classes. This patch + has the implementation of sendMessageToFrontend function. WebKit version of it still + uses ScriptFunctionCall and will be switched to another transport a little bit later. + https://bugs.webkit.org/show_bug.cgi?id=40134 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::sendMessageToFrontend): + * WebKitSupport/InspectorClientWx.h: + +2010-05-27 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fixes for Windows after recent changes. + + * WebView.cpp: + (wxWebView::Create): + * wscript: + +2010-05-26 Kevin Ollivier <kevino@theolliviers.com> + + Build fix after new client added to Page constructor. + + * WebView.cpp: + (wxWebView::Create): + +2010-05-24 Darin Adler <darin@apple.com> + + Reviewed by Eric Seidel. + + Move view-related functions from Frame to FrameView + https://bugs.webkit.org/show_bug.cgi?id=39366 + + * WebFrame.cpp: + (wxWebFrame::CanIncreaseTextSize): Check FrameView is not null. + (wxWebFrame::IncreaseTextSize): Call function on FrameView. + (wxWebFrame::CanDecreaseTextSize): Ditto. + (wxWebFrame::DecreaseTextSize): Ditto. + (wxWebFrame::ResetTextSize): Ditto. + +2010-05-11 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Load a blank page on creation to initialize WebCore objects properly. + https://bugs.webkit.org/show_bug.cgi?id=38932 + + * WebView.cpp: + (wxWebView::Create): + +2010-05-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Build and use Mac's ComplexTextController to support complex text in wx. + https://bugs.webkit.org/show_bug.cgi?id=38482 + + * WebView.cpp: + (wxWebView::Create): + * wscript: + +2010-05-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Provide access to GrantUniversalAccess to allow enabling of XSS support. + https://bugs.webkit.org/show_bug.cgi?id=38481 + + * WebFrame.cpp: + (wxWebFrame::GrantUniversalAccess): + * WebFrame.h: + * WebView.cpp: + (wxWebView::GetParseMode): + (wxWebView::GrantUniversalAccess): + * WebView.h: + +2010-05-03 Jens Alfke <snej@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Add "willSendSubmitEvent" hook to WebFrameClient and FrameLoaderClient + https://bugs.webkit.org/show_bug.cgi?id=38397 + + No tests (functionality is exposed only through native WebKit API.) + + * WebKitSupport/FrameLoaderClientWx.h: + (WebCore::FrameLoaderClientWx::dispatchWillSendSubmitEvent): + +2010-04-25 Sam Weinig <sam@webkit.org> + + Reviewed by Maciej Stachowiak. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=38097 + Disentangle initializing the main thread from initializing threading + + * WebView.cpp: + (wxWebView::Create): Add call to initializeMainThread. + +2010-04-25 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Update focus handling code to match current approaches used by other platforms, + and fix focus handling for corner cases such as when a mouse down pops up a dialog. + + https://bugs.webkit.org/show_bug.cgi?id=38086 + + * WebView.cpp: + (wxWebView::Create): + (wxWebView::OnTLWActivated): + (wxWebView::OnPaint): + (wxWebView::OnMouseEvents): + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + * WebView.h: + +2010-04-20 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-04-20 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Change a parameter type of chooseIconForFiles() + https://bugs.webkit.org/show_bug.cgi?id=37504 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::chooseIconForFiles): + * WebKitSupport/ChromeClientWx.h: + +2010-04-19 Kevin Ollivier <kevino@theolliviers.com> + + Build fix, add stub for new FrameLoaderClient method. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidChangeIcons): + * WebKitSupport/FrameLoaderClientWx.h: + +2010-04-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r57468. + http://trac.webkit.org/changeset/57468 + https://bugs.webkit.org/show_bug.cgi?id=37433 + + Broke the world... Must have applied the patch wrong + (Requested by abarth on #webkit). + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-04-11 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Factor DocumentWriter out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=37175 + + Update these callsites because the method moved to DocumentWriter. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::committedLoad): + +2010-04-07 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Removed redundant FrameLoaderClient::dispatchDidLoadResourceByXMLHttpRequest() + https://bugs.webkit.org/show_bug.cgi?id=36949 + + * WebKitSupport/FrameLoaderClientWx.cpp: + * WebKitSupport/FrameLoaderClientWx.h: + +2010-03-31 Marcus Bulach <bulach@chromium.org> + + Reviewed by Jeremy Orlow. + + Adds Geolocation param for cancelGeolocationPermissionRequestForFrame. + https://bugs.webkit.org/show_bug.cgi?id=35031 + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::cancelGeolocationPermissionRequestForFrame): + +2010-03-30 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + https://bugs.webkit.org/show_bug.cgi?id=36866 + Move CString to WTF + + * WebFrame.cpp: + * WebView.cpp: + +2010-03-30 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix after method name change. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2010-03-28 Alexey Proskuryakov <ap@apple.com> + + Build fix. Include WindowsKeyboardCodes.h instead of KeyboardCodes.h. + + * WebKitSupport/EditorClientWx.cpp: + +2010-03-24 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Make Icon::createIconForFiles() optional. + https://bugs.webkit.org/show_bug.cgi?id=35072 + + - Rename iconForFiles() to chooseIconForFiles(). + - Call Icon::createIconForFiles() from chooseIconForFiles(). + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::chooseIconForFiles): + * WebKitSupport/ChromeClientWx.h: + +2010-03-20 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fixes after recent changes, including move of setDatabasesEnabled from Settings. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::openInspectorFrontend): + * WebSettings.cpp: + * WebSettings.h: + * WebView.cpp: + (wxWebView::Create): + (wxWebView::SetDatabasesEnabled): + (wxWebView::AreDatabasesEnabled): + * WebView.h: + +2010-03-16 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Introduce InspectorFrontendClient that provides InspectorFrontend with an interface to the embedder. InspectorClient now serves as a delegate for InspectorController and does not contain methods for managing inspector frontend window. That allows to create remote InspectorFrontendHost. + + Introduce InspectorFrontendClient that would provide InspectorFrontend with an interface to the embedder + https://bugs.webkit.org/show_bug.cgi?id=35036 + + * WebKitSupport/InspectorClientWx.cpp: + * WebKitSupport/InspectorClientWx.h: + +2010-03-11 Anders Carlsson <andersca@apple.com> + + Reviewed by David Hyatt. + + Remove invalidateContents, it isn't used and it never makes sense to only invalidate the contents. + + * WebKitSupport/ChromeClientWx.cpp: + * WebKitSupport/ChromeClientWx.h: + +2010-03-02 Adam Treat <atreat@rim.com> + + Reviewed by Dave Hyatt. + + Adapt the wx port to the refactoring of repaint methods. + + https://bugs.webkit.org/show_bug.cgi?id=34214 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::invalidateContents): + (WebCore::ChromeClientWx::invalidateWindow): + (WebCore::ChromeClientWx::invalidateContentsForSlowScroll): + (WebCore::ChromeClientWx::invalidateContentsAndWindow): + * WebKitSupport/ChromeClientWx.h: + +2010-03-01 Jakob Petsovits <jpetsovits@rim.com> + + Reviewed by Adam Barth. + + Adapt to the new ZoomMode enum. + https://bugs.webkit.org/show_bug.cgi?id=35347 + + * WebFrame.cpp: + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::ResetTextSize): + +2010-02-23 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Adds ChromeClient::cancelGeolocationPermissionRequestForFrame + https://bugs.webkit.org/show_bug.cgi?id=34962 + + This method is required so that a Geolocation object can cancel an + asynchronous permission request. This allows the chrome client to cancel + any UI it is showing for the permission request. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::cancelGeolocationPermissionRequestForFrame): + +2010-02-17 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin, Darin Fisher, Simon Hausmann. + + When a live iframe element is moved between pages, it still depends on the old page. + https://bugs.webkit.org/show_bug.cgi?id=34382 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didTransferChildFrameToNewDocument): + Added empty implementation of a new virtual method. + + * WebKitSupport/FrameLoaderClientWx.h: + +2010-02-17 Kent Tamura <tkent@chromium.org> + + Reviewed by Eric Seidel. + + Introduces new Icon loading interface in order to support + asynchronous loading. + https://bugs.webkit.org/show_bug.cgi?id=32054 + + Add an empty implementation of ChromeClient::iconForFiles(). + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::iconForFiles): + * WebKitSupport/ChromeClientWx.h: + +2010-02-04 Kevin Ollivier <kevino@theolliviers.com> + + Build fix after changes in r54345. + + * WebView.cpp: + (wxWebView::OnKeyEvents): + +2010-02-04 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + REGRESSION (r53718): When scrolling a tall window by page, the overlap between pages is too big + https://bugs.webkit.org/show_bug.cgi?id=34371 + + * WebView.cpp: + (wxWebView::OnKeyEvents): Use Scrollbar method instead of constant. + +2010-02-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add wxWebKitWindowFeatures and have createWindow send a notification for + clients to handle. + + https://bugs.webkit.org/show_bug.cgi?id=34542 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::wkFeaturesforWindowFeatures): + (WebCore::ChromeClientWx::createWindow): + * WebView.h: + +2010-01-27 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add a way to get the parse mode to wxWebKit API. + + https://bugs.webkit.org/show_bug.cgi?id=34341 + + * WebFrame.cpp: + (wxWebFrame::GetParseMode): + * WebFrame.h: + * WebView.cpp: + (wxWebView::GetParseMode): + * WebView.h: + +2010-01-22 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Remove the Bakefile build system, which is no longer being used. + + https://bugs.webkit.org/show_bug.cgi?id=34022 + + * bindings/python/wxwebkit-py.bkl: Removed. + * dependencies.bkl: Removed. + * presets/wxwebkit.bkl: Removed. + * wxwebkit.bkl: Removed. + * wxwk-settings.bkl: Removed. + +2010-01-22 Kevin Ollivier <kevino@theolliviers.com> + + Build fix after r53718. + + * WebView.cpp: + (wxWebView::OnKeyEvents): + +2010-01-15 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Alexey Proskuryakov. + + Move the code adding the child frame to the FrameTree into wxWebFrame constructor + so that it happens before we call init() on the new frame. Fixes asserts checking + frame count consistency. + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createFrame): + +2010-01-14 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Build fix, missing header. + + * WebView.cpp: + +2010-01-09 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + ScriptController::isEnabled needs to be renamed + https://bugs.webkit.org/show_bug.cgi?id=32063 + + Rename ScriptController::isEnabled to + ScriptController::canExecuteScripts. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-12-30 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Introduce wxWebSettings API interface for editing wxWebView / page settings. + + https://bugs.webkit.org/show_bug.cgi?id=32956 + + * WebBrowserShell.h: + * WebFrame.h: + * WebKitDefines.h: Added. + * WebSettings.cpp: Added. + (wxWebSettings::SetDefaultFixedFontSize): + (wxWebSettings::GetDefaultFixedFontSize): + (wxWebSettings::SetDefaultFontSize): + (wxWebSettings::GetDefaultFontSize): + (wxWebSettings::SetMinimumFontSize): + (wxWebSettings::GetMinimumFontSize): + (wxWebSettings::SetLoadsImagesAutomatically): + (wxWebSettings::LoadsImagesAutomatically): + (wxWebSettings::SetJavaScriptEnabled): + (wxWebSettings::IsJavaScriptEnabled): + (wxWebSettings::SetDatabasesEnabled): + (wxWebSettings::AreDatabasesEnabled): + (wxWebSettings::SetLocalStoragePath): + (wxWebSettings::GetLocalStoragePath): + (wxWebSettings::SetEditableLinkBehavior): + (wxWebSettings::GetEditableLinkBehavior): + (wxWebSettings::SetPluginsEnabled): + (wxWebSettings::ArePluginsEnabled): + * WebSettings.h: Added. + * WebView.cpp: + (wxWebView::Create): + (wxWebView::GetWebSettings): + * WebView.h: + * bindings/python/webview.i: + +2009-12-28 Patrick Gansterer <paroga@paroga.com> + + Reviewed by Maciej Stachowiak. + + Use JS_NO_EXPORT for JSBase.h. + + * wxwk-settings.bkl: + +2009-12-20 Kevin Ollivier <kevino@theolliviers.com> + + [wx] build fixes after recent changes. + + * WebFrame.cpp: Added missing header. + * WebKitSupport/EditorClientWx.cpp: Added missing header. + * WebView.cpp: Updated Page constructor call. + (wxWebView::Create): + +2009-12-08 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Mac plugins support. + + https://bugs.webkit.org/show_bug.cgi?id=32236 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createPlugin): + (WebCore::FrameLoaderClientWx::redirectDataToPlugin): + * WebView.cpp: + (wxWebView::Create): + +2009-12-03 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/7214236> and http://webkit.org/b/32052 - Implement HTML5 state object history API + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidPushStateWithinPage): + (WebCore::FrameLoaderClientWx::dispatchDidReplaceStateWithinPage): + (WebCore::FrameLoaderClientWx::dispatchDidPopStateWithinPage): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-12-03 Pavel Feldman <pfeldman@dhcp-172-28-174-220.spb.corp.google.com> + + Reviewed by Timothy Hatcher. + + Web Inspector: Simplify the settings support in inspector controller. + + https://bugs.webkit.org/show_bug.cgi?id=32076 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::populateSetting): + (WebCore::InspectorClientWx::storeSetting): + * WebKitSupport/InspectorClientWx.h: + +2009-12-03 Ben Murdoch <benm@google.com> + + Reviewed by Brady Eidson. + + [Android] The FrameLoaderClient is unaware of BackForwardList changes. + https://bugs.webkit.org/show_bug.cgi?id=31914 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidAddBackForwardItem): Add an empty implementation. Method added to FrameLoaderClient by Android (see bug). + (WebCore::FrameLoaderClientWx::dispatchDidRemoveBackForwardItem): ditto. + (WebCore::FrameLoaderClientWx::dispatchDidChangeBackForwardIndex): ditto. + * WebKitSupport/FrameLoaderClientWx.h: + +2009-11-23 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + Include "config.h" to meet Coding Style Guidelines + https://bugs.webkit.org/show_bug.cgi?id=31792 + + * WebKitSupport/DragClientWx.cpp: + +2009-11-18 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Enable wx plugin support using the Windows implementation as a base. + + https://bugs.webkit.org/show_bug.cgi?id=31636 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): + (WebCore::FrameLoaderClientWx::finishedLoading): + (WebCore::FrameLoaderClientWx::committedLoad): + (WebCore::FrameLoaderClientWx::createPlugin): + (WebCore::FrameLoaderClientWx::redirectDataToPlugin): + (WebCore::FrameLoaderClientWx::shouldUsePluginDocument): + * WebKitSupport/FrameLoaderClientWx.h: + * WebView.cpp: + (wxWebView::Create): + +2009-11-13 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix after r50923 change to externalRepresentation. + + * WebFrame.cpp: + (wxWebFrame::GetExternalRepresentation): + +2009-11-13 Adam Roben <aroben@apple.com> + + Update for changes to FrameLoaderClient + + Fixes <http://webkit.org/b/31124> Tell the WebFrameLoadDelegate when + window objects in isolated worlds are cleared + + Reviewed by Dave Hyatt. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidClearWindowObjectInWorld): + * WebKitSupport/FrameLoaderClientWx.h: + Replaced windowObjectCleared with this function. Does nothing if the + passed-in world is not the mainThreadNormalWorld(). + +2009-11-10 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Add sanity checks to RunScript to ensure it doesn't run when the document hasn't yet + loaded nor when JavaScript is disabled. + + https://bugs.webkit.org/show_bug.cgi?id=31309 + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-11-04 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Fix an assert on shutdown when wxWebView has captured the mouse, + and make sure wxWebView's right click handling is only active when + the WebCore popup menu is used. + + https://bugs.webkit.org/show_bug.cgi?id=31131 + + * WebView.cpp: + (wxWebView::~wxWebView): + (wxWebView::OnContextMenuEvents): + (wxWebView::OnMenuSelectEvents): + +2009-11-04 Vadim Zeitlin <vadim@wxwidgets.org> + + Reviewed by Eric Seidel. + + [wx] Small cleanup: avoid unnecessary wxString::mb_str() calls. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + (wxWebFrame::LoadURL): + +2009-10-30 Evan Stade <estade@chromium.org> + + Reviewed by David Levin. + + Notify the chrome when the focused node has changed. + https://bugs.webkit.org/show_bug.cgi?id=30832 + + Added stub implementation for new ChromeClient function. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::focusedNodeChanged): + * WebKitSupport/ChromeClientWx.h: + +2009-10-23 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Update the globalObject calls after changes. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::windowObjectCleared): + +2009-10-21 Pedro Romano <pmcnr72@gmail.com> + + Reviewed by Kevin Ollivier. + + Include 'WebFrame.h' declared classes in wxPython bindings. + + https://bugs.webkit.org/show_bug.cgi?id=30504 + + * bindings/python/webview.i: + +2009-10-18 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add the ability to specify a proxy for wxWebKit. + + https://bugs.webkit.org/show_bug.cgi?id=30446 + + * WebView.cpp: + (curlProxyType): + (wxWebView::SetProxyInfo): + * WebView.h: + +2009-10-18 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add basic database support to wx API + + https://bugs.webkit.org/show_bug.cgi?id=30445 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::exceededDatabaseQuota): + * WebView.cpp: + (wxWebView::Create): + (wxWebView::SetDatabaseDirectory): + (wxWebView::GetDatabaseDirectory): + * WebView.h: + +2009-10-16 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Optionally allow the user to zoom text using the mouse wheel. + + https://bugs.webkit.org/show_bug.cgi?id=30444 + + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::OnMouseEvents): + * WebView.h: + +2009-10-16 Kevin Ollivier <kevino@theolliviers.com> + + wxMSW non-precomp headers build fix. + + * WebView.cpp: + +2009-10-15 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Update the wxPython simple.py sample to match current wxWebKit API. + + https://bugs.webkit.org/show_bug.cgi?id=30406 + + * bindings/python/samples/simple.py: + +2009-10-08 Adam Barth <abarth@webkit.org> + + Reviewed by Eric Seidel. + + Move executeScript from FrameLoader to ScriptController + https://bugs.webkit.org/show_bug.cgi?id=30200 + + Update API call. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + +2009-09-25 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add EmptyPluginHalterClient when creating the Page. + + * WebView.cpp: + (wxWebView::Create): + +2009-09-22 Kevin Ollivier <kevino@theolliviers.com> + + Build fix to ensure the import library gets properly installed on Windows. + + * wscript: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformPageClient): + * WebKitSupport/ChromeClientWx.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + +2009-09-16 Kevin Ollivier <kevino@theolliviers.com> + + wxPython bindings build fixes after recent changes. + + * WebView.h: + * bindings/python/wscript: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow a way to set the cache policy via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29200 + + * WebView.cpp: + (wxWebView::SetCachePolicy): + (wxWebView::GetCachePolicy): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow the user to query Frame::shouldClose via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29199 + + * WebFrame.cpp: + (wxWebFrame::ShouldClose): + * WebFrame.h: + * WebView.cpp: + (wxWebView::ShouldClose): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Fix mouse handling when the mouse leaves the window during mouse down. + + https://bugs.webkit.org/show_bug.cgi?id=29198 + + * WebView.cpp: + (wxWebView::OnMouseEvents): + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add support for console MessageLevel at wx API level. + + https://bugs.webkit.org/show_bug.cgi?id=29197 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::addMessageToConsole): + * WebView.h: + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didDisplayInsecureContent): + (WebCore::FrameLoaderClientWx::didRunInsecureContent): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-09-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Frames support + https://bugs.webkit.org/show_bug.cgi?id=19041 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + (wxWebFrame::~wxWebFrame): + (wxWebFrame::GetFrame): + * WebFrame.h: + * WebFramePrivate.h: + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformWindow): + (WebCore::ChromeClientWx::scroll): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): + (WebCore::FrameLoaderClientWx::setFrame): + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::frameLoaderDestroyed): + (WebCore::FrameLoaderClientWx::committedLoad): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientWx::createFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + * WebKitSupport/FrameLoaderClientWx.h: + * WebView.h: + * WebViewPrivate.h: + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + waf build fixes for Windows/MSVC. + + * bindings/python/wscript: + * wscript: + +2009-09-02 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + wx port: Call WTF::initializeThreading(). + https://bugs.webkit.org/show_bug.cgi?id=28912 + + * WebView.cpp: + (wxWebView::Create): call WTF::initializeThreading() + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Use the 2 param KURL constructor. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-31 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28852 + Rename KURL single argument constructor to avoid confusion + + * WebFrame.cpp: (wxWebFrame::SetPageSource): Adapt to the change. + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::scrollbarsModeDidChange): + +2009-08-19 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Use FrameLoader::load() for loading pages from a HTML page string to address + bugs with using begin/write/end loading. + + https://bugs.webkit.org/show_bug.cgi?id=28488 + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-13 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Make sure that the wxWebKit dynamic library is rebuilt whenever + webcore or jscore libs change. + + * wscript: + +2009-08-12 Kevin Ollivier <kevino@theolliviers.com> + + wxPython build fix, the SWIG defines must also be available when compiling. + + * bindings/python/wscript: + +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. + + * WebView.h: + * bindings/python/webview.i: + * bindings/python/wxwebkit-py.bkl: + * dependencies.bkl: + * presets/wxwebkit.bkl: + +2009-02-11 Dimitri Dupuis-latour <dupuislatour@apple.com> + + Stub out InspectorClientWx::hiddenPanels. + + Reviewed by Timothy Hatcher. + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::hiddenPanels): + * WebKitSupport/InspectorClientWx.h: + +2009-02-06 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::updateGlobalHistoryRedirectLinks): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-02-05 Aaron Boodman <aa@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=23708 + Adds documentElementAvailable() callback to FrameLoaderClient. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::documentElementAvailable): + Stub out documentElementAvailable(). + * WebKitSupport/FrameLoaderClientWx.h: + Ditto. + +2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::updateGlobalHistoryForRedirectWithoutHistoryItem): + (WebCore::FrameLoaderClientWx::createPlugin): + (WebCore::FrameLoaderClientWx::createJavaAppletWidget): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebFrame.cpp: + (wxWebFrame::LoadURL): + +2009-01-31 Darin Adler <darin@apple.com> + + Build fix. + + * WebView.cpp: + (wxWebView::OnSize): call sendResizeEvent on EventHandler. + +2009-01-29 David Kilzer <ddkilzer@apple.com> + + Build fix for Wx: Finish de-RefCount-ing FrameLoaderClientWx + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::ref): Removed. + (WebCore::FrameLoaderClientWx::deref): Removed. + * WebKitSupport/FrameLoaderClientWx.h: Ditto. + +2009-01-28 David Kilzer <ddkilzer@apple.com> + + Bug 23490: Remove initialRefCount argument from RefCounted class + + <https://bugs.webkit.org/show_bug.cgi?id=23490> + + Reviewed by Darin Adler. + + FrameLoaderClientWx is no longer a RefCounted class. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): Removed call + to the RefCounted<FrameLoaderClientWx>(0) super constructor. + * WebKitSupport/FrameLoaderClientWx.h: Don't include RefCounted.h + and stop inheriting from RefCounted<FrameLoaderClientWx>. + +2009-01-27 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein + + Rework FrameLoaderClient to work on a CachedFrame basis instead of CachedPage + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::savePlatformDataToCachedFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedFromCachedFrame): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-01-23 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix, add missing include dir. + + * presets/wxwebkit.bkl: + +2009-01-19 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Gavin Barraclough. + + Remove temporary operator-> from JSValuePtr. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-01-14 miggilin <mr.diggilin@gmail.com> + + Reviewed by Kevin Ollivier. + + Fixing wx compilation for wx 2.9/trunk. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + * WebView.cpp: + +2009-01-12 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. JSValue* -> JSValuePtr. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2009-01-05 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by George Staikos. + + Build fix for contentsSizeChanged + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::contentsSizeChanged): + * WebKitSupport/ChromeClientWx.h: + +2008-12-19 miggilin <mr.diggilin@gmail.com> + + Reviewed by Kevin Ollivier. + + Add Context Menu support to wx bindings. + + https://bugs.webkit.org/show_bug.cgi?id=22675 + + * WebKitSupport/ContextMenuClientWx.cpp: + (WebCore::ContextMenuClientWx::contextMenuDestroyed): + (WebCore::ContextMenuClientWx::getCustomMenuFromDefaultItems): + * WebView.cpp: + (wxWebView::OnMouseEvents): + (wxWebView::OnContextMenuEvents): + (wxWebView::OnMenuSelectEvents): + * WebView.h: + + +2008-12-19 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after recent changes. + + * presets/wxwebkit.bkl: + +2008-12-18 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + - stub out FrameLoaderClient::shouldUseCredentialStorage(). + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::shouldUseCredentialStorage): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-12-18 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Stub out FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-12-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Expose findString in wxWebView as FindString. + + https://bugs.webkit.org/show_bug.cgi?id=22458 + + * WebView.cpp: + (wxWebView::FindString): + * WebView.h: + +2008-12-09 Brett Wilson <brettw@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=22177 + + Add a callback on ChromeClient that the state of form elements on + the page has changed. This is to allow clients implementing session + saving to know when the current state is dirty. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::formStateDidChange): + +2008-12-02 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add HitTest to wxWebView (and wxWebFrame). + + https://bugs.webkit.org/show_bug.cgi?id=22459 + + * WebFrame.cpp: + (wxWebFrame::HitTest): + * WebFrame.h: + * WebView.cpp: + (wxWebView::HitTest): + * WebView.h: + +2008-11-24 Darin Fisher <darin@chromium.org> + + Fix bustage. + + http://bugs.webkit.org/show_bug.cgi?id=15643 + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isSelectTrailingWhitespaceEnabled): + * WebKitSupport/EditorClientWx.h: + +2008-11-24 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + - https://bugs.webkit.org/show_bug.cgi?id=22470 + remove unneeded URL argument from FrameLoaderClient::updateGlobalHistory + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::updateGlobalHistory): Remove argument. + * WebKitSupport/FrameLoaderClientWx.h: Ditto. + +2008-11-21 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Maintain an EditCommand stack in WebFramePrivate, and expose Undo and + Redo in wxWebView. + + https://bugs.webkit.org/show_bug.cgi?id=22403 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + (wxWebFrame::Undo): + (wxWebFrame::Redo): + (wxWebFrame::CanUndo): + (wxWebFrame::CanRedo): + * WebFrame.h: + * WebFramePrivate.h: Added. + (WebFramePrivate::WebFramePrivate): + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + * WebKitSupport/EditCommandWx.h: Added. + (EditCommandWx::EditCommandWx): + (EditCommandWx::~EditCommandWx): + (EditCommandWx::editCommand): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/EditorClientWx.h: + * WebView.cpp: + (wxWebView::OnMouseEvents): + (wxWebView::OnKeyEvents): + * WebViewPrivate.h: + +2008-11-19 Darin Fisher <darin@chromium.org> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=22345 + Define ScriptValue as a thin container for a JSC::Value*. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for JavaScriptCore renames. + + * presets/wxwebkit.bkl: + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for JavaScriptCore renames. + + * presets/wxwebkit.bkl: + +2008-11-17 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Try to fix wx build. + + * presets/wxwebkit.bkl: + +2008-11-15 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add API for setting transparent webview background. + + https://bugs.webkit.org/show_bug.cgi?id=22281 + + * WebView.cpp: + (wxWebView::SetTransparent): + (wxWebView::IsTransparent): + * WebView.h: + +2008-11-11 Cameron Zwarich <zwarich@apple.com> + + Reviewed by Geoff Garen. + + Remove pointless dependencies on the deleted kjs directory. + + * presets/wxwebkit.bkl: + +2008-11-08 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after addition of JSCore parser and bycompiler dirs. + + * presets/wxwebkit.bkl: + +2008-11-05 Cameron Zwarich <zwarich@apple.com> + + Rubber-stamped by Sam Weinig. + + Move more files to the runtime subdirectory of JavaScriptCore. + + * WebFrame.cpp: + * WebView.cpp: + +2008-10-31 Kevin Ollivier <kevino@theolliviers.com> + + wxMSW build fix. Missing header. + + * WebKitSupport/ChromeClientWx.cpp: + +2008-10-29 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after addition of runtime and ImageBuffer changes. + + * presets/wxwebkit.bkl: + +2008-10-28 Cameron Zwarich <zwarich@apple.com> + + Reviewed by Mark Rowe. + + Move ForwardingHeaders to their correct location after the creation of + the runtime directory in JavaScriptCore. + + * WebFrame.cpp: + * WebView.cpp: + +2008-10-27 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix on Linux/GTK. Enable support for #include <JavaScriptCore/XYZ.h> style includes. + + * presets/wxwebkit.bkl: + +2008-10-25 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. + + * WebKitSupport/ChromeClientWx.h: + +2008-10-24 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix https://bugs.webkit.org/show_bug.cgi?id=21759 + Layering violation: FileChooser should not depend on Document/Frame/Page + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::runOpenPanel): + * WebKitSupport/ChromeClientWx.h: + +2008-10-24 David Kilzer <ddkilzer@apple.com> + + Build fix. + + Reviewed by Greg Bolsinga. + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::populateSetting): Changed + InspectorClient:: to InspectorClientWx::. + (WebCore::InspectorClientWx::storeSetting): Ditto. + (WebCore::InspectorClientWx::removeSetting): Ditto. + +2008-10-24 Timothy Hatcher <timothy@apple.com> + + Stub out new InspectorClient methods. + + https://bugs.webkit.org/show_bug.cgi?id=21856 + + Reviewed by Darin Adler. + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClient::populateSetting): Not implemented. + (WebCore::InspectorClient::storeSetting): Ditto. + (WebCore::InspectorClient::removeSetting): Ditto. + * WebKitSupport/InspectorClientWx.h: + +2008-10-24 Darin Adler <darin@apple.com> + + - finish rolling out https://bugs.webkit.org/show_bug.cgi?id=21732 + + * WebFrame.cpp: (wxWebFrame::RunScript): Use JSValue* instead of JSValuePtr. + +2008-10-20 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Remove FrameLoaderClient::detachedFromParent4. It is no longer used by any port. + + * WebKitSupport/FrameLoaderClientWx.cpp: + * WebKitSupport/FrameLoaderClientWx.h: + +2008-10-19 Darin Adler <darin@apple.com> + + Reviewed by Oliver Hunt. + + - next step of https://bugs.webkit.org/show_bug.cgi?id=21732 + improve performance by eliminating JSValue as a base class for JSCell + + Remove most uses of JSValue, which will be removed in a future patch. + + * WebFrame.cpp: + (wxWebFrame::RunScript): Use JSValuePtr. + +2008-10-17 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier + + Fix wx port's scrollbar and drawing handling after recent changes. + + https://bugs.webkit.org/show_bug.cgi?id=21720 + + * WebView.cpp: + (wxWebView::OnPaint): + (wxWebView::OnSize): + +2008-10-09 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::repaint): + (WebCore::ChromeClientWx::scroll): + * WebKitSupport/ChromeClientWx.h: + * presets/wxwebkit.bkl: + +2008-10-06 David Hyatt <hyatt@apple.com> + + Enable viewless Mac WebKit to paint some basic pages. + + Reviewed by Sam Weinig + + * WebKitSupport/FrameLoaderClientWx.cpp: + * WebKitSupport/FrameLoaderClientWx.h: + +2008-10-03 David Hyatt <hyatt@apple.com> + + Remove addToDirtyRegion. + + Reviewed by Oliver Hunt + + * WebKitSupport/ChromeClientWx.cpp: + +2008-10-02 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after Frame/ScrollView changes. + + * WebView.cpp: + (wxWebView::OnPaint): + +2008-10-01 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=21282 + + Make contentsToScreen/screenToContents cross-platform. Only implemented by Mac/Win right now. + + Reviewed by Adam Roben + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::windowToScreen): + (WebCore::ChromeClientWx::screenToWindow): + * WebKitSupport/ChromeClientWx.h: + +2008-09-30 Dave Hyatt <hyatt@apple.com> + + http://bugs.webkit.org/show_bug.cgi?id=21250 + + Rename updateContents to repaintContentRectangle and make it cross-platform by always sending + repaints up through the ChromeClient. + + Reviewed by Darin Adler + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::repaint): + * WebKitSupport/ChromeClientWx.h: + +2008-09-26 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes after Widget/ScrollView changes. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + +2008-09-20 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Dan Bernstein. + + Fix memory leak. + + https://bugs.webkit.org/show_bug.cgi?id=20505 + + * WebView.cpp: + (wxWebView::OnPaint): + +2008-09-20 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes. Added/removed build sources, and nativeWindow->platformWidget updates. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + +2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca> + + Reviewed by Maciej Stachowiak. + + Bug 20704: Replace the KJS namespace + <https://bugs.webkit.org/show_bug.cgi?id=20704> + + Rename the KJS namespace to JSC. + + * WebFrame.cpp: + (wxWebFrame::RunScript): + +2008-09-04 Kevin Ollivier <kevino@theolliviers.com> + + wx build fixes. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::pluginWillHandleLoadError): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-08-18 Kevin Ollivier <kevino@theolliviers.com> + + Build fix for Win. Don't include the libxml/libxslt directories in the + include path, it picks up the wrong Pattern.h in that case. + + * dependencies.bkl: + +2008-08-12 Timothy Hatcher <timothy@apple.com> + + Add a stub for InspectorClient::setAttachedWindowHeight. + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::setAttachedWindowHeight): + Call notImplemented(). + * WebKitSupport/InspectorClientWx.h: + +2008-08-06 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Create a wxWebFrame API to match other ports and to prepare for frames support. + Also fixes a frame leak in wx port on trunk. + + https://bugs.webkit.org/show_bug.cgi?id=19041 + + * WebFrame.cpp: Added. + (wxWebFrame::wxWebFrame): + (wxWebFrame::~wxWebFrame): + (wxWebFrame::GetFrame): + (wxWebFrame::Stop): + (wxWebFrame::Reload): + (wxWebFrame::GetPageSource): + (wxWebFrame::SetPageSource): + (wxWebFrame::GetInnerText): + (wxWebFrame::GetAsMarkup): + (wxWebFrame::GetExternalRepresentation): + (wxWebFrame::RunScript): + (wxWebFrame::LoadURL): + (wxWebFrame::GoBack): + (wxWebFrame::GoForward): + (wxWebFrame::CanGoBack): + (wxWebFrame::CanGoForward): + (wxWebFrame::CanIncreaseTextSize): + (wxWebFrame::IncreaseTextSize): + (wxWebFrame::CanDecreaseTextSize): + (wxWebFrame::DecreaseTextSize): + (wxWebFrame::MakeEditable): + (wxWebFrame::CanCopy): + (wxWebFrame::Copy): + (wxWebFrame::CanCut): + (wxWebFrame::Cut): + (wxWebFrame::CanPaste): + (wxWebFrame::Paste): + * WebFrame.h: Added. + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::Create): + (wxWebView::~wxWebView): + (wxWebView::Stop): + (wxWebView::Reload): + (wxWebView::GetPageSource): + (wxWebView::SetPageSource): + (wxWebView::GetInnerText): + (wxWebView::GetAsMarkup): + (wxWebView::GetExternalRepresentation): + (wxWebView::RunScript): + (wxWebView::LoadURL): + (wxWebView::GoBack): + (wxWebView::GoForward): + (wxWebView::CanGoBack): + (wxWebView::CanGoForward): + (wxWebView::CanIncreaseTextSize): + (wxWebView::IncreaseTextSize): + (wxWebView::CanDecreaseTextSize): + (wxWebView::DecreaseTextSize): + (wxWebView::OnPaint): + (wxWebView::OnSize): + (wxWebView::OnMouseEvents): + (wxWebView::CanCopy): + (wxWebView::Copy): + (wxWebView::CanCut): + (wxWebView::Cut): + (wxWebView::CanPaste): + (wxWebView::Paste): + (wxWebView::OnKeyEvents): + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + * WebView.h: + * wxwebkit.bkl: + +2008-07-27 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Sam Weinig. + + Add tooltip support to the wx port. + + https://bugs.webkit.org/show_bug.cgi?id=20173 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::setToolTip): + * WebView.cpp: + (wxWebView::OnMouseEvents): Use mouseMoved instead of handleMouseMoveEvent. + +2008-07-21 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Fix pthread linkage under Linux. + + * dependencies.bkl: + +2008-06-15 Darin Adler <darin@apple.com> + + - give Frame object functions shorter names: scriptProxy() -> script(), + selectionController() -> selection(), animationController() -> animation() + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::handleKeyboardEvent): + * WebView.cpp: + (wxWebView::RunScript): + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + +2008-06-15 Darin Adler <darin@apple.com> + + - new names for a few key JavaScriptCore files + + * WebView.cpp: + +2008-06-14 Darin Adler <darin@apple.com> + + Rubber stamped by Sam. + + - new names for kjs_binding.h and kjs_proxy.h + + * WebView.cpp: + +2008-06-14 Darin Adler <darin@apple.com> + + - try to fix wx build, again + + * WebView.cpp: + (wxWebView::Create): Use create function instead of new. + +2008-06-14 Darin Adler <darin@apple.com> + + Reviewed by Sam. + + - more https://bugs.webkit.org/show_bug.cgi?id=17257 + start ref counts at 1 instead of 0 for speed + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::createDocumentLoader): Use create function + instead of new. + +2008-06-13 Darin Adler <darin@apple.com> + + - try to fix build + + * WebKitSupport/FrameLoaderClientWx.h: Add missing argument. + +2008-06-13 Darin Adler <darin@apple.com> + + Reviewed by John Sullivan. + + - updated for addition of FormState argument to action policy functions + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + +2008-06-10 Kevin Ollivier <kevino@theolliviers.com> + + wx Linux build fix. Only use -undefined dynamic_lookup flag under Mac. + + * bindings/python/wxwebkit-py.bkl: + +2008-05-28 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + This patch adds a new wx event type and code to send it when a new title is set + by the page being loaded. + + https://bugs.webkit.org/show_bug.cgi?id=19067 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidReceiveTitle): + * WebView.cpp: + (wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent): + * WebView.h: + * bindings/python/webview.i: + +2008-05-28 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + This patch tweaks the wxWebView class to make it conform to normal wx patterns + for widget classes. It adds a default ctor and the Create method so it can use + the 2-phase create pattern, adds wxRTTI macros which is important for wxPython + and XRC, and fixes the LoadURL method to pass a wxString reference to save a + copy. + + https://bugs.webkit.org/show_bug.cgi?id=19068 + + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::Create): + (wxWebView::LoadURL): + * WebView.h: + +2008-05-27 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Accidently left a couple fixes out of the previous commit. + + * presets/wxwebkit.bkl: + +2008-05-16 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Rename wxWebFrame -> wxWebBrowserShell in preparation to introduce a WebFrame + counterpart in wx port. (Frame typically means 'top level window' in wx terms.) + + https://bugs.webkit.org/show_bug.cgi?id=19041 + + * WebBrowserShell.cpp: Copied from WebKit/wx/WebFrame.cpp. + (wxWebBrowserShell::wxWebBrowserShell): + (wxWebBrowserShell::~wxWebBrowserShell): + (wxWebBrowserShell::ShowDebugMenu): + (wxWebBrowserShell::OnQuit): + (wxWebBrowserShell::OnAbout): + (wxWebBrowserShell::OnLoadFile): + (wxWebBrowserShell::OnLoadEvent): + (wxWebBrowserShell::OnBeforeLoad): + (wxWebBrowserShell::OnAddressBarEnter): + (wxWebBrowserShell::OnSearchCtrlEnter): + (wxWebBrowserShell::OnBack): + (wxWebBrowserShell::OnForward): + (wxWebBrowserShell::OnStop): + (wxWebBrowserShell::OnReload): + (wxWebBrowserShell::OnMakeTextLarger): + (wxWebBrowserShell::OnMakeTextSmaller): + (wxWebBrowserShell::OnGetSource): + (wxWebBrowserShell::OnSetSource): + (wxWebBrowserShell::OnBrowse): + (wxWebBrowserShell::OnEdit): + (wxWebBrowserShell::OnRunScript): + * WebBrowserShell.h: Copied from WebKit/wx/WebFrame.h. + * WebFrame.cpp: Removed. + * WebFrame.h: Removed. + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + * bindings/python/webview.i: + * wxwebkit.bkl: + +2008-05-20 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Update code after removal of Document::toString(). + + * WebView.cpp: + (wxWebView::GetPageSource): + +2008-05-15 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add rendering/style to includes dir. + + * presets/wxwebkit.bkl: + +2008-05-11 Kevin Ollivier <kevino@theolliviers.com> + + Previous commit made bdash sad. Restore happiness state by fixing missed style issue. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + +2008-05-11 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Fix scrolling issues by implementing transitionToCommittedNewPage() so the scroll + positions are reset when a new page is loaded, and also maintained so that back + and next restore the scroll positions as well. This also simplifies the logic + for initializing and managing wxWebView. + + https://bugs.webkit.org/show_bug.cgi?id=18992 + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::setWebView): + (WebCore::FrameLoaderClientWx::dispatchDidHandleOnloadEvents): + (WebCore::FrameLoaderClientWx::dispatchDidStartProvisionalLoad): + (WebCore::FrameLoaderClientWx::dispatchDidReceiveTitle): + (WebCore::FrameLoaderClientWx::dispatchDidCommitLoad): + (WebCore::FrameLoaderClientWx::dispatchDidFinishDocumentLoad): + (WebCore::FrameLoaderClientWx::postProgressFinishedNotification): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientWx::createFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + * WebKitSupport/FrameLoaderClientWx.h: + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::~wxWebView): + (wxWebView::GetPageSource): + (wxWebView::GetInnerText): + (wxWebView::GetExternalRepresentation): + (wxWebView::OnPaint): + (wxWebView::OnSize): + (wxWebView::OnMouseEvents): + (wxWebView::CanCopy): + (wxWebView::CanCut): + (wxWebView::CanPaste): + (wxWebView::OnKeyEvents): + * WebViewPrivate.h: + (WebViewPrivate::WebViewPrivate): + +2008-05-04 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Allow events to specify the ID of the particular wxWebView they are to be sent to. + + https://bugs.webkit.org/show_bug.cgi?id=18659 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + * WebView.cpp: + (wxWebViewLoadEvent::wxWebViewLoadEvent): + (wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent): + (wxWebViewNewWindowEvent::wxWebViewNewWindowEvent): + (wxWebViewRightClickEvent::wxWebViewRightClickEvent): + (wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent): + * WebView.h: + * bindings/python/webview.i: + +2008-04-27 Robin Dunn <robin@alldunn.com> + + Reviewed by Kevin Ollivier. + + Add methods to check if there is a previous/next page in the history. Also some + coding style cleanup. + + https://bugs.webkit.org/show_bug.cgi?id=18757 + + * WebView.cpp: + (wxWebView::GoBack): + (wxWebView::GoForward): + (wxWebView::CanGoBack): + (wxWebView::CanGoForward): + * WebView.h: + +2008-04-24 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam. + + Change some String arguments to be const references instead. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::shouldInsertText): + * WebKitSupport/EditorClientWx.h: + +2008-04-23 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Alp Toker. + + Typo fix to restore text entry. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::handleKeyboardEvent): + +2008-04-19 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. renderer() -> contentRenderer() + + * WebView.cpp: + (wxWebView::GetExternalRepresentation): + (wxWebView::OnPaint): + +2008-04-18 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. We need to use ENABLE_DOM_STORAGE now. + + * wxwk-settings.bkl: + +2008-04-05 Kevin Ollivier <kevino@theolliviers.com> + + Rubber stamped by Mark Rowe. + + Don't assume wxWebKit to be part of the wx package. This allows + us to run it from any directory on the PYTHONPATH rather than + having to copy files into the wxPython directory. + + * bindings/python/webview.i: + +2008-03-25 Brady Eidson <beidson@apple.com> + + Reviewed by Darin + + Remove newly obsolete FrameLoaderClient methods + + * WebKitSupport/FrameLoaderClientWx.cpp: + * WebKitSupport/FrameLoaderClientWx.h: + +2008-03-16 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Make sure we link png/jpeg libraries before + wx libraries to get the right symbols. + + * wxwebkit.bkl: + * wxwk-settings.bkl: + +2008-03-16 Kevin Ollivier <kevino@theolliviers.com> + + Rubber stamped by Darin Adler. + + Add set-webkit-configuration support for wx port, and centralize + build dir location setting. + + http://bugs.webkit.org/show_bug.cgi?id=17790 + + * bindings/python/wxwebkit-py.bkl: + * presets/wxwebkit.bkl: + * wxwebkit.bkl: + * wxwk-settings.bkl: + +2008-03-12 David Hyatt <hyatt@apple.com> + + Make the zoom factor a float and not a percent. + + Reviewed by antti + + * WebView.cpp: + (wxWebView::IncreaseTextSize): + (wxWebView::DecreaseTextSize): + +2008-03-03 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix after Frame::setZoomFactor API change. + + * WebView.cpp: + (wxWebView::IncreaseTextSize): + (wxWebView::DecreaseTextSize): + +2008-02-24 Darin Adler <darin@apple.com> + + Reviewed by Sam. + + - remove separate client calls for "standard" and "reload' history + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::updateGlobalHistory): + * WebKitSupport/FrameLoaderClientWx.h: + +2008-02-23 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Move text drawing into wxcode, as we need platform-dependent + APIs for drawing non-kerned text, which wx doesn't yet have. + (But hopefully will, once these APIs are fleshed out on all + platforms!) + + http://bugs.webkit.org/show_bug.cgi?id=17396 + + * wxwebkit.bkl: + We need to directly link against GDI+ on Windows since we now + directly call GDI+ APIs. + +2008-02-14 Darin Adler <darin@apple.com> + + * WebView.cpp: Removed use of DeprecatedString to keep this compiling. + +2008-02-11 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + A couple quick wx fixes. + + http://bugs.webkit.org/show_bug.cgi?id=17321 + + * WebView.cpp: + (wxWebView::OnPaint): + Make sure wxGCDC has its paint origin set properly after + the move to wxWindow for scrolling. + * bindings/python/webview.i: + Update the wxPython bindings after event rename. + +2008-02-10 Darin Adler <darin@apple.com> + + Reviewed by Eric. + + - http://bugs.webkit.org/show_bug.cgi?id=17256 + eliminate default ref. count of 0 in RefCounted class + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): + Set the count to 0 explicitly (one stray client I missed in my last pass). + +2008-02-03 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + Typo fix. Don't use the provisionalDocumentLoader() after the + whole page has already been loaded. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidHandleOnloadEvents): + +2008-02-03 Kevin Ollivier <kevino@theolliviers.com> + + Build fix for last wx commit (a couple things were not committed). + Also fix some style issues. + + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::OnPaint): + (wxWebView::OnSize): + (wxWebView::CanCopy): + (wxWebView::Copy): + (wxWebView::CanCut): + (wxWebView::Cut): + (wxWebView::CanPaste): + (wxWebView::Paste): + (wxWebView::OnKeyEvents): + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + (wxWebView::OnActivate): + * WebView.h: + +2008-01-31 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Adam Roben. + + On MSW, the wx port internally uses callbacks for wxTimer, so the + wx port suffers from the same crash problem that was fixed + in r28500 for the Windows port. For now, use the SharedTimerWin.cpp + impl. for wx too on MSW, until a version of wx is released that + fixes the issue by reworking wxTimer. + + * WebView.cpp: + (wxWebView::wxWebView): + +2008-01-21 Darin Adler <darin@apple.com> + + Reviewed by John Sullivan. + + - updated for changes to ChromeClient database functions + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::exceededDatabaseQuota): + * WebKitSupport/ChromeClientWx.h: + +2008-01-16 Adam Roben <aroben@apple.com> + + Updated for WebCore method renames. + + Reviewed by Darin Adler. + + * WebView.cpp: + (wxWebView::OnSetFocus): + (wxWebView::OnKillFocus): + (wxWebView::OnActivate): + +2008-01-12 Kevin Ollivier <kevino@theolliviers.com> + + Reviewed by Darin Adler. + + wxWebKit API changes in preparation for DRT implementation. + Specifically: + + - Add CONSOLE_MESSAGE callback so clients can choose how to handle + console messages. + - Add more load events, and rename wxWebViewStateChangedEvent to + wxWebViewLoadEvent to reflect that all 'states' are load states. + - Add wxWebView impls. for GetInnerText(), GetAsMarkup() and + GetExternalRepresentation() + + * WebFrame.cpp: + (wxWebFrame::OnLoadEvent): + * WebFrame.h: + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::ChromeClientWx): + (WebCore::ChromeClientWx::addMessageToConsole): + * WebKitSupport/ChromeClientWx.h: + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidHandleOnloadEvents): + (WebCore::FrameLoaderClientWx::dispatchDidStartProvisionalLoad): + (WebCore::FrameLoaderClientWx::dispatchDidCommitLoad): + (WebCore::FrameLoaderClientWx::dispatchDidFinishDocumentLoad): + (WebCore::FrameLoaderClientWx::postProgressFinishedNotification): + * WebView.cpp: + (wxWebViewLoadEvent::wxWebViewLoadEvent): + (wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent): + (wxWebView::wxWebView): + (wxWebView::GetPageSource): + (wxWebView::GetInnerText): + (wxWebView::GetAsMarkup): + (wxWebView::GetExternalRepresentation): + * WebView.h: + +2008-01-12 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add WebCore/icu/include dir for OS X boxes with + only stock ICU installed. + + * dependencies.bkl: + +2008-01-10 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Sam. + + - remove SecurityOriginData and fold its functionality into SecurityOrigin + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::requestQuotaIncreaseForNewDatabase): + (WebCore::ChromeClientWx::requestQuotaIncreaseForDatabaseOperation): + * WebKitSupport/ChromeClientWx.h: + +2007-12-16 Darin Adler <darin@apple.com> + + - try to fix the build + + * WebView.cpp: + (wxWebView::OnKeyEvents): Add a WebCore prefix. + +2007-12-16 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + http://bugs.webkit.org/show_bug.cgi?id=16462 + REGRESSION: access keys broken on Windows + + * WebView.cpp: (wxWebView::OnKeyEvents): Call handleAccessKey() as appropriate. + +2007-12-14 Darin Adler <darin@apple.com> + + Reviewed by Alexey. + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::handleKeyboardEvent): Switched from Editor::execCommand + to Editor::command. + +2007-12-12 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig + + As part of doing some CachedPage and client cleanup, keep Wx building + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::savePlatformDataToCachedPage): + (WebCore::FrameLoaderClientWx::transitionToCommittedFromCachedPage): + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + * WebKitSupport/FrameLoaderClientWx.h: + +2007-12-12 Sam Weinig <sam@webkit.org> + + Build fix. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::createWindow): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidStartProvisionalLoad): + (WebCore::FrameLoaderClientWx::dispatchDidCommitLoad): + (WebCore::FrameLoaderClientWx::dispatchDidFinishDocumentLoad): + (WebCore::FrameLoaderClientWx::postProgressFinishedNotification): + (WebCore::FrameLoaderClientWx::didChangeTitle): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + +2007-12-07 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + <rdar://problem/5535636> + Have to press 4 times instead of 2 times to get the expected result of ^^ with german keyboard. + + http://bugs.webkit.org/show_bug.cgi?id=13916 + JavaScript detects Tab as a character input on a textfield validation + + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::handleInputMethodKeydown): + (WebCore::EditorClientWx::handleKeyboardEvent): + * WebKitSupport/EditorClientWx.h: + Updated for cross-platform changes as much as it was possible without a wx build environment. + The keyboard event model of wx is similar to Windows one, so further fixes can be modeled + after the Windows port. + +2007-12-06 Kevin Ollivier <kevino@theolliviers.com> + + Fix page leak caused because the Frame's page pointer is 0 by the + time we call delete on it. Store a reference to the page instead + and delete it that way. + + Also, small fix to call PrepareDC(gcdc) when using wxGCDC because + on Linux the wxGCDC gcdc(dc) constructor will not retain the + changes made to dc by PrepareDC(dc). + + Reviewed by Darin Adler. + + * WebView.cpp: + (wxWebView::wxWebView): + (wxWebView::~wxWebView): + (wxWebView::OnPaint): + * WebViewPrivate.h: + (WebViewPrivate::WebViewPrivate): + +2007-12-06 Kevin Ollivier <kevino@theolliviers.com> + + Linux build fix - ensure that webcore is linked before jscore + so that the linker will know which symbols it needs to link in. + Also fix MSVC project file name typo for sample app. + + * Bakefiles.bkgen: + * wxwebkit.bkl: + +2007-12-04 Darin Adler <darin@apple.com> + + Reviewed by Kevin Decker. + + * WebKitSupport/FrameLoaderClientWx.cpp: Removed obsolete privateBrowsingEnabled. + * WebKitSupport/FrameLoaderClientWx.h: Ditto. + +2007-12-03 Mark Rowe <mrowe@apple.com> + + wx build fix. + + * WebView.cpp: + (wxWebView::RunScript): + +2007-11-30 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add WebCore/platform/graphics/wx to includes. + + * wxwebkit.bkl: + +2007-11-30 Kevin Ollivier <kevino@theolliviers.com> + + Fix method signatures to be members of ClientChromeWx class. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::requestQuotaIncreaseForNewDatabase): + (WebCore::ChromeClientWx::requestQuotaIncreaseForDatabaseOperation): + +2007-11-30 Kevin Ollivier <kevino@theolliviers.com> + + Build fix. Add platform/text to includes for targets that + need WebCore headers. + + * presets/wxwebkit.bkl: + +2007-11-29 Brady Eidson <beidson@apple.com> + + Keep it building with new client method + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClient::requestQuotaIncreaseForNewDatabase): + (WebCore::ChromeClient::requestQuotaIncreaseForDatabaseOperation): + * WebKitSupport/ChromeClientWx.h: + +2007-11-25 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Don't get xslt-config options at bake time, do it + at make time. + + * dependencies.bkl: + +2007-11-23 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Include config.h in WebFrame/WebView to ensure + WebCore headers are properly configured, fix unicode/utf8.h and + config.h include ordering issues, centralize wx project options to + ensure proper configuration, and fix wxwebkit-python target so that + it links against wx libs. + + * WebFrame.cpp: + * WebView.cpp: + * bindings/python/wxwebkit-py.bkl: + * dependencies.bkl: + * presets/wxwebkit.bkl: + * wxwebkit.bkl: + * wxwk-settings.bkl: + +2007-11-20 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix for Windows. Don't use WebCore/move-js-headers.sh as + it indiscriminately copies any headers inside JavaScriptCore, + which includes Tiger ICU headers. + + * presets/wxwebkit.bkl: + Remove WebCore/include reference and add JSCore header dirs needed + instead. + +2007-11-19 Kevin Ollivier <kevino@theolliviers.com> + + Add pcre directory to JSCore includes, and update the wx port + to reflect the Shared -> RefCounted name change. Also, fix + WebFrame.cpp to re-enable code that should never have been + committed disabled. + + Reviewed by Adam. + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::ref): + (WebCore::FrameLoaderClientWx::deref): + * WebKitSupport/FrameLoaderClientWx.h: + * presets/wxwebkit.bkl: + +2007-11-17 Timothy Hatcher <timothy@apple.com> + + Reviewed by Mark Rowe. + + Bug 13470: i18n: The Web Inspector is not localizable + http://bugs.webkit.org/show_bug.cgi?id=13470 + + * WebKitSupport/InspectorClientWx.cpp: + (WebCore::InspectorClientWx::localizedStringsURL): Empty stub. + * WebKitSupport/InspectorClientWx.h: Added localizedStringsURL. + +2007-11-08 Kevin Ollivier <kevino@theolliviers.com> + + Initial commit of wx implementation of WebKit. This includes + the wxWebFrame and wxWebView wx front end classes, the + WebKitSupport directory containing implementations of interfaces + used by WebCore to talk with the wxWebKit front end, and the + language bindings for wxWebKit (bindings dir), currently + only containing bindings and a sample app for wxPython. + + Reviewed by Mark Rowe. + + * Bakefiles.bkgen: Added. + * WebFrame.cpp: Added. + * WebFrame.h: Added. + * WebKitSupport: Added. + * WebKitSupport/ChromeClientWx.cpp: Added. + * WebKitSupport/ChromeClientWx.h: Added. + * WebKitSupport/ContextMenuClientWx.cpp: Added. + * WebKitSupport/ContextMenuClientWx.h: Added. + * WebKitSupport/DragClientWx.cpp: Added. + * WebKitSupport/DragClientWx.h: Added. + * WebKitSupport/EditorClientWx.cpp: Added. + * WebKitSupport/EditorClientWx.h: Added. + * WebKitSupport/FrameLoaderClientWx.cpp: Added. + * WebKitSupport/FrameLoaderClientWx.h: Added. + * WebKitSupport/InspectorClientWx.cpp: Added. + * WebKitSupport/InspectorClientWx.h: Added. + * WebView.cpp: Added. + * WebView.h: Added. + * WebViewPrivate.h: Added. + * bindings: Added. + * bindings/python: Added. + * bindings/python/samples: Added. + * bindings/python/samples/simple.py: Added. + * bindings/python/webview.i: Added. + * bindings/python/wxwebkit-py.bkl: Added. + * dependencies.bkl: Added. + * presets: Added. + * presets/wxwebkit.bkl: Added. + * wxwebkit.bkl: Added. + * wxwk-settings.bkl: Added. + diff --git a/Source/WebKit/wx/WebBrowserShell.cpp b/Source/WebKit/wx/WebBrowserShell.cpp new file mode 100644 index 0000000..b1ff578 --- /dev/null +++ b/Source/WebKit/wx/WebBrowserShell.cpp @@ -0,0 +1,398 @@ +/* + * 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. + * + * This class provides a default new window implementation for wxWebView clients + * who don't want/need to roll their own browser frame UI. + */ + +#include "config.h" + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "wx/artprov.h" + +#include "WebBrowserShell.h" +#include "WebFrame.h" +#include "WebView.h" +#include "WebViewPrivate.h" + +wxPageSourceViewFrame::wxPageSourceViewFrame(const wxString& source) + : wxFrame(NULL, wxID_ANY, _("Page Source View"), wxDefaultPosition, wxSize(600, 500)) +{ + wxTextCtrl* control = new wxTextCtrl(this, -1, source, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); +} + +enum { + ID_LOADFILE = wxID_HIGHEST + 1, + ID_TEXTCTRL = wxID_HIGHEST + 2, + ID_BACK = wxID_HIGHEST + 3, + ID_FORWARD = wxID_HIGHEST + 4, + ID_TOGGLE_BEFORE_LOAD = wxID_HIGHEST + 5, + ID_MAKE_TEXT_LARGER = wxID_HIGHEST + 6, + ID_MAKE_TEXT_SMALLER = wxID_HIGHEST + 7, + ID_STOP = wxID_HIGHEST + 8, + ID_RELOAD = wxID_HIGHEST + 9, + ID_GET_SOURCE = wxID_HIGHEST + 10, + ID_SET_SOURCE = wxID_HIGHEST + 11, + ID_SEARCHCTRL = wxID_HIGHEST + 12, + ID_LOADURL = wxID_HIGHEST + 13, + ID_NEW_WINDOW = wxID_HIGHEST + 14, + ID_BROWSE = wxID_HIGHEST + 15, + ID_EDIT = wxID_HIGHEST + 16, + ID_RUN_SCRIPT = wxID_HIGHEST + 17, + ID_WEBVIEW = wxID_HIGHEST + 18, + ID_EDIT_COMMAND = wxID_HIGHEST + 19, + ID_GET_EDIT_COMMAND_STATE = wxID_HIGHEST + 20 +}; + +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) + EVT_TEXT_ENTER(ID_TEXTCTRL, wxWebBrowserShell::OnAddressBarEnter) + EVT_TEXT_ENTER(ID_SEARCHCTRL, wxWebBrowserShell::OnSearchCtrlEnter) + EVT_WEBVIEW_LOAD(ID_WEBVIEW, wxWebBrowserShell::OnLoadEvent) + EVT_WEBVIEW_BEFORE_LOAD(ID_WEBVIEW, wxWebBrowserShell::OnBeforeLoad) + EVT_MENU(ID_BACK, wxWebBrowserShell::OnBack) + EVT_MENU(ID_FORWARD, wxWebBrowserShell::OnForward) + EVT_MENU(ID_STOP, wxWebBrowserShell::OnStop) + EVT_MENU(ID_RELOAD, wxWebBrowserShell::OnReload) + EVT_MENU(ID_MAKE_TEXT_LARGER, wxWebBrowserShell::OnMakeTextLarger) + EVT_MENU(ID_MAKE_TEXT_SMALLER, wxWebBrowserShell::OnMakeTextSmaller) + EVT_MENU(ID_GET_SOURCE, wxWebBrowserShell::OnGetSource) + EVT_MENU(ID_SET_SOURCE, wxWebBrowserShell::OnSetSource) + EVT_MENU(ID_BROWSE, wxWebBrowserShell::OnBrowse) + EVT_MENU(ID_EDIT, wxWebBrowserShell::OnEdit) + EVT_MENU(ID_RUN_SCRIPT, wxWebBrowserShell::OnRunScript) + EVT_MENU(ID_EDIT_COMMAND, wxWebBrowserShell::OnEditCommand) + EVT_MENU(ID_GET_EDIT_COMMAND_STATE, wxWebBrowserShell::OnGetEditCommandState) +END_EVENT_TABLE() + + +wxWebBrowserShell::wxWebBrowserShell(const wxString& title) : + wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)), + m_checkBeforeLoad(false) +{ + + // create a menu bar + wxMenu *fileMenu = new wxMenu; + fileMenu->Append(ID_NEW_WINDOW, _T("New Window\tCTRL+N")); + fileMenu->Append(ID_LOADFILE, _T("Open File...\tCTRL+O")); + fileMenu->Append(ID_LOADURL, _("Open Location...\tCTRL+L")); + fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt-X"), _T("Quit this program")); + + wxMenu *editMenu = new wxMenu; + editMenu->Append(wxID_CUT, _T("Cut\tCTRL+X")); + editMenu->Append(wxID_COPY, _T("Copy\tCTRL+C")); + editMenu->Append(wxID_PASTE, _T("Paste\tCTRL+V")); + + wxMenu* viewMenu = new wxMenu; + viewMenu->AppendRadioItem(ID_BROWSE, _("Browse")); + viewMenu->AppendRadioItem(ID_EDIT, _("Edit")); + viewMenu->AppendSeparator(); + viewMenu->Append(ID_STOP, _("Stop")); + viewMenu->Append(ID_RELOAD, _("Reload Page")); + viewMenu->Append(ID_MAKE_TEXT_SMALLER, _("Make Text Smaller\tCTRL+-")); + viewMenu->Append(ID_MAKE_TEXT_LARGER, _("Make Text Bigger\tCTRL++")); + viewMenu->AppendSeparator(); + viewMenu->Append(ID_GET_SOURCE, _("View Page Source")); + viewMenu->AppendSeparator(); + + m_debugMenu = new wxMenu; + m_debugMenu->Append(ID_SET_SOURCE, _("Test SetPageSource")); + m_debugMenu->Append(ID_RUN_SCRIPT, _("Test RunScript")); + m_debugMenu->Append(ID_EDIT_COMMAND, _("Test EditCommand::Execute")); + m_debugMenu->Append(ID_GET_EDIT_COMMAND_STATE, _("Test EditCommand::GetState")); + + // the "About" item should be in the help menu + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(wxID_ABOUT, _T("&About...\tF1"), _T("Show about dialog")); + + // now append the freshly created menu to the menu bar... + wxMenuBar *menuBar = new wxMenuBar(); + menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(editMenu, _T("&Edit")); + menuBar->Append(viewMenu, _T("&View")); + menuBar->Append(helpMenu, _T("&Help")); + + // ... and attach this menu bar to the frame + SetMenuBar(menuBar); + + wxToolBar* toolbar = CreateToolBar(); + toolbar->SetToolBitmapSize(wxSize(32, 32)); + + wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK, wxART_TOOLBAR, wxSize(32,32)); + toolbar->AddTool(ID_BACK, back, wxT("Back")); + + wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_TOOLBAR, wxSize(32,32)); + toolbar->AddTool(ID_FORWARD, forward, wxT("Next")); + + addressBar = new wxTextCtrl(toolbar, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER); + toolbar->AddControl(addressBar); + + searchCtrl = new wxSearchCtrl(toolbar, ID_SEARCHCTRL, _("Search"), wxDefaultPosition, wxSize(200, -1), wxTE_PROCESS_ENTER); + toolbar->AddControl(searchCtrl); + toolbar->Realize(); + + SetToolBar(toolbar); + + // Create the wxWebView Window + webview = new wxWebView((wxWindow*)this, ID_WEBVIEW, wxDefaultPosition, wxSize(200, 200)); + webview->SetBackgroundColour(*wxWHITE); + + // create a status bar just for fun (by default with 1 pane only) + CreateStatusBar(2); +} + +wxWebBrowserShell::~wxWebBrowserShell() +{ + if (m_debugMenu && GetMenuBar()->FindMenu(_("&Debug")) == wxNOT_FOUND) + delete m_debugMenu; +} + +void wxWebBrowserShell::ShowDebugMenu(bool show) +{ + int debugMenu = GetMenuBar()->FindMenu(_("&Debug")); + if (show && debugMenu == wxNOT_FOUND) { + int prevMenu = GetMenuBar()->FindMenu(_("&View")); + if (prevMenu != wxNOT_FOUND) + GetMenuBar()->Insert((size_t)prevMenu+1, m_debugMenu, _("&Debug")); + } + else if (!show && debugMenu != wxNOT_FOUND) { + GetMenuBar()->Remove(debugMenu); + } +} + +// event handlers + +void wxWebBrowserShell::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + // true is to force the frame to close + Close(true); +} + +void wxWebBrowserShell::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxString msg; + msg.Printf(_T("This is the About dialog of the wxWebKit sample.\n") + _T("Welcome to %s"), wxVERSION_STRING); + + wxMessageBox(msg, _T("About wxWebKit Sample"), wxOK | wxICON_INFORMATION, this); + +} + +void wxWebBrowserShell::OnLoadFile(wxCommandEvent& WXUNUSED(event)) +{ + wxFileDialog* dialog = new wxFileDialog(this, wxT("Choose a file")); + if (dialog->ShowModal() == wxID_OK) { + wxString path = dialog->GetPath().Prepend(wxT("file://")); + + if (webview) + webview->LoadURL(path); + } +} + +void wxWebBrowserShell::OnLoadEvent(wxWebViewLoadEvent& event) +{ + if (GetStatusBar() != NULL){ + if (event.GetState() == wxWEBVIEW_LOAD_NEGOTIATING) { + GetStatusBar()->SetStatusText(_("Contacting ") + event.GetURL()); + } + else if (event.GetState() == wxWEBVIEW_LOAD_TRANSFERRING) { + GetStatusBar()->SetStatusText(_("Loading ") + event.GetURL()); + } + else if (event.GetState() == wxWEBVIEW_LOAD_ONLOAD_HANDLED) { + GetStatusBar()->SetStatusText(_("Load complete.")); + addressBar->SetValue(event.GetURL()); + SetTitle(webview->GetPageTitle()); + } + else if (event.GetState() == wxWEBVIEW_LOAD_FAILED) { + GetStatusBar()->SetStatusText(_("Failed to load ") + event.GetURL()); + } + } +} + +void wxWebBrowserShell::OnBeforeLoad(wxWebViewBeforeLoadEvent& myEvent) +{ + if (m_checkBeforeLoad) { + int reply = wxMessageBox(_("Would you like to continue loading ") + myEvent.GetURL() + wxT("?"), _("Continue Loading?"), wxYES_NO); + if (reply == wxNO) { + myEvent.Cancel(); + } + } +} + +void wxWebBrowserShell::OnAddressBarEnter(wxCommandEvent& event) +{ + if (webview) + webview->LoadURL(addressBar->GetValue()); +} + +void wxWebBrowserShell::OnSearchCtrlEnter(wxCommandEvent& event) +{ + if (webview) { + webview->LoadURL(wxString::Format(wxT("http://www.google.com/search?rls=en&q=%s&ie=UTF-8&oe=UTF-8"), searchCtrl->GetValue().wc_str())); + } +} + +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) + webview->GoBack(); +} + +void wxWebBrowserShell::OnForward(wxCommandEvent& event) +{ + if (webview) + webview->GoForward(); +} + +void wxWebBrowserShell::OnStop(wxCommandEvent& myEvent) +{ + if (webview) + webview->Stop(); +} + +void wxWebBrowserShell::OnReload(wxCommandEvent& myEvent) +{ + if (webview) + webview->Reload(); +} + +void wxWebBrowserShell::OnMakeTextLarger(wxCommandEvent& myEvent) +{ + if (webview) { + if (webview->CanIncreaseTextSize()) + webview->IncreaseTextSize(); + } +} + +void wxWebBrowserShell::OnMakeTextSmaller(wxCommandEvent& myEvent) +{ + if (webview) { + if (webview->CanDecreaseTextSize()) + webview->DecreaseTextSize(); + } +} + +void wxWebBrowserShell::OnGetSource(wxCommandEvent& myEvent) +{ + if (webview) { + wxPageSourceViewFrame* pageSourceFrame = new wxPageSourceViewFrame(webview->GetPageSource()); + pageSourceFrame->Show(); + } +} + +void wxWebBrowserShell::OnSetSource(wxCommandEvent& event) +{ + if (webview) + webview->SetPageSource(wxString(wxT("<p>Hello World!</p>"))); +} + +void wxWebBrowserShell::OnBrowse(wxCommandEvent& event) +{ + if (webview) + webview->MakeEditable(!event.IsChecked()); +} + +void wxWebBrowserShell::OnEdit(wxCommandEvent& event) +{ + if (webview) + webview->MakeEditable(event.IsChecked()); +} + +void wxWebBrowserShell::OnRunScript(wxCommandEvent& myEvent) +{ + if (webview) { + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a JavaScript to exectute.")); + if (dialog->ShowModal() == wxID_OK) + wxMessageBox(wxT("Result is: ") + webview->RunScript(dialog->GetValue())); + + dialog->Destroy(); + } +} + +void wxWebBrowserShell::OnEditCommand(wxCommandEvent& myEvent) +{ + if (webview) { + if (!webview->IsEditable()) { + wxMessageBox(wxT("Please enable editing before running editing commands.")); + return; + } + + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a editing command to exectute.")); + if (dialog->ShowModal() == wxID_OK) { + bool result = webview->ExecuteEditCommand(dialog->GetValue()); + if (!result) + wxMessageBox(wxT("Editing command failed.")); + } + dialog->Destroy(); + } +} + +void wxWebBrowserShell::OnGetEditCommandState(wxCommandEvent& myEvent) +{ + if (webview) { + if (!webview->IsEditable()) { + wxMessageBox(wxT("Please enable editing before running editing commands.")); + return; + } + + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a editing command whose state you want to get.")); + if (dialog->ShowModal() == wxID_OK) { + EditState result = webview->GetEditCommandState(dialog->GetValue()); + if (result == EditStateTrue) + wxMessageBox(wxT("State is true.")); + else if (result == EditStateFalse) + wxMessageBox(wxT("State is false.")); + else if (result == EditStateMixed) + wxMessageBox(wxT("State is mixed.")); + } + dialog->Destroy(); + } +} diff --git a/Source/WebKit/wx/WebBrowserShell.h b/Source/WebKit/wx/WebBrowserShell.h new file mode 100644 index 0000000..4fe9c03 --- /dev/null +++ b/Source/WebKit/wx/WebBrowserShell.h @@ -0,0 +1,104 @@ +/* + * 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 WXWEBBROWSERSHELL_H +#define WXWEBBROWSERSHELL_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" +#include "WebView.h" +#include <wx/srchctrl.h> + +class WXDLLIMPEXP_WEBKIT wxWebBrowserShell : public wxFrame +{ +public: + // ctor(s) +#if SWIG + %pythonAppend wxWebBrowserShell "self._setOORInfo(self)" +#endif + wxWebBrowserShell(const wxString& title); + +#ifndef SWIG + ~wxWebBrowserShell(); +#endif + + void ShowDebugMenu(bool show = true); + wxWebView* webview; + +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); + void OnAddressBarEnter(wxCommandEvent& event); + void OnSearchCtrlEnter(wxCommandEvent& event); + void OnLoadEvent(wxWebViewLoadEvent& event); + void OnBeforeLoad(wxWebViewBeforeLoadEvent& event); + void OnBack(wxCommandEvent& event); + void OnForward(wxCommandEvent& event); + void OnStop(wxCommandEvent& event); + void OnReload(wxCommandEvent& event); + void OnBrowse(wxCommandEvent& event); + void OnEdit(wxCommandEvent& event); + + void OnMakeTextLarger(wxCommandEvent& event); + void OnMakeTextSmaller(wxCommandEvent& event); + void OnGetSource(wxCommandEvent& event); + + // debug menu items + void OnSetSource(wxCommandEvent& event); + void OnRunScript(wxCommandEvent& myEvent); + void OnEditCommand(wxCommandEvent& myEvent); + void OnGetEditCommandState(wxCommandEvent& myEvent); + +private: + wxTextCtrl* addressBar; + wxSearchCtrl* searchCtrl; + + bool m_checkBeforeLoad; + wxMenu* m_debugMenu; + // any class wishing to process wxWindows events must use this macro +#ifndef SWIG + DECLARE_EVENT_TABLE() +#endif +}; + +class WXDLLIMPEXP_WEBKIT wxPageSourceViewFrame : public wxFrame +{ +public: + wxPageSourceViewFrame(const wxString& source); +}; + +#endif // ifndef WXWEBBROWSERSHELL_H diff --git a/Source/WebKit/wx/WebDOMSelection.cpp b/Source/WebKit/wx/WebDOMSelection.cpp new file mode 100644 index 0000000..ce35ea4 --- /dev/null +++ b/Source/WebKit/wx/WebDOMSelection.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2008 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 "WebDOMSelection.h" + +#include "Element.h" +#include "SelectionController.h" +#include "WebDOMElement.h" +#include "WebDOMRange.h" + +#include <wtf/RefPtr.h> + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +IMPLEMENT_DYNAMIC_CLASS(wxWebKitSelection, wxObject) + +wxWebKitSelection::wxWebKitSelection(const wxWebKitSelection& other) +{ + m_selection = other.m_selection; +} + +WebDOMElement* wxWebKitSelection::GetRootEditableElement() const +{ + if (m_selection) + return new WebDOMElement(m_selection->rootEditableElement()); + + return 0; +} + +WebDOMRange* wxWebKitSelection::GetAsRange() +{ + if (m_selection) { + WTF::RefPtr<WebCore::Range> range = m_selection->toNormalizedRange(); + // keep it alive until it reaches wxWebKitDOMRange, which takes ownership + + if (range) { + range->ref(); + return new WebDOMRange(range.get()); + } + } + + return 0; +} diff --git a/Source/WebKit/wx/WebDOMSelection.h b/Source/WebKit/wx/WebDOMSelection.h new file mode 100644 index 0000000..f9a2aa5 --- /dev/null +++ b/Source/WebKit/wx/WebDOMSelection.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2008 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 WebDOMSelection_h +#define WebDOMSelection_h + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +class WebDOMElement; +class WebDOMRange; + +namespace WebCore { + +class SelectionController; + +} + +class WXDLLIMPEXP_WEBKIT wxWebKitSelection : public wxObject { +#ifndef SWIG +DECLARE_DYNAMIC_CLASS(wxWebKitDOMSelection) +#endif + +public: + wxWebKitSelection() {} + wxWebKitSelection(WebCore::SelectionController* selection) + : m_selection(selection) + { } + + wxWebKitSelection(const wxWebKitSelection&); + ~wxWebKitSelection() { m_selection = 0; } + + WebDOMElement* GetRootEditableElement() const; + WebDOMRange* GetAsRange(); + +private: + WebCore::SelectionController* m_selection; + +}; + +#endif diff --git a/Source/WebKit/wx/WebEdit.cpp b/Source/WebKit/wx/WebEdit.cpp new file mode 100644 index 0000000..33b4c86 --- /dev/null +++ b/Source/WebKit/wx/WebEdit.cpp @@ -0,0 +1,80 @@ + + +#include "config.h" +#include "WebEdit.h" + +#include "CompositeEditCommand.h" +#include "Document.h" +#include "Frame.h" +#include "HTMLNames.h" +#include "QualifiedName.h" +#include "StringImpl.h" + +#include "WebFrame.h" +#include "WebDOMElement.h" +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class WebCoreEditCommand: public CompositeEditCommand +{ +public: + WebCoreEditCommand(WebCore::Document* document) + : CompositeEditCommand(document) + { } + + void setElementAttribute(PassRefPtr<Element> element, const QualifiedName& attribute, const AtomicString& value) + { + setNodeAttribute(element, attribute, value); + } + // composite commands are applied as they are added, so we don't + // need doApply to do anything. + virtual void doApply() {} +}; + +} + +class WebCoreEditCommandPrivate { +public: + WebCoreEditCommandPrivate() + : m_ptr(0) + { } + + WebCoreEditCommandPrivate(WebCore::WebCoreEditCommand* ptr) + : m_ptr(adoptRef(ptr)) + { } + + ~WebCoreEditCommandPrivate() { } + + WebCore::WebCoreEditCommand* command() { return m_ptr.get(); } + + RefPtr<WebCore::WebCoreEditCommand> m_ptr; +}; + +wxWebEditCommand::wxWebEditCommand(wxWebFrame* webframe) +{ + if (webframe) { + WebCore::Frame* frame = webframe->GetFrame(); + if (frame && frame->document()) + m_impl = new WebCoreEditCommandPrivate(new WebCore::WebCoreEditCommand(frame->document())); + } +} + +wxWebEditCommand::~wxWebEditCommand() +{ + // the impl. is ref-counted, so don't delete it as it may be in an undo/redo stack + delete m_impl; + m_impl = 0; +} + +void wxWebEditCommand::SetNodeAttribute(WebDOMElement* element, const wxString& name, const wxString& value) +{ + if (m_impl && m_impl->command()) + m_impl->command()->setElementAttribute(element->impl(), WebCore::QualifiedName(WTF::nullAtom, WTF::String(name), WTF::nullAtom), WTF::String(value)); +} + +void wxWebEditCommand::Apply() +{ + if (m_impl && m_impl->command()) + m_impl->command()->apply(); +} diff --git a/Source/WebKit/wx/WebEdit.h b/Source/WebKit/wx/WebEdit.h new file mode 100644 index 0000000..e4bba91 --- /dev/null +++ b/Source/WebKit/wx/WebEdit.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2009 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 WXWEBEDIT_H +#define WXWEBEDIT_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +namespace WebCore { + class CompositeEditCommand; + class WebCoreEditCommand; +} + +class WebDOMElement; +class WebCoreEditCommandPrivate; +class wxWebFrame; + +class WXDLLIMPEXP_WEBKIT wxWebEditCommand +{ + friend class WebCore::CompositeEditCommand; + friend class WebCore::WebCoreEditCommand; + +public: + wxWebEditCommand(wxWebFrame*); + ~wxWebEditCommand(); + + void SetNodeAttribute(WebDOMElement*, const wxString&, const wxString&); + void Apply(); + +private: + WebCoreEditCommandPrivate* m_impl; +}; + +#endif diff --git a/Source/WebKit/wx/WebFrame.cpp b/Source/WebKit/wx/WebFrame.cpp new file mode 100644 index 0000000..1d5f03a --- /dev/null +++ b/Source/WebKit/wx/WebFrame.cpp @@ -0,0 +1,491 @@ +/* + * 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 "Document.h" +#include "Editor.h" +#include "Element.h" +#include "EventHandler.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HitTestResult.h" +#include "HostWindow.h" +#include "HTMLFrameOwnerElement.h" +#include "markup.h" +#include "Page.h" +#include "PlatformString.h" +#include "RenderTreeAsText.h" +#include "RenderObject.h" +#include "RenderView.h" +#include "ScriptController.h" +#include "ScriptValue.h" +#include "SubstituteData.h" +#include "TextEncoding.h" + +#include "JSDOMBinding.h" +#include <runtime/JSValue.h> +#include <runtime/UString.h> +#include <wtf/text/CString.h> + +#include "EditorClientWx.h" +#include "FrameLoaderClientWx.h" + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebDOMNode.h" + +#include "WebDOMSelection.h" +#include "WebFrame.h" +#include "WebView.h" +#include "WebFramePrivate.h" +#include "WebViewPrivate.h" + +#include <wx/defs.h> +#include <wx/dcbuffer.h> + +// Match Safari's min/max zoom sizes by default +#define MinimumTextSizeMultiplier 0.5f +#define MaximumTextSizeMultiplier 3.0f +#define TextSizeMultiplierRatio 1.2f + +wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameData* data) : + m_textMagnifier(1.0), + m_isEditable(false), + m_isInitialized(false), + m_beingDestroyed(false) +{ + + m_impl = new WebFramePrivate(); + + WebCore::HTMLFrameOwnerElement* parentFrame = 0; + + if (data) { + parentFrame = data->ownerElement; + } + + WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); + RefPtr<WebCore::Frame> newFrame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); + + m_impl->frame = newFrame.get(); + + if (data) + newFrame->tree()->setName(data->name); + + // Subframes expect to be added to the FrameTree before init is called. + if (parentFrame) + parentFrame->document()->frame()->tree()->appendChild(newFrame.get()); + + loaderClient->setFrame(this); + loaderClient->setWebView(container); + + if (data && data->ownerElement) + m_impl->frame->ref(); + + m_impl->frame->init(); + + m_isInitialized = true; +} + +wxWebFrame::~wxWebFrame() +{ + if (m_impl) + delete m_impl; +} + +WebCore::Frame* wxWebFrame::GetFrame() +{ + if (m_impl) + return m_impl->frame; + + return 0; +} + +void wxWebFrame::Stop() +{ + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->stop(); +} + +void wxWebFrame::Reload() +{ + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->reload(); +} + +wxString wxWebFrame::GetPageSource() +{ + if (m_impl->frame) { + if (m_impl->frame->view() && m_impl->frame->view()->layoutPending()) + m_impl->frame->view()->layout(); + + WebCore::Document* doc = m_impl->frame->document(); + + if (doc) { + wxString source = createMarkup(doc); + return source; + } + } + return wxEmptyString; +} + +void wxWebFrame::SetPageSource(const wxString& source, const wxString& baseUrl, const wxString& mimetype) +{ + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::KURL url(WebCore::KURL(), baseUrl); + + const wxCharBuffer charBuffer(source.utf8_str()); + const char* contents = charBuffer; + + WTF::PassRefPtr<WebCore::SharedBuffer> sharedBuffer = WebCore::SharedBuffer::create(contents, strlen(contents)); + WebCore::SubstituteData substituteData(sharedBuffer, mimetype, WTF::String("UTF-8"), WebCore::blankURL(), url); + + m_impl->frame->loader()->stop(); + m_impl->frame->loader()->load(WebCore::ResourceRequest(url), substituteData, false); + } +} + +wxString wxWebFrame::GetInnerText() +{ + if (m_impl->frame->view() && m_impl->frame->view()->layoutPending()) + m_impl->frame->view()->layout(); + + WebCore::Element *documentElement = m_impl->frame->document()->documentElement(); + return documentElement->innerText(); +} + +wxString wxWebFrame::GetAsMarkup() +{ + if (!m_impl->frame || !m_impl->frame->document()) + return wxEmptyString; + + return createMarkup(m_impl->frame->document()); +} + +wxString wxWebFrame::GetExternalRepresentation() +{ + if (m_impl->frame->view() && m_impl->frame->view()->layoutPending()) + m_impl->frame->view()->layout(); + + return externalRepresentation(m_impl->frame); +} + +wxString wxWebFrame::GetSelectionAsHTML() +{ + if (m_impl->frame) + return m_impl->frame->selection()->toNormalizedRange()->toHTML(); + + return wxEmptyString; +} + +wxString wxWebFrame::GetSelectionAsText() +{ + if (m_impl->frame) + return m_impl->frame->selection()->toNormalizedRange()->text(); + + return wxEmptyString; +} + +wxWebKitSelection wxWebFrame::GetSelection() +{ + if (m_impl->frame) + return wxWebKitSelection(m_impl->frame->selection()); + + return 0; +} + +wxString wxWebFrame::RunScript(const wxString& javascript) +{ + wxString returnValue = wxEmptyString; + if (m_impl->frame && m_impl->frame->loader()) { + bool hasLoaded = m_impl->frame->loader()->frameHasLoaded(); + wxASSERT_MSG(hasLoaded, wxT("Document must be loaded before calling RunScript.")); + if (hasLoaded) { + WebCore::ScriptController* controller = m_impl->frame->script(); + bool jsEnabled = controller->canExecuteScripts(WebCore::AboutToExecuteScript); + wxASSERT_MSG(jsEnabled, wxT("RunScript requires JavaScript to be enabled.")); + if (jsEnabled) { + JSC::JSValue result = controller->executeScript(javascript, true).jsValue(); + if (result) + returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).utf8().data(), wxConvUTF8); + } + } + } + return returnValue; +} + +bool wxWebFrame::ExecuteEditCommand(const wxString& command, const wxString& parameter) +{ + if (m_impl->frame && IsEditable()) + return m_impl->frame->editor()->command(command).execute(parameter); +} + +EditState wxWebFrame::GetEditCommandState(const wxString& command) const +{ + if (m_impl->frame && IsEditable()) { + WebCore::TriState state = m_impl->frame->editor()->command(command).state(); + if (state == WebCore::TrueTriState) + return EditStateTrue; + if (state == WebCore::FalseTriState) + return EditStateFalse; + + return EditStateMixed; + } + + return EditStateFalse; +} + +wxString wxWebFrame::GetEditCommandValue(const wxString& command) const +{ + if (m_impl->frame && IsEditable()) + return m_impl->frame->editor()->command(command).value(); + + return wxEmptyString; +} + + +bool wxWebFrame::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) +{ + if (m_impl->frame) + return m_impl->frame->editor()->findString(string, forward, caseSensitive, wrapSelection, startInSelection); + + return false; +} + +void wxWebFrame::LoadURL(const wxString& url) +{ + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::KURL kurl = WebCore::KURL(WebCore::KURL(), url, WebCore::UTF8Encoding()); + // NB: This is an ugly fix, but CURL won't load sub-resources if the + // protocol is omitted; sadly, it will not emit an error, either, so + // there's no way for us to catch this problem the correct way yet. + if (kurl.protocol().isEmpty()) { + // is it a file on disk? + if (wxFileExists(url)) { + kurl.setProtocol("file"); + kurl.setPath("//" + kurl.path()); + } + else { + kurl.setProtocol("http"); + kurl.setPath("//" + kurl.path()); + } + } + m_impl->frame->loader()->load(kurl, false); + } +} + +bool wxWebFrame::GoBack() +{ + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->goBack(); + + return false; +} + +bool wxWebFrame::GoForward() +{ + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->goForward(); + + return false; +} + +bool wxWebFrame::CanGoBack() +{ + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->canGoBackOrForward(-1); + + return false; +} + +bool wxWebFrame::CanGoForward() +{ + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->canGoBackOrForward(1); + + return false; +} + +void wxWebFrame::Undo() +{ + if (m_impl->frame && m_impl->frame->editor() && CanUndo()) + return m_impl->frame->editor()->undo(); +} + +void wxWebFrame::Redo() +{ + if (m_impl->frame && m_impl->frame->editor() && CanRedo()) + return m_impl->frame->editor()->redo(); +} + +bool wxWebFrame::CanUndo() +{ + if (m_impl->frame && m_impl->frame->editor()) + return m_impl->frame->editor()->canUndo(); + + return false; +} + +bool wxWebFrame::CanRedo() +{ + if (m_impl->frame && m_impl->frame->editor()) + return m_impl->frame->editor()->canRedo(); + + return false; +} + +bool wxWebFrame::CanIncreaseTextSize() const +{ + if (m_impl->frame && m_impl->frame->view()) { + if (m_textMagnifier*TextSizeMultiplierRatio <= MaximumTextSizeMultiplier) + return true; + } + return false; +} + +void wxWebFrame::IncreaseTextSize() +{ + if (CanIncreaseTextSize()) { + m_textMagnifier = m_textMagnifier*TextSizeMultiplierRatio; + m_impl->frame->setTextZoomFactor(m_textMagnifier); + } +} + +bool wxWebFrame::CanDecreaseTextSize() const +{ + if (m_impl->frame && m_impl->frame->view()) { + if (m_textMagnifier/TextSizeMultiplierRatio >= MinimumTextSizeMultiplier) + return true; + } + return false; +} + +void wxWebFrame::DecreaseTextSize() +{ + if (CanDecreaseTextSize()) { + m_textMagnifier = m_textMagnifier/TextSizeMultiplierRatio; + m_impl->frame->setTextZoomFactor(m_textMagnifier); + } +} + +void wxWebFrame::ResetTextSize() +{ + m_textMagnifier = 1.0; + if (m_impl->frame) + m_impl->frame->setTextZoomFactor(m_textMagnifier); +} + +void wxWebFrame::MakeEditable(bool enable) +{ + m_isEditable = enable; +} + + + +bool wxWebFrame::CanCopy() +{ + if (m_impl->frame && m_impl->frame->view()) + return (m_impl->frame->editor()->canCopy() || m_impl->frame->editor()->canDHTMLCopy()); + + return false; +} + +void wxWebFrame::Copy() +{ + if (CanCopy()) + m_impl->frame->editor()->copy(); +} + +bool wxWebFrame::CanCut() +{ + if (m_impl->frame && m_impl->frame->view()) + return (m_impl->frame->editor()->canCut() || m_impl->frame->editor()->canDHTMLCut()); + + return false; +} + +void wxWebFrame::Cut() +{ + if (CanCut()) + m_impl->frame->editor()->cut(); +} + +bool wxWebFrame::CanPaste() +{ + if (m_impl->frame && m_impl->frame->view()) + return (m_impl->frame->editor()->canPaste() || m_impl->frame->editor()->canDHTMLPaste()); + + return false; +} + +void wxWebFrame::Paste() +{ + if (CanPaste()) + m_impl->frame->editor()->paste(); + +} + +wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const +{ + wxWebViewDOMElementInfo domInfo; + + if (m_impl->frame->view()) { + WebCore::HitTestResult result = m_impl->frame->eventHandler()->hitTestResultAtPoint(m_impl->frame->view()->windowToContents(pos), false); + if (result.innerNode()) { + domInfo.SetLink(result.absoluteLinkURL().string()); + domInfo.SetText(result.textContent()); + domInfo.SetImageSrc(result.absoluteImageURL().string()); + domInfo.SetSelected(result.isSelected()); + } + } + + return domInfo; +} + +bool wxWebFrame::ShouldClose() const +{ + if (m_impl->frame) + return m_impl->frame->loader()->shouldClose(); + + return true; +} + +wxWebKitCompatibilityMode wxWebFrame::GetCompatibilityMode() const +{ + if (m_impl->frame && m_impl->frame->document()) + return (wxWebKitCompatibilityMode)m_impl->frame->document()->compatibilityMode(); + + return QuirksMode; +} + +void wxWebFrame::GrantUniversalAccess() +{ + if (m_impl->frame && m_impl->frame->document()) + m_impl->frame->document()->securityOrigin()->grantUniversalAccess(); +} diff --git a/Source/WebKit/wx/WebFrame.h b/Source/WebKit/wx/WebFrame.h new file mode 100644 index 0000000..3e9355a --- /dev/null +++ b/Source/WebKit/wx/WebFrame.h @@ -0,0 +1,183 @@ +/* + * 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 WXWEBFRAME_H +#define WXWEBFRAME_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +class WebDOMElement; +class WebDOMNode; + +#include "WebDOMSelection.h" + +class Element; + +class WebFramePrivate; +class WebViewFrameData; +class wxWebView; + +namespace WebCore { + class ChromeClientWx; + class EditorClientWx; + class FrameLoaderClientWx; + class Frame; +} + +class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo +{ +public: + wxWebViewDOMElementInfo(); + wxWebViewDOMElementInfo(const wxWebViewDOMElementInfo& other); + + ~wxWebViewDOMElementInfo(); + + wxString GetTagName() const { return m_tagName; } + void SetTagName(const wxString& name) { m_tagName = name; } + + bool IsSelected() const { return m_isSelected; } + void SetSelected(bool sel) { m_isSelected = sel; } + + wxString GetText() const { return m_text; } + void SetText(const wxString& text) { m_text = text; } + + wxString GetImageSrc() const { return m_imageSrc; } + void SetImageSrc(const wxString& src) { m_imageSrc = src; } + + wxString GetLink() const { return m_link; } + void SetLink(const wxString& link) { m_link = link; } + + WebDOMNode* GetInnerNode() { return m_innerNode; } + void SetInnerNode(WebDOMNode* node) { m_innerNode = node; } + + WebDOMElement* GetURLElement() { return m_urlElement; } + void SetURLElement(WebDOMElement* url) { m_urlElement = url; } + +private: + WebDOMNode* m_innerNode; + WebDOMElement* m_urlElement; + bool m_isSelected; + wxString m_tagName; + wxString m_text; + wxString m_imageSrc; + wxString m_link; +}; + +// based on enums in WebCore/dom/Document.h +enum wxWebKitCompatibilityMode { QuirksMode, LimitedQuirksMode, NoQuirksMode }; + +class WXDLLIMPEXP_WEBKIT wxWebFrame +{ +public: + // ChromeClientWx needs to get the Page* stored by the wxWebView + // for the createWindow function. + friend class WebCore::ChromeClientWx; + friend class WebCore::FrameLoaderClientWx; + friend class WebCore::EditorClientWx; + friend class wxWebView; + +public: + wxWebFrame(wxWebView* container, wxWebFrame* parent = NULL, WebViewFrameData* data = NULL); + + ~wxWebFrame(); + + void LoadURL(const wxString& url); + bool GoBack(); + bool GoForward(); + void Stop(); + void Reload(); + + bool CanGoBack(); + bool CanGoForward(); + + bool CanCut(); + bool CanCopy(); + bool CanPaste(); + + void Cut(); + void Copy(); + void Paste(); + + bool CanUndo(); + bool CanRedo(); + + void Undo(); + void Redo(); + + wxString GetPageSource(); + void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString, const wxString& mimetype = wxT("text/html")); + + wxString GetInnerText(); + wxString GetAsMarkup(); + wxString GetExternalRepresentation(); + + wxWebKitSelection GetSelection(); + wxString GetSelectionAsHTML(); + wxString GetSelectionAsText(); + + wxString RunScript(const wxString& javascript); + bool ExecuteEditCommand(const wxString& command, const wxString& parameter = wxEmptyString); + EditState GetEditCommandState(const wxString& command) const; + wxString GetEditCommandValue(const wxString& command) const; + + bool FindString(const wxString& string, bool forward = true, + bool caseSensitive = false, bool wrapSelection = true, + bool startInSelection = true); + + bool CanIncreaseTextSize() const; + void IncreaseTextSize(); + bool CanDecreaseTextSize() const; + void DecreaseTextSize(); + void ResetTextSize(); + void MakeEditable(bool enable); + bool IsEditable() const { return m_isEditable; } + + WebCore::Frame* GetFrame(); + + wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; + + bool ShouldClose() const; + + wxWebKitCompatibilityMode GetCompatibilityMode() const; + + void GrantUniversalAccess(); + +private: + float m_textMagnifier; + bool m_isEditable; + bool m_isInitialized; + bool m_beingDestroyed; + WebFramePrivate* m_impl; + +}; + +#endif // ifndef WXWEBFRAME_H diff --git a/Source/WebKit/wx/WebFramePrivate.h b/Source/WebKit/wx/WebFramePrivate.h new file mode 100644 index 0000000..bee461d --- /dev/null +++ b/Source/WebKit/wx/WebFramePrivate.h @@ -0,0 +1,60 @@ +/* + * 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 WXWEBFRAMEPRIVATE_H +#define WXWEBFRAMEPRIVATE_H + +#include "config.h" +#include "Frame.h" +#include "HTMLFrameOwnerElement.h" +#include "KURL.h" + +class WebFramePrivate { + +public: + WebFramePrivate() : + frame(0) + {} + + WebCore::Frame* frame; +}; + +class WebViewFrameData +{ +public: + WebCore::KURL url; + WTF::String name; + WebCore::HTMLFrameOwnerElement* ownerElement; + + WTF::String referrer; + bool allowsScrolling; + int marginWidth; + int marginHeight; +}; + +#endif diff --git a/Source/WebKit/wx/WebKitDefines.h b/Source/WebKit/wx/WebKitDefines.h new file mode 100644 index 0000000..66e4216 --- /dev/null +++ b/Source/WebKit/wx/WebKitDefines.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008 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 WebKitDefines_h +#define WebKitDefines_h + +#ifndef SWIG + +#if !wxCHECK_VERSION(2, 9, 0) && wxCHECK_GCC_VERSION(4, 0) +#define WXDLLIMPEXP_WEBKIT __attribute__ ((visibility("default"))) +#elif defined(WXMAKINGDLL_WEBKIT) +#define WXDLLIMPEXP_WEBKIT WXEXPORT +#else +#define WXDLLIMPEXP_WEBKIT WXIMPORT +#endif + +#else +#define WXDLLIMPEXP_WEBKIT +#endif // SWIG + +// enums +enum EditState { EditStateTrue, EditStateFalse, EditStateMixed }; + +#endif // WebKitDefines_h 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) diff --git a/Source/WebKit/wx/WebSettings.cpp b/Source/WebKit/wx/WebSettings.cpp new file mode 100644 index 0000000..9317546 --- /dev/null +++ b/Source/WebKit/wx/WebSettings.cpp @@ -0,0 +1,180 @@ +/* + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebSettings.h" + +#include "PlatformString.h" +#include "Settings.h" + +void wxWebSettings::SetDefaultFixedFontSize(int size) +{ + if (m_settings) + m_settings->setDefaultFixedFontSize(size); +} + +int wxWebSettings::GetDefaultFixedFontSize() const +{ + if (m_settings) + return m_settings->defaultFixedFontSize(); + + return 0; +} + +void wxWebSettings::SetDefaultFontSize(int size) +{ + if (m_settings) + m_settings->setDefaultFontSize(size); +} + +int wxWebSettings::GetDefaultFontSize() const +{ + if (m_settings) + return m_settings->defaultFontSize(); + + return 0; +} + +void wxWebSettings::SetMinimumFontSize(int size) +{ + if (m_settings) + m_settings->setMinimumFontSize(size); +} + +int wxWebSettings::GetMinimumFontSize() const +{ + if (m_settings) + return m_settings->minimumFontSize(); + + return 0; +} + +void wxWebSettings::SetLoadsImagesAutomatically(bool loadAutomatically) +{ + if (m_settings) + m_settings->setLoadsImagesAutomatically(loadAutomatically); +} + +bool wxWebSettings::LoadsImagesAutomatically() const +{ + if (m_settings) + return m_settings->loadsImagesAutomatically(); + + return false; +} + +void wxWebSettings::SetJavaScriptEnabled(bool enabled) +{ + if (m_settings) + m_settings->setJavaScriptEnabled(enabled); +} + +bool wxWebSettings::IsJavaScriptEnabled() const +{ + if (m_settings) + return m_settings->isJavaScriptEnabled(); + + return false; +} + +void wxWebSettings::SetLocalStoragePath(const wxString& path) +{ + if (m_settings) + m_settings->setLocalStorageDatabasePath(path); +} + +wxString wxWebSettings::GetLocalStoragePath() const +{ + if (m_settings) + return m_settings->localStorageDatabasePath(); + + return wxEmptyString; +} + +void wxWebSettings::SetEditableLinkBehavior(wxEditableLinkBehavior behavior) +{ + WebCore::EditableLinkBehavior webCoreBehavior; + if (m_settings) { + switch (behavior) { + case wxEditableLinkAlwaysLive: + webCoreBehavior = WebCore::EditableLinkAlwaysLive; + break; + case wxEditableLinkOnlyLiveWithShiftKey: + webCoreBehavior = WebCore::EditableLinkOnlyLiveWithShiftKey; + break; + case wxEditableLinkLiveWhenNotFocused: + webCoreBehavior = WebCore::EditableLinkLiveWhenNotFocused; + break; + case wxEditableLinkNeverLive: + webCoreBehavior = WebCore::EditableLinkNeverLive; + break; + default: + webCoreBehavior = WebCore::EditableLinkDefaultBehavior; + } + m_settings->setEditableLinkBehavior(webCoreBehavior); + } +} + +wxEditableLinkBehavior wxWebSettings::GetEditableLinkBehavior() const +{ + wxEditableLinkBehavior behavior = wxEditableLinkDefaultBehavior; + if (m_settings) { + WebCore::EditableLinkBehavior webCoreBehavior = m_settings->editableLinkBehavior(); + switch (webCoreBehavior) { + case WebCore::EditableLinkAlwaysLive: + behavior = wxEditableLinkAlwaysLive; + break; + case WebCore::EditableLinkOnlyLiveWithShiftKey: + behavior = wxEditableLinkOnlyLiveWithShiftKey; + break; + case WebCore::EditableLinkLiveWhenNotFocused: + behavior = wxEditableLinkLiveWhenNotFocused; + break; + case WebCore::EditableLinkNeverLive: + behavior = wxEditableLinkNeverLive; + break; + default: + behavior = wxEditableLinkDefaultBehavior; + } + } + return behavior; +} + +void wxWebSettings::SetPluginsEnabled(bool enabled) +{ + if (m_settings) + m_settings->setPluginsEnabled(enabled); +} + +bool wxWebSettings::ArePluginsEnabled() const +{ + if (m_settings) + return m_settings->arePluginsEnabled(); + + return false; +} diff --git a/Source/WebKit/wx/WebSettings.h b/Source/WebKit/wx/WebSettings.h new file mode 100644 index 0000000..9ab5502 --- /dev/null +++ b/Source/WebKit/wx/WebSettings.h @@ -0,0 +1,158 @@ +/* + * 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. + * 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 WebSettings_h +#define WebSettings_h + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" + +namespace WebCore { +class Settings; +} + +enum wxEditableLinkBehavior { + wxEditableLinkDefaultBehavior, + wxEditableLinkAlwaysLive, + wxEditableLinkOnlyLiveWithShiftKey, + wxEditableLinkLiveWhenNotFocused, + wxEditableLinkNeverLive +}; + +/** + @class wxWebSettings + + This class is used to control the configurable aspects of the WebKit engine. + + Do not instantiate this object directly. Instead, create a wxWebView and + call its wxWebView::GetWebSettings() method to get and change that WebView's settings. + +*/ + +class WXDLLIMPEXP_WEBKIT wxWebSettings: public wxObject { +public: + wxWebSettings(WebCore::Settings* settings) : + wxObject(), + m_settings(settings) + {} + + wxWebSettings() : wxObject() {} + + virtual ~wxWebSettings() { } + + /** + Sets the default font size for fixed fonts. + */ + void SetDefaultFixedFontSize(int size); + + /** + Returns the default font size for fixed fonts. + */ + int GetDefaultFixedFontSize() const; + + /** + Sets the default font size for fonts. + */ + void SetDefaultFontSize(int size); + + /** + Returns the default font size for fonts. + */ + int GetDefaultFontSize() const; + + /** + Sets the minimum acceptable font size. + */ + void SetMinimumFontSize(int size); + + /** + Returns the minimum acceptable font size. + */ + int GetMinimumFontSize() const; + + /** + Sets whether or not images are loaded automatically. (e.g. in email + programs you may wish to not load images until you confirm it is not SPAM) + */ + void SetLoadsImagesAutomatically(bool loadAutomatically); + + /** + Returns whether or not images are loaded automatically. + */ + bool LoadsImagesAutomatically() const; + + /** + Sets whether or not the WebView runs JavaScript code. + */ + void SetJavaScriptEnabled(bool enabled); + + /** + Returns whether or not the WebView runs JavaScript code. + */ + bool IsJavaScriptEnabled() const; + + /** + Sets the path where local data will be stored. + */ + void SetLocalStoragePath(const wxString& path); + + /** + Returns the path where local data will be stored. + */ + wxString GetLocalStoragePath() const; + + /** + Sets how links are handled when the wxWebView is in editing mode. + */ + void SetEditableLinkBehavior(wxEditableLinkBehavior behavior); + + /** + Returns how links are handled when the wxWebView is in editing mode. + */ + wxEditableLinkBehavior GetEditableLinkBehavior() const; + + /** + Sets whether or not web pages can load plugins. + */ + void SetPluginsEnabled(bool enabled); + + /** + Returns whether or not web pages can load plugins. + */ + bool ArePluginsEnabled() const; + +private: + WebCore::Settings* m_settings; + +}; + +#endif // WebSettings_h diff --git a/Source/WebKit/wx/WebView.cpp b/Source/WebKit/wx/WebView.cpp new file mode 100644 index 0000000..0df3879 --- /dev/null +++ b/Source/WebKit/wx/WebView.cpp @@ -0,0 +1,1160 @@ +/* + * 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 "WebView.h" + +#include "ContextMenu.h" +#include "ContextMenuController.h" +#include "ContextMenuItem.h" +#include "Document.h" +#include "Editor.h" +#include "Element.h" +#include "EmptyClients.h" +#include "EventHandler.h" +#include "FileChooser.h" +#include "FocusController.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "HTMLFormElement.h" +#include "Logging.h" +#include "MemoryCache.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" +#include "PlatformMouseEvent.h" +#include "PlatformString.h" +#include "PlatformWheelEvent.h" +#include "PluginHalterClient.h" +#include "RenderObject.h" +#include "RenderView.h" +#include "ResourceHandleManager.h" +#include "Scrollbar.h" +#include "SelectionController.h" +#include "Settings.h" +#include "SubstituteData.h" +#include "Threading.h" +#include "markup.h" +#if __WXMSW__ +#include "WebCoreInstanceHandle.h" +#endif + +#include "ChromeClientWx.h" +#include "ContextMenuClientWx.h" +#include "DragClientWx.h" +#include "EditorClientWx.h" +#include "FrameLoaderClientWx.h" +#include "InspectorClientWx.h" + +#include "ScriptController.h" +#include "JSDOMBinding.h" +#include <runtime/JSValue.h> +#include <runtime/UString.h> +#include <wtf/text/CString.h> + +#if ENABLE(DATABASE) +#include "AbstractDatabase.h" +#include "DatabaseTracker.h" +#endif + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebDOMElement.h" +#include "WebDOMNode.h" + +#include "WebFrame.h" +#include "WebViewPrivate.h" + +#include <wx/defs.h> +#include <wx/dcbuffer.h> +#include <wx/dcgraph.h> + +#if defined(_MSC_VER) +int rint(double val) +{ + return (int)(val < 0 ? val - 0.5 : val + 0.5); +} +#endif + +// ---------------------------------------------------------------------------- +// wxWebView Events +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewLoadEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_LOAD) + +wxWebViewLoadEvent::wxWebViewLoadEvent(wxWindow* win) +{ + SetEventType( wxEVT_WEBVIEW_LOAD); + SetEventObject( win ); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_BEFORE_LOAD) + +wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win) +{ + m_cancelled = false; + SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewNewWindowEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_NEW_WINDOW) + +wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_NEW_WINDOW); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewRightClickEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_RIGHT_CLICK) + +wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewConsoleMessageEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_CONSOLE_MESSAGE) + +wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_CONSOLE_MESSAGE); + SetEventObject(win); + if (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) + +wxWebViewReceivedTitleEvent::wxWebViewReceivedTitleEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_RECEIVED_TITLE); + SetEventObject(win); + if (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()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewContentsChangedEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_CONTENTS_CHANGED) + +wxWebViewContentsChangedEvent::wxWebViewContentsChangedEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_CONTENTS_CHANGED); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewSelectionChangedEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_SELECTION_CHANGED) + +wxWebViewSelectionChangedEvent::wxWebViewSelectionChangedEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_SELECTION_CHANGED); + SetEventObject(win); + if (win) + SetId(win->GetId()); +} + +//--------------------------------------------------------- +// DOM Element info data type +//--------------------------------------------------------- + +wxWebViewDOMElementInfo::wxWebViewDOMElementInfo() : + m_isSelected(false), + m_text(wxEmptyString), + m_imageSrc(wxEmptyString), + m_link(wxEmptyString), + m_urlElement(NULL), + m_innerNode(NULL) +{ +} + +static wxWebViewCachePolicy gs_cachePolicy; + +/* static */ +void wxWebView::SetCachePolicy(const wxWebViewCachePolicy& cachePolicy) +{ + WebCore::MemoryCache* globalCache = WebCore::memoryCache(); + globalCache->setCapacities(cachePolicy.GetMinDeadCapacity(), + cachePolicy.GetMaxDeadCapacity(), + cachePolicy.GetCapacity()); + + // store a copy since there is no getter for MemoryCache values + gs_cachePolicy = cachePolicy; +} + +/* static */ +wxWebViewCachePolicy wxWebView::GetCachePolicy() +{ + return gs_cachePolicy; +} + +wxWebViewDOMElementInfo::wxWebViewDOMElementInfo(const wxWebViewDOMElementInfo& other) +{ + m_isSelected = other.m_isSelected; + m_text = other.m_text; + m_imageSrc = other.m_imageSrc; + m_link = other.m_link; + m_innerNode = other.m_innerNode; + m_urlElement = other.m_urlElement; +} + +wxWebViewDOMElementInfo::~wxWebViewDOMElementInfo() +{ + if (m_innerNode) + delete m_innerNode; + + if (m_urlElement) + delete m_urlElement; +} + +#if OS(DARWIN) +// prototype - function is in WebSystemInterface.mm +void InitWebCoreSystemInterface(void); +#endif + +BEGIN_EVENT_TABLE(wxWebView, wxWindow) + EVT_PAINT(wxWebView::OnPaint) + EVT_SIZE(wxWebView::OnSize) + EVT_MOUSE_EVENTS(wxWebView::OnMouseEvents) + EVT_CONTEXT_MENU(wxWebView::OnContextMenuEvents) + EVT_KEY_DOWN(wxWebView::OnKeyEvents) + EVT_KEY_UP(wxWebView::OnKeyEvents) + EVT_CHAR(wxWebView::OnKeyEvents) + EVT_SET_FOCUS(wxWebView::OnSetFocus) + EVT_KILL_FOCUS(wxWebView::OnKillFocus) +END_EVENT_TABLE() + +IMPLEMENT_DYNAMIC_CLASS(wxWebView, wxWindow) + +const wxChar* wxWebViewNameStr = wxT("webView"); + +wxWebView::wxWebView() : + m_textMagnifier(1.0), + m_isEditable(false), + m_isInitialized(false), + m_beingDestroyed(false), + m_mouseWheelZooms(false), + m_title(wxEmptyString) +{ +} + +wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, + const wxSize& size, long style, const wxString& name) : + m_textMagnifier(1.0), + m_isEditable(false), + m_isInitialized(false), + m_beingDestroyed(false), + m_mouseWheelZooms(false), + m_title(wxEmptyString) +{ + Create(parent, id, position, size, style, name); +} + +bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, + const wxSize& size, long style, const wxString& name) +{ +#if OS(DARWIN) + InitWebCoreSystemInterface(); +#endif + + if ( (style & wxBORDER_MASK) == 0) + style |= wxBORDER_NONE; + + if (!wxWindow::Create(parent, id, position, size, style, name)) + return false; + + WTF::initializeThreading(); + WTF::initializeMainThread(); + +// This is necessary because we are using SharedTimerWin.cpp on Windows, +// due to a problem with exceptions getting eaten when using the callback +// approach to timers (which wx itself uses). +#if __WXMSW__ + WebCore::setInstanceHandle(wxGetInstance()); +#endif + + // this helps reduce flicker on platforms like MSW + SetBackgroundStyle(wxBG_STYLE_CUSTOM); + + m_impl = new WebViewPrivate(); + + WebCore::InitializeLoggingChannelsIfNecessary(); + WebCore::HTMLFrameOwnerElement* parentFrame = 0; + + WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); + + WebCore::Page::PageClients pageClients; + pageClients.chromeClient = new WebCore::ChromeClientWx(this); + pageClients.contextMenuClient = new WebCore::ContextMenuClientWx(); + pageClients.editorClient = editorClient; + pageClients.dragClient = new WebCore::DragClientWx(); + pageClients.inspectorClient = new WebCore::InspectorClientWx(); + m_impl->page = new WebCore::Page(pageClients); + editorClient->setPage(m_impl->page); + + m_mainFrame = new wxWebFrame(this); + + // Default settings - we should have wxWebViewSettings class for this + // eventually + WebCore::Settings* settings = m_impl->page->settings(); + settings->setLoadsImagesAutomatically(true); + settings->setDefaultFixedFontSize(13); + settings->setDefaultFontSize(16); + settings->setSerifFontFamily("Times New Roman"); + settings->setFixedFontFamily("Courier New"); + settings->setSansSerifFontFamily("Arial"); + settings->setStandardFontFamily("Times New Roman"); + settings->setJavaScriptEnabled(true); + +#if ENABLE(DATABASE) + SetDatabasesEnabled(true); +#endif + + // we need to do this so that objects like the focusController are properly + // initialized so that the activate handler is run properly. + LoadURL(wxT("about:blank")); + + m_isInitialized = true; + + return true; +} + +wxWebView::~wxWebView() +{ + m_beingDestroyed = true; + + while (HasCapture()) + ReleaseMouse(); + + if (m_mainFrame && m_mainFrame->GetFrame()) + m_mainFrame->GetFrame()->loader()->detachFromParent(); + + delete m_impl->page; + m_impl->page = 0; +} + +// NOTE: binding to this event in the wxWebView constructor is too early in +// some cases, but leave the event handler here so that users can bind to it +// at a later time if they have activation state problems. +void wxWebView::OnTLWActivated(wxActivateEvent& event) +{ + if (m_impl && m_impl->page && m_impl->page->focusController()) + m_impl->page->focusController()->setActive(event.GetActive()); + + event.Skip(); + +} + +void wxWebView::Stop() +{ + if (m_mainFrame) + m_mainFrame->Stop(); +} + +void wxWebView::Reload() +{ + if (m_mainFrame) + m_mainFrame->Reload(); +} + +wxString wxWebView::GetPageSource() +{ + if (m_mainFrame) + return m_mainFrame->GetPageSource(); + + return wxEmptyString; +} + +void wxWebView::SetPageSource(const wxString& source, const wxString& baseUrl, const wxString& mimetype) +{ + if (m_mainFrame) + m_mainFrame->SetPageSource(source, baseUrl, mimetype); +} + +wxString wxWebView::GetInnerText() +{ + if (m_mainFrame) + return m_mainFrame->GetInnerText(); + + return wxEmptyString; +} + +wxString wxWebView::GetAsMarkup() +{ + if (m_mainFrame) + return m_mainFrame->GetAsMarkup(); + + return wxEmptyString; +} + +wxString wxWebView::GetExternalRepresentation() +{ + if (m_mainFrame) + return m_mainFrame->GetExternalRepresentation(); + + return wxEmptyString; +} + +wxWebKitSelection wxWebView::GetSelection() +{ + if (m_mainFrame) + return m_mainFrame->GetSelection(); + + return 0; +} + +wxString wxWebView::GetSelectionAsHTML() +{ + if (m_mainFrame) + return m_mainFrame->GetSelectionAsHTML(); + + return wxEmptyString; +} + +wxString wxWebView::GetSelectionAsText() +{ + if (m_mainFrame) + return m_mainFrame->GetSelectionAsText(); + + return wxEmptyString; +} + +void wxWebView::SetTransparent(bool transparent) +{ + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (!frame || !frame->view()) + return; + + frame->view()->setTransparent(transparent); +} + +bool wxWebView::IsTransparent() const +{ + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (!frame || !frame->view()) + return false; + + return frame->view()->isTransparent(); +} + +wxString wxWebView::RunScript(const wxString& javascript) +{ + if (m_mainFrame) + return m_mainFrame->RunScript(javascript); + + return wxEmptyString; +} + +bool wxWebView::ExecuteEditCommand(const wxString& command, const wxString& parameter) +{ + if (m_mainFrame) + return m_mainFrame->ExecuteEditCommand(command, parameter); +} + +EditState wxWebView::GetEditCommandState(const wxString& command) const +{ + if (m_mainFrame) + return m_mainFrame->GetEditCommandState(command); +} + +wxString wxWebView::GetEditCommandValue(const wxString& command) const +{ + if (m_mainFrame) + return m_mainFrame->GetEditCommandValue(command); + + return wxEmptyString; +} + +void wxWebView::LoadURL(const wxString& url) +{ + if (m_mainFrame) + m_mainFrame->LoadURL(url); +} + +bool wxWebView::GoBack() +{ + if (m_mainFrame) + return m_mainFrame->GoBack(); + + return false; +} + +bool wxWebView::GoForward() +{ + if (m_mainFrame) + return m_mainFrame->GoForward(); + + return false; +} + +bool wxWebView::CanGoBack() +{ + if (m_mainFrame) + return m_mainFrame->CanGoBack(); + + return false; +} + +bool wxWebView::CanGoForward() +{ + if (m_mainFrame) + return m_mainFrame->CanGoForward(); + + return false; +} + +bool wxWebView::CanIncreaseTextSize() const +{ + if (m_mainFrame) + return m_mainFrame->CanIncreaseTextSize(); + + return false; +} + +void wxWebView::IncreaseTextSize() +{ + if (m_mainFrame) + m_mainFrame->IncreaseTextSize(); +} + +bool wxWebView::CanDecreaseTextSize() const +{ + if (m_mainFrame) + m_mainFrame->CanDecreaseTextSize(); + + return false; +} + +void wxWebView::DecreaseTextSize() +{ + if (m_mainFrame) + m_mainFrame->DecreaseTextSize(); +} + +void wxWebView::ResetTextSize() +{ + if (m_mainFrame) + m_mainFrame->ResetTextSize(); +} + +void wxWebView::MakeEditable(bool enable) +{ + if (m_mainFrame) + m_mainFrame->MakeEditable(enable); +} + +bool wxWebView::IsEditable() const +{ + if (m_mainFrame) + return m_mainFrame->IsEditable(); + + return false; +} + + + +/* + * Event forwarding functions to send events down to WebCore. + */ + +void wxWebView::OnPaint(wxPaintEvent& event) +{ + if (m_beingDestroyed || !m_mainFrame) + return; + + WebCore::Frame* frame = m_mainFrame->GetFrame(); + if (!frame || !frame->view()) + return; + + wxAutoBufferedPaintDC dc(this); + + if (IsShown() && frame->document()) { +#if USE(WXGC) + wxGCDC gcdc(dc); +#endif + + if (dc.IsOk()) { + wxRect paintRect = GetUpdateRegion().GetBox(); + +#if USE(WXGC) + WebCore::GraphicsContext gc(&gcdc); +#else + WebCore::GraphicsContext gc(&dc); +#endif + if (frame->contentRenderer()) { + frame->view()->updateLayoutAndStyleIfNeededRecursive(); + frame->view()->paint(&gc, paintRect); + } + } + } +} + +bool wxWebView::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection) +{ + if (m_mainFrame) + return m_mainFrame->FindString(string, forward, caseSensitive, wrapSelection, startInSelection); + + return false; +} + +void wxWebView::OnSize(wxSizeEvent& event) +{ + if (m_isInitialized && m_mainFrame) { + WebCore::Frame* frame = m_mainFrame->GetFrame(); + frame->view()->setFrameRect(wxRect(wxPoint(0,0), event.GetSize())); + frame->view()->forceLayout(); + frame->view()->adjustViewSize(); + } + + event.Skip(); +} + +static int getDoubleClickTime() +{ +#if __WXMSW__ + return ::GetDoubleClickTime(); +#else + return 500; +#endif +} + +void wxWebView::OnMouseEvents(wxMouseEvent& event) +{ + event.Skip(); + + if (!m_impl->page) + return; + + WebCore::Frame* frame = m_mainFrame->GetFrame(); + if (!frame || !frame->view()) + return; + + wxPoint globalPoint = ClientToScreen(event.GetPosition()); + + wxEventType type = event.GetEventType(); + + if (type == wxEVT_MOUSEWHEEL) { + if (m_mouseWheelZooms && event.ControlDown() && !event.AltDown() && !event.ShiftDown()) { + if (event.GetWheelRotation() < 0) + DecreaseTextSize(); + else if (event.GetWheelRotation() > 0) + IncreaseTextSize(); + } else { + WebCore::PlatformWheelEvent wkEvent(event, globalPoint); + frame->eventHandler()->handleWheelEvent(wkEvent); + } + + return; + } + + // If an event, such as a right-click event, leads to a focus change (e.g. it + // raises a dialog), WebKit never gets the mouse up event and never relinquishes + // mouse capture. This leads to WebKit handling mouse events, such as modifying + // the selection, while other controls or top level windows have the focus. + // I'm not sure if this is the right place to handle this, but I can't seem to + // find a precedent on how to handle this in other ports. + if (wxWindow::FindFocus() != this) { + while (HasCapture()) + ReleaseMouse(); + + frame->eventHandler()->setMousePressed(false); + + return; + } + + 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) { + frame->eventHandler()->handleMousePressEvent(wkEvent); + if (!HasCapture()) + CaptureMouse(); + } else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) { + frame->eventHandler()->handleMouseReleaseEvent(wkEvent); + while (HasCapture()) + ReleaseMouse(); + } else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW) + frame->eventHandler()->mouseMoved(wkEvent); +} + +void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) +{ + Connect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this); + m_impl->page->contextMenuController()->clearContextMenu(); + wxPoint localEventPoint = ScreenToClient(event.GetPosition()); + + if (!m_impl->page) + return; + + WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame(); + if (!focusedFrame->view()) + return; + + //Create WebCore mouse event from the wxContextMenuEvent + wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN); + mouseEvent.m_x = localEventPoint.x; + mouseEvent.m_y = localEventPoint.y; + WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition(), 1); + + bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent); + if (!handledEvent) + return; + + WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu(); + if (!coreMenu) + return; + + WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription(); + if (!menuWx) + return; + + PopupMenu(menuWx, localEventPoint); + + Disconnect(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(wxWebView::OnMenuSelectEvents), NULL, this); +} + +void wxWebView::OnMenuSelectEvents(wxCommandEvent& event) +{ + // we shouldn't hit this unless there's a context menu showing + WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu(); + ASSERT(coreMenu); + if (!coreMenu) + return; + + WebCore::ContextMenuItem* item = WebCore::ContextMenu::itemWithId (event.GetId()); + if (!item) + return; + + m_impl->page->contextMenuController()->contextMenuItemSelected(item); + delete item; +} + +bool wxWebView::CanCopy() +{ + if (m_mainFrame) + return m_mainFrame->CanCopy(); + + return false; +} + +void wxWebView::Copy() +{ + if (m_mainFrame) + m_mainFrame->Copy(); +} + +bool wxWebView::CanCut() +{ + if (m_mainFrame) + return m_mainFrame->CanCut(); + + return false; +} + +void wxWebView::Cut() +{ + if (m_mainFrame) + m_mainFrame->Cut(); +} + +bool wxWebView::CanPaste() +{ + if (m_mainFrame) + return m_mainFrame->CanPaste(); + + return false; +} + +void wxWebView::Paste() +{ + if (m_mainFrame) + m_mainFrame->Paste(); +} + +void wxWebView::OnKeyEvents(wxKeyEvent& event) +{ + WebCore::Frame* frame = 0; + if (m_impl->page) + frame = m_impl->page->focusController()->focusedOrMainFrame(); + + 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(); + return; + } + break; + case 86: //"V" + if (CanPaste() && event.GetModifiers() == wxMOD_CMD) { + Paste(); + return; + } + break; + case 88: //"X" + if (CanCut() && event.GetModifiers() == wxMOD_CMD) { + Cut(); + return; + } + break; + case WXK_INSERT: + if (CanCopy() && event.GetModifiers() == wxMOD_CMD) { + Copy(); + return; + } + if (CanPaste() && event.GetModifiers() == wxMOD_SHIFT) { + Paste(); + return; + } + return; //Insert shall not become a char + case WXK_DELETE: + if (CanCut() && event.GetModifiers() == wxMOD_SHIFT) { + Cut(); + return; + } + break; + case WXK_LEFT: + case WXK_NUMPAD_LEFT: + frame->view()->scrollBy(WebCore::IntSize(-WebCore::Scrollbar::pixelsPerLineStep(), 0)); + return; + case WXK_UP: + case WXK_NUMPAD_UP: + frame->view()->scrollBy(WebCore::IntSize(0, -WebCore::Scrollbar::pixelsPerLineStep())); + return; + case WXK_RIGHT: + case WXK_NUMPAD_RIGHT: + frame->view()->scrollBy(WebCore::IntSize(WebCore::Scrollbar::pixelsPerLineStep(), 0)); + return; + case WXK_DOWN: + case WXK_NUMPAD_DOWN: + frame->view()->scrollBy(WebCore::IntSize(0, WebCore::Scrollbar::pixelsPerLineStep())); + 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::Scrollbar::minFractionToStepWhenPaging())); + return; + case WXK_PAGEDOWN: + case WXK_NUMPAD_PAGEDOWN: + frame->view()->scrollBy(WebCore::IntSize(0, frame->view()->visibleHeight() * WebCore::Scrollbar::minFractionToStepWhenPaging())); + 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; + } + } + + event.Skip(); +} + +void wxWebView::OnSetFocus(wxFocusEvent& event) +{ + if (m_impl && m_impl->page && m_impl->page->focusController()) { + m_impl->page->focusController()->setFocused(true); + m_impl->page->focusController()->setActive(true); + + if (!m_impl->page->focusController()->focusedFrame() && m_mainFrame) + m_impl->page->focusController()->setFocusedFrame(m_mainFrame->GetFrame()); + } + + event.Skip(); +} + +void wxWebView::OnKillFocus(wxFocusEvent& event) +{ + if (m_impl && m_impl->page && m_impl->page->focusController()) { + m_impl->page->focusController()->setFocused(false); + + // We also handle active state in OnTLWActivated, but if a user does not + // call event.Skip() in their own EVT_ACTIVATE handler, we won't get those + // callbacks. So we handle active state here as well as a fallback. + wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); + if (tlw && tlw->IsActive()) + m_impl->page->focusController()->setActive(true); + else + m_impl->page->focusController()->setActive(false); + } + + while (HasCapture()) + ReleaseMouse(); + + event.Skip(); +} + +wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const +{ + if (m_mainFrame) + return m_mainFrame->HitTest(pos); + + return wxWebViewDOMElementInfo(); +} + +bool wxWebView::ShouldClose() const +{ + if (m_mainFrame) + return m_mainFrame->ShouldClose(); + + return true; +} + +/* static */ +void wxWebView::SetDatabaseDirectory(const wxString& databaseDirectory) +{ +#if ENABLE(DATABASE) + WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(databaseDirectory); +#endif +} + +/* static */ +wxString wxWebView::GetDatabaseDirectory() +{ +#if ENABLE(DATABASE) + return WebCore::DatabaseTracker::tracker().databaseDirectoryPath(); +#else + return wxEmptyString; +#endif +} + +/* static */ +void wxWebView::SetDatabasesEnabled(bool enabled) +{ +#if ENABLE(DATABASE) + WebCore::AbstractDatabase::setIsAvailable(enabled); +#endif +} + +/* static */ +bool wxWebView::AreDatabasesEnabled() +{ +#if ENABLE(DATABASE) + return WebCore::AbstractDatabase::isAvailable(); +#endif + return false; +} + +static WebCore::ResourceHandleManager::ProxyType curlProxyType(wxProxyType type) +{ + switch (type) { + case HTTP: return WebCore::ResourceHandleManager::HTTP; + case Socks4: return WebCore::ResourceHandleManager::Socks4; + case Socks4A: return WebCore::ResourceHandleManager::Socks4A; + case Socks5: return WebCore::ResourceHandleManager::Socks5; + case Socks5Hostname: return WebCore::ResourceHandleManager::Socks5Hostname; + default: + ASSERT_NOT_REACHED(); + return WebCore::ResourceHandleManager::HTTP; + } +} + +/* static */ +void wxWebView::SetProxyInfo(const wxString& host, + unsigned long port, + wxProxyType type, + const wxString& username, + const wxString& password) +{ + using WebCore::ResourceHandleManager; + if (ResourceHandleManager* mgr = ResourceHandleManager::sharedInstance()) + mgr->setProxyInfo(host, port, curlProxyType(type), username, password); +} + +wxWebSettings wxWebView::GetWebSettings() +{ + ASSERT(m_impl->page); + if (m_impl->page) + return wxWebSettings(m_impl->page->settings()); + + return wxWebSettings(); +} + +wxWebKitCompatibilityMode wxWebView::GetCompatibilityMode() const +{ + if (m_mainFrame) + return m_mainFrame->GetCompatibilityMode(); + + return QuirksMode; +} + +void wxWebView::GrantUniversalAccess() +{ + if (m_mainFrame) + m_mainFrame->GrantUniversalAccess(); +} diff --git a/Source/WebKit/wx/WebView.h b/Source/WebKit/wx/WebView.h new file mode 100644 index 0000000..4a6b081 --- /dev/null +++ b/Source/WebKit/wx/WebView.h @@ -0,0 +1,700 @@ +/* + * 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 WXWEBVIEW_H +#define WXWEBVIEW_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebKitDefines.h" +#include "WebDOMSelection.h" +#include "WebFrame.h" +#include "WebSettings.h" + +class WebViewPrivate; +class WebViewFrameData; +class wxWebFrame; + +typedef struct OpaqueJSContext* JSGlobalContextRef; +typedef struct OpaqueJSValue* JSObjectRef; + +namespace WebCore { + class ChromeClientWx; + class FrameLoaderClientWx; +} + +#ifndef SWIG +extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; +#endif + +static const int defaultCacheCapacity = 8192 * 1024; // mirrors MemoryCache.cpp + +class WXDLLIMPEXP_WEBKIT wxWebViewCachePolicy +{ +public: + wxWebViewCachePolicy(unsigned minDead = 0, unsigned maxDead = defaultCacheCapacity, unsigned totalCapacity = defaultCacheCapacity) + : m_minDeadCapacity(minDead) + , m_maxDeadCapacity(maxDead) + , m_capacity(totalCapacity) + {} + + ~wxWebViewCachePolicy() {} + + unsigned GetCapacity() const { return m_capacity; } + void SetCapacity(int capacity) { m_capacity = capacity; } + + unsigned GetMinDeadCapacity() const { return m_minDeadCapacity; } + void SetMinDeadCapacity(unsigned minDeadCapacity) { m_minDeadCapacity = minDeadCapacity; } + + unsigned GetMaxDeadCapacity() const { return m_maxDeadCapacity; } + void SetMaxDeadCapacity(unsigned maxDeadCapacity) { m_maxDeadCapacity = maxDeadCapacity; } + +protected: + unsigned m_capacity; + unsigned m_minDeadCapacity; + unsigned m_maxDeadCapacity; +}; + + +// copied from WebKit/mac/Misc/WebKitErrors[Private].h +enum { + WebKitErrorCannotShowMIMEType = 100, + WebKitErrorCannotShowURL = 101, + WebKitErrorFrameLoadInterruptedByPolicyChange = 102, + WebKitErrorCannotUseRestrictedPort = 103, + WebKitErrorCannotFindPlugIn = 200, + WebKitErrorCannotLoadPlugIn = 201, + WebKitErrorJavaUnavailable = 202, +}; + +enum wxProxyType { + HTTP, + Socks4, + Socks4A, + Socks5, + Socks5Hostname +}; + +class WXDLLIMPEXP_WEBKIT wxWebView : public wxWindow +{ + // ChromeClientWx needs to get the Page* stored by the wxWebView + // for the createWindow function. + friend class WebCore::ChromeClientWx; + friend class WebCore::FrameLoaderClientWx; + +public: + // ctor(s) +#if SWIG + %pythonAppend wxWebView "self._setOORInfo(self)" + %pythonAppend wxWebView() "" +#endif + + wxWebView(wxWindow* parent, int id = wxID_ANY, + const wxPoint& point = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing +#if SWIG + %rename(PreWebView) wxWebView(); +#else + wxWebView(); +#endif + + bool Create(wxWindow* parent, int id = wxID_ANY, + const wxPoint& point = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing + +#ifndef SWIG + virtual ~wxWebView(); +#endif + + void LoadURL(const wxString& url); + bool GoBack(); + bool GoForward(); + void Stop(); + void Reload(); + + bool CanGoBack(); + bool CanGoForward(); + + bool CanCut(); + bool CanCopy(); + bool CanPaste(); + + void Cut(); + void Copy(); + void Paste(); + + //bool CanGetPageSource(); + wxString GetPageSource(); + void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString, const wxString& mimetype = wxT("text/html")); + + wxString GetInnerText(); + wxString GetAsMarkup(); + wxString GetExternalRepresentation(); + + wxWebKitSelection GetSelection(); + wxString GetSelectionAsHTML(); + wxString GetSelectionAsText(); + + void SetTransparent(bool transparent); + bool IsTransparent() const; + + wxString RunScript(const wxString& javascript); + bool ExecuteEditCommand(const wxString& command, const wxString& parameter = wxEmptyString); + EditState GetEditCommandState(const wxString& command) const; + wxString GetEditCommandValue(const wxString& command) const; + + bool FindString(const wxString& string, bool forward = true, + bool caseSensitive = false, bool wrapSelection = true, + bool startInSelection = true); + + bool CanIncreaseTextSize() const; + void IncreaseTextSize(); + bool CanDecreaseTextSize() const; + void DecreaseTextSize(); + void ResetTextSize(); + void MakeEditable(bool enable); + bool IsEditable() const; + + wxString GetPageTitle() const { return m_title; } + void SetPageTitle(const wxString& title) { m_title = title; } + + wxWebFrame* GetMainFrame() { return m_mainFrame; } + + wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const; + + bool ShouldClose() const; + + static void SetCachePolicy(const wxWebViewCachePolicy& cachePolicy); + static wxWebViewCachePolicy GetCachePolicy(); + + void SetMouseWheelZooms(bool mouseWheelZooms) { m_mouseWheelZooms = mouseWheelZooms; } + bool GetMouseWheelZooms() const { return m_mouseWheelZooms; } + + static void SetDatabaseDirectory(const wxString& databaseDirectory); + static wxString GetDatabaseDirectory(); + + /** + Sets whether or not web pages can create databases. + */ + static void SetDatabasesEnabled(bool enabled); + + /** + Returns whether or not the WebView runs JavaScript code. + */ + static bool AreDatabasesEnabled(); + + static void SetProxyInfo(const wxString& host = wxEmptyString, + unsigned long port = 0, + wxProxyType type = HTTP, + const wxString& username = wxEmptyString, + const wxString& password = wxEmptyString); + + wxWebSettings GetWebSettings(); + wxWebKitCompatibilityMode GetCompatibilityMode() const; + + /* + This method allows cross site-scripting (XSS) in the WebView. + Use with caution! + */ + void GrantUniversalAccess(); + +protected: + + // event handlers (these functions should _not_ be virtual) + void OnPaint(wxPaintEvent& event); + void OnSize(wxSizeEvent& event); + void OnMouseEvents(wxMouseEvent& event); + void OnContextMenuEvents(wxContextMenuEvent& event); + void OnMenuSelectEvents(wxCommandEvent& event); + void OnKeyEvents(wxKeyEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + void OnTLWActivated(wxActivateEvent& event); + +private: + // any class wishing to process wxWindows events must use this macro +#ifndef SWIG + DECLARE_EVENT_TABLE() + DECLARE_DYNAMIC_CLASS(wxWebView) +#endif + float m_textMagnifier; + bool m_isEditable; + bool m_isInitialized; + bool m_beingDestroyed; + bool m_mouseWheelZooms; + WebViewPrivate* m_impl; + wxWebFrame* m_mainFrame; + wxString m_title; + +}; + +// ---------------------------------------------------------------------------- +// Web Kit Events +// ---------------------------------------------------------------------------- + +enum { + wxWEBVIEW_LOAD_STARTED = 1, + wxWEBVIEW_LOAD_NEGOTIATING = 2, + wxWEBVIEW_LOAD_REDIRECTING = 4, + wxWEBVIEW_LOAD_TRANSFERRING = 8, + wxWEBVIEW_LOAD_STOPPED = 16, + wxWEBVIEW_LOAD_FAILED = 32, + wxWEBVIEW_LOAD_DL_COMPLETED = 64, + wxWEBVIEW_LOAD_DOC_COMPLETED = 128, + wxWEBVIEW_LOAD_ONLOAD_HANDLED = 256, + wxWEBVIEW_LOAD_WINDOW_OBJECT_CLEARED = 512 +}; + +enum { + wxWEBVIEW_NAV_LINK_CLICKED = 1, + wxWEBVIEW_NAV_BACK_NEXT = 2, + wxWEBVIEW_NAV_FORM_SUBMITTED = 4, + wxWEBVIEW_NAV_RELOAD = 8, + wxWEBVIEW_NAV_FORM_RESUBMITTED = 16, + wxWEBVIEW_NAV_OTHER = 32 +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewBeforeLoadEvent ) +#endif + +public: + bool IsCancelled() const { return m_cancelled; } + void Cancel(bool cancel = true) { m_cancelled = cancel; } + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + void SetNavigationType(int navType) { m_navType = navType; } + int GetNavigationType() const { return m_navType; } + + wxWebViewBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewBeforeLoadEvent(*this); } + +private: + bool m_cancelled; + wxString m_url; + int m_navType; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewLoadEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewLoadEvent ) +#endif + +public: + int GetState() const { return m_state; } + void SetState(const int state) { m_state = state; } + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + + wxWebViewLoadEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewLoadEvent(*this); } + +private: + int m_state; + wxString m_url; +}; + +class WXDLLIMPEXP_WEBKIT wxWebKitWindowFeatures +{ +public: + wxWebKitWindowFeatures() + : menuBarVisible(true) + , statusBarVisible(true) + , toolBarVisible(true) + , locationBarVisible(true) + , scrollbarsVisible(true) + , resizable(true) + , fullscreen(false) + , dialog(false) + { } + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + bool fullscreen; + bool dialog; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewNewWindowEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent ) +#endif + +public: + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + wxString GetTargetName() const { return m_targetName; } + void SetTargetName(const wxString& name) { m_targetName = name; } + wxWebView* GetWebView() { return m_webView; } + void SetWebView(wxWebView* webView) { m_webView = webView; } + wxWebKitWindowFeatures GetWindowFeatures() { return m_features; } + void SetWindowFeatures(wxWebKitWindowFeatures features) { m_features = features; } + + wxWebViewNewWindowEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); + wxEvent *Clone(void) const { return new wxWebViewNewWindowEvent(*this); } + +private: + wxWebView* m_webView; + wxWebKitWindowFeatures m_features; + wxString m_url; + wxString m_targetName; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewRightClickEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewRightClickEvent ) +#endif + +public: + wxWebViewRightClickEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); + wxEvent *Clone(void) const { return new wxWebViewRightClickEvent(*this); } + + wxWebViewDOMElementInfo GetInfo() const { return m_info; } + void SetInfo(wxWebViewDOMElementInfo info) { m_info = info; } + + wxPoint GetPosition() const { return m_position; } + void SetPosition(wxPoint pos) { m_position = pos; } + +private: + wxWebViewDOMElementInfo m_info; + wxPoint m_position; +}; + +// copied from page/Console.h +enum wxWebViewConsoleMessageLevel { + TipMessageLevel, + LogMessageLevel, + WarningMessageLevel, + ErrorMessageLevel +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewConsoleMessageEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewConsoleMessageEvent ) +#endif + +public: + wxString GetMessage() const { return m_message; } + void SetMessage(const wxString& message) { m_message = message; } + + unsigned int GetLineNumber() const { return m_lineNumber; } + void SetLineNumber(unsigned int lineNumber) { m_lineNumber = lineNumber; } + + wxString GetSourceID() const { return m_sourceID; } + void SetSourceID(const wxString& sourceID) { m_sourceID = sourceID; } + + wxWebViewConsoleMessageEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewConsoleMessageEvent(*this); } + + wxWebViewConsoleMessageLevel GetLevel() const { return m_level; } + void SetLevel(wxWebViewConsoleMessageLevel level) { m_level = level; } + +private: + unsigned int m_lineNumber; + wxString m_message; + wxString m_sourceID; + wxWebViewConsoleMessageLevel m_level; +}; + +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 + DECLARE_DYNAMIC_CLASS( wxWebViewReceivedTitleEvent ) +#endif + +public: + wxString GetTitle() const { return m_title; } + void SetTitle(const wxString& title) { m_title = title; } + + wxWebViewReceivedTitleEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); + wxEvent *Clone(void) const { return new wxWebViewReceivedTitleEvent(*this); } + +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; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewContentsChangedEvent : public wxCommandEvent { +#ifndef SWIG + DECLARE_DYNAMIC_CLASS(wxWebViewContentsChangedEvent) +#endif + +public: + wxWebViewContentsChangedEvent(wxWindow* win = static_cast<wxWindow*>(0)); + wxEvent *Clone(void) const { return new wxWebViewContentsChangedEvent(*this); } +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewSelectionChangedEvent : public wxCommandEvent { +#ifndef SWIG + DECLARE_DYNAMIC_CLASS(wxWebViewSelectionChangedEvent) +#endif + +public: + wxWebViewSelectionChangedEvent(wxWindow* win = static_cast<wxWindow*>(0)); + wxEvent *Clone(void) const { return new wxWebViewSelectionChangedEvent(*this); } +}; + +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&); +typedef void (wxEvtHandler::*wxWebViewContentsChangedFunction)(wxWebViewContentsChangedEvent&); +typedef void (wxEvtHandler::*wxWebViewSelectionChangedFunction)(wxWebViewSelectionChangedEvent&); + +#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) +#define wxWebViewContentsChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewContentsChangedEventFunction, &func) +#define wxWebViewSelectionChangedEventHandler(func) \ + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWebViewSelectionChangedEventFunction, &func) + +#ifndef SWIG +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_BEFORE_LOAD, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_LOAD, wxID_ANY) + 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) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONTENTS_CHANGED, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_SELECTION_CHANGED, wxID_ANY) +END_DECLARE_EVENT_TYPES() +#endif + +#define EVT_WEBVIEW_LOAD(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_LOAD, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewLoadEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_BEFORE_LOAD(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewBeforeLoadEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_NEW_WINDOW(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_NEW_WINDOW, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewNewWindowEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_RIGHT_CLICK(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewRightClickEventFunction) & func, \ + static_cast<wxObject*>(NULL)), + +#define EVT_WEBVIEW_CONSOLE_MESSAGE(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_CONSOLE_MESSAGE, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (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, \ + wxID_ANY, \ + (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)), + +#define EVT_WEBVIEW_CONTENTS_CHANGED(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY(wxEVT_WEBVIEW_CONTENTS_CHANGED, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewContentsChangedEventFunction) & func, \ + static_cast<wxObject*>(0)), + +#define EVT_WEBVIEW_SELECTION_CHANGED(winid, func) \ + DECLARE_EVENT_TABLE_ENTRY(wxEVT_WEBVIEW_SELECTION_CHANGED, \ + winid, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewSelectionChangedEventFunction) & func, \ + static_cast<wxObject*>(0)), + + +#endif // ifndef WXWEBVIEW_H diff --git a/Source/WebKit/wx/WebViewPrivate.h b/Source/WebKit/wx/WebViewPrivate.h new file mode 100644 index 0000000..989a579 --- /dev/null +++ b/Source/WebKit/wx/WebViewPrivate.h @@ -0,0 +1,56 @@ +/* + * 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. + * 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 WXWEBVIEWPRIVATE_H +#define WXWEBVIEWPRIVATE_H + +#include "config.h" +#include "EditCommand.h" +#include "EditCommandWx.h" +#include "Page.h" +#include "wtf/Vector.h" + +#include <wx/timer.h> + +class WebViewPrivate +{ +public: + WebViewPrivate() : + page(0) + {} + + WebCore::Page* page; + + wxTimer tripleClickTimer; + wxPoint tripleClickPos; + + WTF::Vector<EditCommandWx> undoStack; + WTF::Vector<EditCommandWx> redoStack; +}; + +#endif diff --git a/Source/WebKit/wx/bindings/python/samples/simple.py b/Source/WebKit/wx/bindings/python/samples/simple.py new file mode 100644 index 0000000..2756760 --- /dev/null +++ b/Source/WebKit/wx/bindings/python/samples/simple.py @@ -0,0 +1,162 @@ +#!/usr/bin/python + +# 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. + + +import wx +import wx.webview + +class TestPanel(wx.Panel): + def __init__(self, parent, log, frame=None): + wx.Panel.__init__( + self, parent, -1, + style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE + ) + + self.log = log + self.current = "http://wxPython.org/" + self.frame = frame + + if frame: + self.titleBase = frame.GetTitle() + + sizer = wx.BoxSizer(wx.VERTICAL) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + + self.webview = wx.webview.WebView(self, -1) + + + btn = wx.Button(self, -1, "Open", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "<--", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "-->", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "Stop", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnStopButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "Refresh", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnRefreshPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + txt = wx.StaticText(self, -1, "Location:") + btnSizer.Add(txt, 0, wx.CENTER|wx.ALL, 2) + + self.location = wx.ComboBox( + self, -1, "", style=wx.CB_DROPDOWN|wx.PROCESS_ENTER + ) + + self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location) + self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey) + self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn) + btnSizer.Add(self.location, 1, wx.EXPAND|wx.ALL, 2) + + sizer.Add(btnSizer, 0, wx.EXPAND) + sizer.Add(self.webview, 1, wx.EXPAND) + + self.webview.LoadURL(self.current) + self.location.Append(self.current) + + self.webview.Bind(wx.webview.EVT_WEBVIEW_LOAD, self.OnStateChanged) + + self.SetSizer(sizer) + + def OnStateChanged(self, event): + statusbar = self.GetParent().GetStatusBar() + if statusbar: + if event.GetState() == wx.webview.WEBVIEW_LOAD_NEGOTIATING: + statusbar.SetStatusText("Contacting " + event.GetURL()) + elif event.GetState() == wx.webview.WEBVIEW_LOAD_TRANSFERRING: + statusbar.SetStatusText("Loading " + event.GetURL()) + elif event.GetState() == wx.webview.WEBVIEW_LOAD_DOC_COMPLETED: + statusbar.SetStatusText("") + self.location.SetValue(event.GetURL()) + self.GetParent().SetTitle("wxWebView - " + self.webview.GetPageTitle()) + + def OnLocationKey(self, evt): + if evt.GetKeyCode() == wx.WXK_RETURN: + URL = self.location.GetValue() + self.location.Append(URL) + self.webview.LoadURL(URL) + else: + evt.Skip() + + def IgnoreReturn(self, evt): + if evt.GetKeyCode() != wx.WXK_RETURN: + evt.Skip() + + def OnLocationSelect(self, evt): + url = self.location.GetStringSelection() + self.webview.LoadURL(url) + + def OnOpenButton(self, event): + dlg = wx.TextEntryDialog(self, "Open Location", + "Enter a full URL or local path", + self.current, wx.OK|wx.CANCEL) + dlg.CentreOnParent() + + if dlg.ShowModal() == wx.ID_OK: + self.current = dlg.GetValue() + self.webview.LoadURL(self.current) + + dlg.Destroy() + + def OnPrevPageButton(self, event): + self.webview.GoBack() + + def OnNextPageButton(self, event): + self.webview.GoForward() + + def OnStopButton(self, evt): + self.webview.Stop() + + def OnRefreshPageButton(self, evt): + self.webview.Reload() + + +class wkFrame(wx.Frame): + def __init__(self): + wx.Frame.__init__(self, None, -1, "WebKit in wxPython!") + + self.panel = TestPanel(self, -1) + self.panel.webview.LoadURL("http://www.wxwidgets.org/") + self.CreateStatusBar() + +class wkApp(wx.App): + def OnInit(self): + self.webFrame = wkFrame() + self.SetTopWindow(self.webFrame) + self.webFrame.Show() + + return True + +app = wkApp(redirect=False) +app.MainLoop() diff --git a/Source/WebKit/wx/bindings/python/webview.i b/Source/WebKit/wx/bindings/python/webview.i new file mode 100644 index 0000000..f1621b0 --- /dev/null +++ b/Source/WebKit/wx/bindings/python/webview.i @@ -0,0 +1,182 @@ +/* + * 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. + */ + +%module webview + +%{ +#include "config.h" + +#include "wx/wxPython/wxPython.h" +#include "wx/wxPython/pyclasses.h" +#include "WebBrowserShell.h" +#include "WebDOMSelection.h" +#include "WebEdit.h" +#include "WebFrame.h" +#include "WebSettings.h" +#include "WebView.h" + +#include "WebDOMAttr.h" +#include "WebDOMCSSStyleDeclaration.h" +#include "WebDOMDocument.h" +#include "WebDOMDocumentFragment.h" +#include "WebDOMDOMSelection.h" +#include "WebDOMElement.h" +#include "WebDOMEventListener.h" +#include "WebDOMNamedNodeMap.h" +#include "WebDOMNode.h" +#include "WebDOMNodeList.h" +#include "WebDOMObject.h" +#include "WebDOMRange.h" + +#ifndef __WXMSW__ +PyObject* createDOMNodeSubtype(WebDOMNode* ptr, bool setThisOwn, bool isValueObject) +{ + //static wxPyTypeInfoHashMap* typeInfoCache = NULL; + + //if (typeInfoCache == NULL) + // typeInfoCache = new wxPyTypeInfoHashMap; + + swig_type_info* swigType = 0; //(*typeInfoCache)[name]; + char* name = 0; + if (ptr) { + // it wasn't in the cache, so look it up from SWIG + switch (ptr->nodeType()) { + case WebDOMNode::WEBDOM_ELEMENT_NODE: + name = "WebDOMElement*"; + break; + case WebDOMNode::WEBDOM_ATTRIBUTE_NODE: + name = "WebDOMAttr*"; + break; + default: + name = "WebDOMNode*"; + } + swigType = SWIG_TypeQuery(name); + if (swigType) { + if (isValueObject) { + return SWIG_Python_NewPointerObj(new WebDOMNode(*ptr), swigType, setThisOwn); + } + + return SWIG_Python_NewPointerObj(ptr, swigType, setThisOwn); + } + // if it still wasn't found, try looking for a mapped name + //if (swigType) { + // and add it to the map if found + // (*typeInfoCache)[className] = swigType; + //} + } + + Py_INCREF(Py_None); + + return Py_None; +} + +WebDOMString* createWebDOMString(PyObject* source) +{ + if (!PyString_Check(source) && !PyUnicode_Check(source)) { + PyErr_SetString(PyExc_TypeError, "String or Unicode type required"); + return new WebDOMString(); + } + + char* tmpPtr; + Py_ssize_t tmpSize; + + if (PyString_Check(source)) + PyString_AsStringAndSize(source, &tmpPtr, &tmpSize); + else { + PyObject* str = PyUnicode_AsUTF8String(source); + PyString_AsStringAndSize(str, &tmpPtr, &tmpSize); + Py_DECREF(str); + } + + WebDOMString temp = WebDOMString::fromUTF8(tmpPtr); + + return new WebDOMString(temp); +} + +#endif + + + +%} +//--------------------------------------------------------------------------- + +%import core.i +%import windows.i + +#ifndef __WXMSW__ +%typemap(out) WebDOMNode* { $result = createDOMNodeSubtype($1, (bool)$owner, 0); } +%typemap(out) WebDOMElement* { $result = createDOMNodeSubtype($1, (bool)$owner, 0); } +%typemap(out) WebDOMNode { $result = createDOMNodeSubtype(&$1, (bool)$owner, 1); } +%typemap(out) WebDOMElement { $result = createDOMNodeSubtype(&$1, (bool)$owner, 1); } +%typemap(in) WebDOMString& { $1 = createWebDOMString($input); } +%typemap(out) WebDOMString { $result = PyUnicode_DecodeUTF8($1.utf8().data(), $1.utf8().length(), NULL); } +%typemap(out) WebDOMString& { $result = PyUnicode_DecodeUTF8($1.utf8().data(), $1.utf8().length(), NULL); } +#endif + +MAKE_CONST_WXSTRING(WebViewNameStr); + +MustHaveApp(wxWebBrowserShell); +MustHaveApp(wxWebFrame); +MustHaveApp(wxWebView); + +%include WebKitDefines.h + +#ifndef __WXMSW__ +%include WebDOMObject.h +%include WebDOMNode.h + +%include WebDOMAttr.h +%include WebDOMDOMSelection.h +%include WebDOMElement.h +%include WebDOMNodeList.h +%include WebDOMRange.h +#endif + +%include WebBrowserShell.h +%include WebDOMSelection.h +%include WebEdit.h +%include WebFrame.h +%include WebSettings.h +%include WebView.h + +%constant wxEventType wxEVT_WEBVIEW_BEFORE_LOAD; +%constant wxEventType wxEVT_WEBVIEW_LOAD; +%constant wxEventType wxEVT_WEBVIEW_NEW_WINDOW; +%constant wxEventType wxEVT_WEBVIEW_RIGHT_CLICK; +%constant wxEventType wxEVT_WEBVIEW_CONSOLE_MESSAGE; +%constant wxEventType wxEVT_WEBVIEW_RECEIVED_TITLE; +%constant wxEventType wxEVT_WEBVIEW_CONTENTS_CHANGED; +%constant wxEventType wxEVT_WEBVIEW_SELECTION_CHANGED; + +%pythoncode { +EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD, 1 ) +EVT_WEBVIEW_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_LOAD, 1 ) +EVT_WEBVIEW_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEW_WINDOW, 1 ) +EVT_WEBVIEW_RIGHT_CLICK = wx.PyEventBinder( wxEVT_WEBVIEW_RIGHT_CLICK, 1 ) +EVT_WEBVIEW_CONSOLE_MESSAGE = wx.PyEventBinder( wxEVT_WEBVIEW_CONSOLE_MESSAGE, 1 ) +EVT_WEBVIEW_RECEIVED_TITLE = wx.PyEventBinder( wxEVT_WEBVIEW_RECEIVED_TITLE, 1 ) +EVT_WEBVIEW_CONTENTS_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_CONTENTS_CHANGED, 1 ) +EVT_WEBVIEW_SELECTION_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_SELECTION_CHANGED, 1 ) +} diff --git a/Source/WebKit/wx/bindings/python/wscript b/Source/WebKit/wx/bindings/python/wscript new file mode 100644 index 0000000..0a1df31 --- /dev/null +++ b/Source/WebKit/wx/bindings/python/wscript @@ -0,0 +1,93 @@ +#! /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, 'Source', 'JavaScriptCore'), + os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'cpp'), + os.path.join(wk_root, 'Source', 'WebCore', 'DerivedSources'), + 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 build(bld): + if Options.options.wxpython: + defines = ['SWIG_TYPE_TABLE=_wxPython_table', 'WXP_USE_THREAD=1', 'SWIG_PYTHON_OUTPUT_TUPLE'] + wx_swig_args = [] + for define in defines: + wx_swig_args.append('-D%s' % define) + + 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 + + for inc_path in include_paths: + wx_swig_args.append('-I' + inc_path) + + obj = bld.new_task_gen( + features = 'cxx cshlib pyext', + includes = ' '.join(include_paths), + source = 'webview.i', + swig_flags = ' '.join(wx_swig_args), + defines = defines, + target = '_webview', + uselib = 'WX CURL ICU XSLT XML SQLITE3 ' + get_config(), + + libpath = [output_dir], + uselib_local = 'wxwebkit', + install_path = output_dir + ) diff --git a/Source/WebKit/wx/wscript b/Source/WebKit/wx/wscript new file mode 100644 index 0000000..f91a69c --- /dev/null +++ b/Source/WebKit/wx/wscript @@ -0,0 +1,124 @@ +#! /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, 'Source', 'JavaScriptCore'), + os.path.join(wk_root, 'Source', 'WebCore'), + os.path.join(wk_root, 'Source', 'WebCore', 'bindings', 'wx'), + os.path.join(wk_root, 'Source', 'WebCore', 'DerivedSources'), + os.path.join(output_dir), + os.path.join(wk_root, 'Source', 'WebCore', 'page', 'wx'), + os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'network', 'curl'), + os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'wx'), + os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'bridge', 'wx'), + os.path.join(wk_root, 'Source', 'WebCore', 'platform', 'graphics', 'wx'), +] + +if sys.platform.startswith("win"): + include_paths.append(os.path.join(wk_root, 'Source', 'WebCore','platform','win')) + +windows_deps = [ + 'lib/pthreadVC2.dll', + 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', + 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', + 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', + ] + +webcore_include_dirs = [] +for dir in webcore_dirs + ['DerivedSources']: + include_paths.append(os.path.join(wk_root, 'Source', 'WebCore', dir)) + +js_include_dirs = [os.path.join(wk_root, 'Source', 'JavaScriptCore', 'assembler')] +for dir in jscore_dirs: + js_include_dirs.append(os.path.join(wk_root, 'Source', 'JavaScriptCore', dir)) + +def set_options(opt): + common_set_options(opt) + +def configure(conf): + common_configure(conf) + +def pre_build(bld): + """ + The wxWebKit library should be rebuilt if jscore or webcore changes, + so we make those static libs as dependencies. + """ + + ext = '.a' + if sys.platform.startswith('win'): + ext = '.lib' + + libjscore = os.path.join(output_dir, 'libjscore%s' % ext) + libwebcore = os.path.join(output_dir, 'libwebcore%s' % ext) + + assert os.path.exists(libjscore) + assert os.path.exists(libwebcore) + + bld.env.CXXDEPS_JSCORE = Utils.h_file(libjscore) + bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) + +def build(bld): + + import TaskGen + + if sys.platform.startswith('darwin'): + TaskGen.task_gen.mappings['.mm'] = TaskGen.task_gen.mappings['.cxx'] + TaskGen.task_gen.mappings['.m'] = TaskGen.task_gen.mappings['.cxx'] + + bld.add_pre_fun(pre_build) + + bld.env.LIBDIR = output_dir + + 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 ' + get_config(), + libpath = [output_dir], + uselib_local = '', + install_path = output_dir) + + exts = ['.c', '.cpp'] + if sys.platform.startswith('darwin'): + exts.append('.mm') + obj.includes += '../mac/WebCoreSupport ../../Source/WebCore/platform/mac' + obj.source = "../mac/WebCoreSupport/WebSystemInterface.mm" + obj.find_sources_in_dirs(webkit_dirs) + + if building_on_win32: + for wxlib in bld.env['LIB_WX']: + wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll') + if os.path.exists(wxlibname): + bld.install_files(obj.install_path, [wxlibname]) + + for dep in windows_deps: + bld.install_files(obj.install_path, [os.path.join(msvclibs_dir, dep)]) |