diff options
Diffstat (limited to 'WebKit/wx')
-rw-r--r-- | WebKit/wx/ChangeLog | 718 | ||||
-rw-r--r-- | WebKit/wx/WebBrowserShell.cpp | 329 | ||||
-rw-r--r-- | WebKit/wx/WebBrowserShell.h | 98 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.cpp | 425 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.h | 120 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.cpp | 49 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.h | 9 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditorClientWx.cpp | 8 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditorClientWx.h | 2 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp | 174 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 21 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/InspectorClientWx.cpp | 20 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/InspectorClientWx.h | 6 | ||||
-rw-r--r-- | WebKit/wx/WebView.cpp | 359 | ||||
-rw-r--r-- | WebKit/wx/WebView.h | 85 | ||||
-rw-r--r-- | WebKit/wx/WebViewPrivate.h | 2 | ||||
-rw-r--r-- | WebKit/wx/bindings/python/webview.i | 25 | ||||
-rw-r--r-- | WebKit/wx/bindings/python/wxwebkit-py.bkl | 6 | ||||
-rw-r--r-- | WebKit/wx/dependencies.bkl | 7 | ||||
-rw-r--r-- | WebKit/wx/presets/wxwebkit.bkl | 24 | ||||
-rw-r--r-- | WebKit/wx/wxwebkit.bkl | 12 | ||||
-rw-r--r-- | WebKit/wx/wxwk-settings.bkl | 21 |
22 files changed, 1903 insertions, 617 deletions
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index e20ccd8..beb9f8a 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,715 @@ +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. @@ -56,7 +768,7 @@ Updated for WebCore method renames. - Reviewed by Darin. + Reviewed by Darin Adler. * WebView.cpp: (wxWebView::OnSetFocus): @@ -127,7 +839,7 @@ 2007-12-16 Alexey Proskuryakov <ap@webkit.org> - Reviewed by Darin. + Reviewed by Darin Adler. http://bugs.webkit.org/show_bug.cgi?id=16462 REGRESSION: access keys broken on Windows @@ -170,7 +882,7 @@ 2007-12-07 Alexey Proskuryakov <ap@webkit.org> - Reviewed by Darin. + 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. diff --git a/WebKit/wx/WebBrowserShell.cpp b/WebKit/wx/WebBrowserShell.cpp new file mode 100644 index 0000000..d2a30d5 --- /dev/null +++ b/WebKit/wx/WebBrowserShell.cpp @@ -0,0 +1,329 @@ +/* + * 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 "WebView.h" +#include "WebBrowserShell.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 +}; + +BEGIN_EVENT_TABLE(wxWebBrowserShell, wxFrame) + 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) +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")); + + // 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::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(); + } +} diff --git a/WebKit/wx/WebBrowserShell.h b/WebKit/wx/WebBrowserShell.h new file mode 100644 index 0000000..9b48314 --- /dev/null +++ b/WebKit/wx/WebBrowserShell.h @@ -0,0 +1,98 @@ +/* + * 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 "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 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); + +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/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index cd46af6..b1f03e0 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -21,308 +21,297 @@ * 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 "CString.h" +#include "Document.h" +#include "Editor.h" +#include "Element.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "HTMLFrameOwnerElement.h" +#include "markup.h" +#include "Page.h" +#include "RenderTreeAsText.h" +#include "RenderObject.h" +#include "RenderView.h" + +#include "EditorClientWx.h" +#include "FrameLoaderClientWx.h" + +#include "ScriptController.h" +#include "JSDOMBinding.h" +#include <runtime/JSValue.h> +#include <kjs/ustring.h> #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif -#include "wx/artprov.h" - -#include "WebView.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); -} +#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 -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 -}; - -BEGIN_EVENT_TABLE(wxWebFrame, wxFrame) - EVT_MENU(wxID_EXIT, wxWebFrame::OnQuit) - EVT_MENU(wxID_ABOUT, wxWebFrame::OnAbout) - EVT_MENU(ID_LOADFILE, wxWebFrame::OnLoadFile) - EVT_TEXT_ENTER(ID_TEXTCTRL, wxWebFrame::OnAddressBarEnter) - EVT_TEXT_ENTER(ID_SEARCHCTRL, wxWebFrame::OnSearchCtrlEnter) - EVT_WEBVIEW_LOAD(wxWebFrame::OnLoadEvent) - EVT_WEBVIEW_BEFORE_LOAD(wxWebFrame::OnBeforeLoad) - EVT_MENU(ID_BACK, wxWebFrame::OnBack) - EVT_MENU(ID_FORWARD, wxWebFrame::OnForward) - EVT_MENU(ID_STOP, wxWebFrame::OnStop) - EVT_MENU(ID_RELOAD, wxWebFrame::OnReload) - EVT_MENU(ID_MAKE_TEXT_LARGER, wxWebFrame::OnMakeTextLarger) - EVT_MENU(ID_MAKE_TEXT_SMALLER, wxWebFrame::OnMakeTextSmaller) - EVT_MENU(ID_GET_SOURCE, wxWebFrame::OnGetSource) - EVT_MENU(ID_SET_SOURCE, wxWebFrame::OnSetSource) - EVT_MENU(ID_BROWSE, wxWebFrame::OnBrowse) - EVT_MENU(ID_EDIT, wxWebFrame::OnEdit) - EVT_MENU(ID_RUN_SCRIPT, wxWebFrame::OnRunScript) -END_EVENT_TABLE() - - -wxWebFrame::wxWebFrame(const wxString& title) : - wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)), - m_checkBeforeLoad(false) +wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameData* data) : + m_textMagnifier(1.0), + m_isEditable(false), + m_isInitialized(false), + m_beingDestroyed(false), + m_title(wxEmptyString) { - // 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")); - - // 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); + m_impl = new WebViewPrivate(); + + WebCore::HTMLFrameOwnerElement* parentFrame = 0; - wxToolBar* toolbar = CreateToolBar(); - toolbar->SetToolBitmapSize(wxSize(32, 32)); + if (data) { + parentFrame = data->ownerElement; + } - wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK, wxART_TOOLBAR, wxSize(32,32)); - toolbar->AddTool(ID_BACK, back, wxT("Back")); + WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); - wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_TOOLBAR, wxSize(32,32)); - toolbar->AddTool(ID_FORWARD, forward, wxT("Next")); + m_impl->frame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); + m_impl->frame->deref(); - 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(); + loaderClient->setFrame(m_impl->frame.get()); + loaderClient->setWebView(container); - SetToolBar(toolbar); - - // Create the wxWebView Window - webview = new wxWebView((wxWindow*)this, 1001, wxDefaultPosition, wxSize(200, 200)); - webview->SetBackgroundColour(*wxWHITE); - - // create a status bar just for fun (by default with 1 pane only) - CreateStatusBar(2); + m_impl->frame->init(); + + m_isInitialized = true; } wxWebFrame::~wxWebFrame() { - if (m_debugMenu && GetMenuBar()->FindMenu(_("&Debug")) == wxNOT_FOUND) - delete m_debugMenu; + m_impl->frame->loader()->detachFromParent(); } -void wxWebFrame::ShowDebugMenu(bool show) +WebCore::Frame* wxWebFrame::GetFrame() { - 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); - } + if (m_impl) + return m_impl->frame.get(); + + return 0; } -// event handlers - -void wxWebFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +void wxWebFrame::Stop() { - // true is to force the frame to close - Close(true); + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->stop(); } -void wxWebFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +void wxWebFrame::Reload() { - 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); - + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->reload(); } -void wxWebFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event)) +wxString wxWebFrame::GetPageSource() { - wxFileDialog* dialog = new wxFileDialog(this, wxT("Choose a file")); - if (dialog->ShowModal() == wxID_OK) { - wxString path = dialog->GetPath().Prepend(wxT("file://")); + 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 (webview) - webview->LoadURL(path); + if (doc) { + wxString source = createMarkup(doc); + return source; + } } + return wxEmptyString; } -void wxWebFrame::OnLoadEvent(wxWebViewLoadEvent& event) +void wxWebFrame::SetPageSource(const wxString& source, const wxString& baseUrl) { - 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()); - } + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::FrameLoader* loader = m_impl->frame->loader(); + loader->begin(WebCore::KURL(static_cast<const char*>(baseUrl.mb_str(wxConvUTF8)))); + loader->write(source); + loader->end(); } } -void wxWebFrame::OnBeforeLoad(wxWebViewBeforeLoadEvent& myEvent) +wxString wxWebFrame::GetInnerText() { - if (m_checkBeforeLoad) { - int reply = wxMessageBox(_("Would you like to continue loading ") + myEvent.GetURL() + wxT("?"), _("Continue Loading?"), wxYES_NO); - if (reply == wxNO) { - myEvent.Cancel(); - } - } + 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(); } -void wxWebFrame::OnAddressBarEnter(wxCommandEvent& event) +wxString wxWebFrame::GetAsMarkup() { - if (webview) - webview->LoadURL(addressBar->GetValue()); + if (!m_impl->frame || !m_impl->frame->document()) + return wxEmptyString; + + return createMarkup(m_impl->frame->document()); } -void wxWebFrame::OnSearchCtrlEnter(wxCommandEvent& event) +wxString wxWebFrame::GetExternalRepresentation() { - 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())); + if (m_impl->frame->view() && m_impl->frame->view()->layoutPending()) + m_impl->frame->view()->layout(); + + return externalRepresentation(m_impl->frame->contentRenderer()); +} + +wxString wxWebFrame::RunScript(const wxString& javascript) +{ + wxString returnValue = wxEmptyString; + if (m_impl->frame) { + JSC::JSValue* result = m_impl->frame->loader()->executeScript(javascript, true); + if (result) + returnValue = wxString(result->toString(m_impl->frame->script()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8); } + return returnValue; } -void wxWebFrame::OnBack(wxCommandEvent& event) +void wxWebFrame::LoadURL(const wxString& url) { - if (webview) - webview->GoBack(); + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::KURL kurl = WebCore::KURL(static_cast<const char*>(url.mb_str(wxConvUTF8))); + // 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); + } } -void wxWebFrame::OnForward(wxCommandEvent& event) +bool wxWebFrame::GoBack() { - if (webview) - webview->GoForward(); + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->goBack(); + + return false; } -void wxWebFrame::OnStop(wxCommandEvent& myEvent) +bool wxWebFrame::GoForward() { - if (webview) - webview->Stop(); + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->goForward(); + + return false; } -void wxWebFrame::OnReload(wxCommandEvent& myEvent) +bool wxWebFrame::CanGoBack() { - if (webview) - webview->Reload(); + if (m_impl->frame && m_impl->frame->page() && m_impl->frame->page()->backForwardList()) + return m_impl->frame->page()->backForwardList()->backItem() != NULL; + + return false; } -void wxWebFrame::OnMakeTextLarger(wxCommandEvent& myEvent) +bool wxWebFrame::CanGoForward() { - if (webview) { - if (webview->CanIncreaseTextSize()) - webview->IncreaseTextSize(); + if (m_impl->frame && m_impl->frame->page() && m_impl->frame->page()->backForwardList()) + return m_impl->frame->page()->backForwardList()->forwardItem() != NULL; + + return false; +} +bool wxWebFrame::CanIncreaseTextSize() const +{ + if (m_impl->frame) { + if (m_textMagnifier*TextSizeMultiplierRatio <= MaximumTextSizeMultiplier) + return true; } + return false; } -void wxWebFrame::OnMakeTextSmaller(wxCommandEvent& myEvent) +void wxWebFrame::IncreaseTextSize() { - if (webview) { - if (webview->CanDecreaseTextSize()) - webview->DecreaseTextSize(); + if (CanIncreaseTextSize()) { + m_textMagnifier = m_textMagnifier*TextSizeMultiplierRatio; + m_impl->frame->setZoomFactor(m_textMagnifier, true); } } -void wxWebFrame::OnGetSource(wxCommandEvent& myEvent) +bool wxWebFrame::CanDecreaseTextSize() const { - if (webview) { - wxPageSourceViewFrame* wxWebFrame = new wxPageSourceViewFrame(webview->GetPageSource()); - wxWebFrame->Show(); + if (m_impl->frame) { + if (m_textMagnifier/TextSizeMultiplierRatio >= MinimumTextSizeMultiplier) + return true; + } + return false; +} + +void wxWebFrame::DecreaseTextSize() +{ + if (CanDecreaseTextSize()) { + m_textMagnifier = m_textMagnifier/TextSizeMultiplierRatio; + m_impl->frame->setZoomFactor(m_textMagnifier, true); } } -void wxWebFrame::OnSetSource(wxCommandEvent& event) +void wxWebFrame::MakeEditable(bool enable) { - if (webview) - webview->SetPageSource(wxString(wxT("<p>Hello World!</p>"))); + m_isEditable = enable; } -void wxWebFrame::OnBrowse(wxCommandEvent& event) + + +bool wxWebFrame::CanCopy() { - if (webview) - webview->MakeEditable(!event.IsChecked()); + if (m_impl->frame && m_impl->frame->view()) + return (m_impl->frame->editor()->canCopy() || m_impl->frame->editor()->canDHTMLCopy()); + + return false; } -void wxWebFrame::OnEdit(wxCommandEvent& event) +void wxWebFrame::Copy() { - if (webview) - webview->MakeEditable(event.IsChecked()); + if (CanCopy()) + m_impl->frame->editor()->copy(); } -void wxWebFrame::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(); - } +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(); + } diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index 046a650..a6961eb 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -33,66 +33,88 @@ #include "wx/wx.h" #endif -#include "WebView.h" -#include <wx/srchctrl.h> +class WebViewPrivate; +class WebViewFrameData; +class wxWebView; -class WXDLLIMPEXP_WEBKIT wxWebFrame : public wxFrame -{ -public: - // ctor(s) -#if SWIG - %pythonAppend wxWebFrame "self._setOORInfo(self)" -#endif - wxWebFrame(const wxString& title); +namespace WebCore { + class ChromeClientWx; + class FrameLoaderClientWx; + class Frame; +} #ifndef SWIG - ~wxWebFrame(); + +#if WXMAKINGDLL_WEBKIT +#define WXDLLIMPEXP_WEBKIT WXEXPORT +#elif defined(WXUSINGDLL_WEBKIT) +#define WXDLLIMPEXP_WEBKIT WXIMPORT +#else +#define WXDLLIMPEXP_WEBKIT #endif - void ShowDebugMenu(bool show = true); - wxWebView* webview; +#else +#define WXDLLIMPEXP_WEBKIT +#endif // SWIG -protected: +class WXDLLIMPEXP_WEBKIT wxWebFrame +{ + // ChromeClientWx needs to get the Page* stored by the wxWebView + // for the createWindow function. + friend class WebCore::ChromeClientWx; + friend class WebCore::FrameLoaderClientWx; + friend class wxWebView; - // event handlers (these functions should _not_ be virtual) - 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); + 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(); - void OnMakeTextLarger(wxCommandEvent& event); - void OnMakeTextSmaller(wxCommandEvent& event); - void OnGetSource(wxCommandEvent& event); + wxString GetPageSource(); + void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); - // debug menu items - void OnSetSource(wxCommandEvent& event); - void OnRunScript(wxCommandEvent& myEvent); + wxString GetInnerText(); + wxString GetAsMarkup(); + wxString GetExternalRepresentation(); + + wxString RunScript(const wxString& javascript); + + bool CanIncreaseTextSize() const; + void IncreaseTextSize(); + bool CanDecreaseTextSize() const; + void DecreaseTextSize(); + void MakeEditable(bool enable); + bool IsEditable() const { return m_isEditable; } + wxString GetPageTitle() const { return m_title; } + void SetPageTitle(const wxString& title) { m_title = title; } + + WebCore::Frame* GetFrame(); + 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); + float m_textMagnifier; + bool m_isEditable; + bool m_isInitialized; + bool m_beingDestroyed; + WebViewPrivate* m_impl; + wxString m_title; + }; #endif // ifndef WXWEBFRAME_H diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index 579e3f9..3d119a5 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "ChromeClientWx.h" +#include "FileChooser.h" #include "FloatRect.h" #include "FrameLoadRequest.h" #include "NotImplemented.h" @@ -39,8 +40,9 @@ #include <wx/wx.h> #endif #include <wx/textdlg.h> +#include <wx/tooltip.h> -#include "WebFrame.h" +#include "WebBrowserShell.h" #include "WebView.h" #include "WebViewPrivate.h" @@ -112,7 +114,7 @@ Page* ChromeClientWx::createWindow(Frame*, const FrameLoadRequest& request, cons // when that event is not handled. Page* myPage = 0; - wxWebFrame* newFrame = new wxWebFrame(wxTheApp->GetAppName()); + wxWebBrowserShell* newFrame = new wxWebBrowserShell(wxTheApp->GetAppName()); if (newFrame->webview) { newFrame->webview->LoadURL(request.resourceRequest().url().string()); @@ -282,9 +284,34 @@ IntRect ChromeClientWx::windowResizerRect() const return IntRect(); } -void ChromeClientWx::addToDirtyRegion(const IntRect&) +void ChromeClientWx::repaint(const IntRect& rect, bool contentChanged, bool immediate, bool repaintContentOnly) +{ + if (!m_webView) + return; + + if (contentChanged) + 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; +} + +PlatformWidget ChromeClientWx::platformWindow() const +{ + return 0; } void ChromeClientWx::scrollBackingStore(int dx, int dy, @@ -304,9 +331,11 @@ void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modi notImplemented(); } -void ChromeClientWx::setToolTip(const String&) +void ChromeClientWx::setToolTip(const String& tip) { - notImplemented(); + wxToolTip* tooltip = m_webView->GetToolTip(); + if (!tooltip || tooltip->GetTip() != wxString(tip)) + m_webView->SetToolTip(tip); } void ChromeClientWx::print(Frame*) @@ -319,4 +348,14 @@ void ChromeClientWx::exceededDatabaseQuota(Frame*, const String&) notImplemented(); } +void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&) +{ + notImplemented(); +} + +void ChromeClientWx::runOpenPanel(Frame*, PassRefPtr<FileChooser>) +{ + notImplemented(); +} + } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index d80f3f2..d90788f 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -94,10 +94,15 @@ public: virtual bool tabsToLinks() const; virtual IntRect windowResizerRect() const; - virtual void addToDirtyRegion(const IntRect&); virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect); virtual void updateBackingStore(); + virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); + 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 PlatformWidget platformWindow() const; + virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const String&); @@ -106,6 +111,8 @@ public: virtual void exceededDatabaseQuota(Frame*, const String&); + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); + private: wxWebView* m_webView; }; diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index 7e8889c..ade0f41 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -117,7 +117,7 @@ bool EditorClientWx::isEditable() Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->nativeWindow()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); if (webKitWin) return webKitWin->IsEditable(); } @@ -143,7 +143,7 @@ bool EditorClientWx::shouldInsertNode(Node*, Range*, return true; } -bool EditorClientWx::shouldInsertText(String, Range*, +bool EditorClientWx::shouldInsertText(const String&, Range*, EditorInsertAction) { notImplemented(); @@ -246,8 +246,8 @@ void EditorClientWx::handleKeyboardEvent(KeyboardEvent* event) return; const PlatformKeyboardEvent* kevent = event->keyEvent(); - if (!kevent->type() == PlatformKeyboardEvent::KeyUp) { - Node* start = frame->selectionController()->start().node(); + if (kevent->type() != PlatformKeyboardEvent::KeyUp) { + Node* start = frame->selection()->start().node(); if (!start || !start->isContentEditable()) return; diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.h b/WebKit/wx/WebKitSupport/EditorClientWx.h index c2234d0..51b820c 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.h +++ b/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -55,7 +55,7 @@ public: virtual bool shouldEndEditing(Range*); virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction); - virtual bool shouldInsertText(String, Range*, + virtual bool shouldInsertText(const String&, Range*, EditorInsertAction); virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*); diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 941cd0b..685da65 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -34,10 +34,12 @@ #include "FrameView.h" #include "FrameTree.h" #include "HTMLFormElement.h" +#include "HTMLFrameOwnerElement.h" #include "NotImplemented.h" #include "Page.h" #include "PlatformString.h" #include "ProgressTracker.h" +#include "RenderPart.h" #include "ResourceError.h" #include "ResourceResponse.h" @@ -68,7 +70,8 @@ inline int wxNavTypeFromWebNavType(NavigationType type){ } FrameLoaderClientWx::FrameLoaderClientWx() - : m_frame(0) + : RefCounted<FrameLoaderClientWx>(0) + , m_frame(0) { } @@ -82,6 +85,11 @@ void FrameLoaderClientWx::setFrame(Frame *frame) m_frame = frame; } +void FrameLoaderClientWx::setWebView(wxWebView *webview) +{ + m_webView = webview; +} + void FrameLoaderClientWx::detachFrameLoader() { m_frame = 0; @@ -103,14 +111,6 @@ bool FrameLoaderClientWx::hasWebView() const return true; } - -bool FrameLoaderClientWx::hasFrameView() const -{ - notImplemented(); - return true; -} - - bool FrameLoaderClientWx::hasBackForwardList() const { notImplemented(); @@ -216,12 +216,6 @@ void FrameLoaderClientWx::willCloseDocument() } -void FrameLoaderClientWx::detachedFromParent1() -{ - notImplemented(); -} - - void FrameLoaderClientWx::detachedFromParent2() { notImplemented(); @@ -234,12 +228,6 @@ void FrameLoaderClientWx::detachedFromParent3() } -void FrameLoaderClientWx::detachedFromParent4() -{ - notImplemented(); -} - - void FrameLoaderClientWx::loadedFromCachedPage() { notImplemented(); @@ -248,12 +236,11 @@ void FrameLoaderClientWx::loadedFromCachedPage() void FrameLoaderClientWx::dispatchDidHandleOnloadEvents() { - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_ONLOAD_HANDLED); wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } @@ -292,43 +279,43 @@ void FrameLoaderClientWx::dispatchWillClose() void FrameLoaderClientWx::dispatchDidStartProvisionalLoad() { - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_NEGOTIATING); wkEvent.SetURL(m_frame->loader()->provisionalDocumentLoader()->request().url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } void FrameLoaderClientWx::dispatchDidReceiveTitle(const String& title) { - wxWebView* target = static_cast<wxWebView*>(m_frame->view()->nativeWindow()); - if (target) - target->SetPageTitle(title); + if (m_webView) { + m_webView->SetPageTitle(title); + wxWebViewReceivedTitleEvent wkEvent(m_webView); + wkEvent.SetTitle(title); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); + } } void FrameLoaderClientWx::dispatchDidCommitLoad() { - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_TRANSFERRING); wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } void FrameLoaderClientWx::dispatchDidFinishDocumentLoad() { - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_DOC_COMPLETED); wkEvent.SetURL(m_frame->loader()->url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } @@ -377,12 +364,6 @@ void FrameLoaderClientWx::revertToProvisionalState(DocumentLoader*) notImplemented(); } - -void FrameLoaderClientWx::clearUnarchivingState(DocumentLoader*) -{ - notImplemented(); -} - void FrameLoaderClientWx::postProgressStartedNotification() { notImplemented(); @@ -395,12 +376,11 @@ void FrameLoaderClientWx::postProgressEstimateChangedNotification() void FrameLoaderClientWx::postProgressFinishedNotification() { - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewLoadEvent wkEvent(m_webView); wkEvent.SetState(wxWEBVIEW_LOAD_DL_COMPLETED); wkEvent.SetURL(m_frame->loader()->url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } @@ -441,37 +421,6 @@ void FrameLoaderClientWx::finishedLoading(DocumentLoader*) } -void FrameLoaderClientWx::finalSetupForReplace(DocumentLoader*) -{ - notImplemented(); -} - - -void FrameLoaderClientWx::setDefersLoading(bool) -{ - notImplemented(); -} - - -bool FrameLoaderClientWx::isArchiveLoadPending(ResourceLoader*) const -{ - notImplemented(); - return false; -} - - -void FrameLoaderClientWx::cancelPendingArchiveLoad(ResourceLoader*) -{ - notImplemented(); -} - - -void FrameLoaderClientWx::clearArchivedResources() -{ - notImplemented(); -} - - bool FrameLoaderClientWx::canShowMIMEType(const String& MIMEType) const { notImplemented(); @@ -580,12 +529,7 @@ void FrameLoaderClientWx::partClearedInBegin() notImplemented(); } -void FrameLoaderClientWx::updateGlobalHistoryForStandardLoad(const WebCore::KURL&) -{ - notImplemented(); -} - -void FrameLoaderClientWx::updateGlobalHistoryForReload(const WebCore::KURL&) +void FrameLoaderClientWx::updateGlobalHistory(const WebCore::KURL&) { notImplemented(); } @@ -664,8 +608,7 @@ bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error) WTF::PassRefPtr<DocumentLoader> FrameLoaderClientWx::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { - RefPtr<DocumentLoader> loader = new DocumentLoader(request, substituteData); - return loader.release(); + return DocumentLoader::create(request, substituteData); } void FrameLoaderClientWx::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) @@ -746,7 +689,7 @@ void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction fu (m_frame->loader()->*function)(PolicyUse); } -void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, const String&) +void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, PassRefPtr<FormState>, const String&) { if (!m_frame) return; @@ -755,18 +698,17 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc (m_frame->loader()->*function)(PolicyUse); } -void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request) +void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>) { if (!m_frame) return; - wxWindow* target = m_frame->view()->nativeWindow(); - if (target) { - wxWebViewBeforeLoadEvent wkEvent(target); + if (m_webView) { + wxWebViewBeforeLoadEvent wkEvent(m_webView); wkEvent.SetNavigationType(wxNavTypeFromWebNavType(action.type())); wkEvent.SetURL(request.url().string()); - target->GetEventHandler()->ProcessEvent(wkEvent); + m_webView->GetEventHandler()->ProcessEvent(wkEvent); if (wkEvent.IsCancelled()) (m_frame->loader()->*function)(PolicyIgnore); else @@ -785,12 +727,6 @@ void FrameLoaderClientWx::startDownload(const ResourceRequest&) notImplemented(); } -bool FrameLoaderClientWx::willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL&) const -{ - notImplemented(); - return false; -} - PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { @@ -809,7 +745,7 @@ PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String */ /* - wxWindow* parent = m_frame->view()->nativeWindow(); + wxWindow* parent = m_webView; WebViewFrameData* data = new WebViewFrameData(); data->name = name; @@ -864,6 +800,12 @@ void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget) return; } +ResourceError FrameLoaderClientWx::pluginWillHandleLoadError(const ResourceResponse&) +{ + notImplemented(); + return ResourceError(); +} + Widget* FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues) { @@ -904,7 +846,33 @@ void FrameLoaderClientWx::transitionToCommittedFromCachedPage(CachedPage*) void FrameLoaderClientWx::transitionToCommittedForNewPage() { - notImplemented(); + ASSERT(m_frame); + ASSERT(m_webView); + + Page* page = m_frame->page(); + ASSERT(page); + + bool isMainFrame = m_frame == page->mainFrame(); + + m_frame->setView(0); + + FrameView* frameView; + if (isMainFrame) + frameView = new FrameView(m_frame, IntRect(m_webView->GetRect()).size()); + else + frameView = new FrameView(m_frame); + + ASSERT(frameView); + m_frame->setView(frameView); + frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame. + + frameView->setPlatformWidget(m_webView); + + if (m_frame->ownerRenderer()) + m_frame->ownerRenderer()->setWidget(frameView); + + if (HTMLFrameOwnerElement* owner = m_frame->ownerElement()) + m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode()); } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 37dd831..3b525b1 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -34,6 +34,7 @@ #include "RefCounted.h" #include "ResourceResponse.h" +class wxWebView; namespace WebCore { @@ -52,13 +53,13 @@ namespace WebCore { FrameLoaderClientWx(); ~FrameLoaderClientWx(); void setFrame(Frame *frame); + void setWebView(wxWebView *webview); virtual void detachFrameLoader(); virtual void ref(); virtual void deref(); virtual bool hasWebView() const; // mainly for assertions - virtual bool hasFrameView() const; // ditto virtual bool hasBackForwardList() const; virtual void resetBackForwardList(); @@ -86,10 +87,8 @@ namespace WebCore { virtual void willCloseDocument(); - virtual void detachedFromParent1(); virtual void detachedFromParent2(); virtual void detachedFromParent3(); - virtual void detachedFromParent4(); virtual void loadedFromCachedPage(); @@ -117,7 +116,6 @@ namespace WebCore { virtual void dispatchDidLoadMainResource(DocumentLoader*); virtual void revertToProvisionalState(DocumentLoader*); - virtual void clearUnarchivingState(DocumentLoader*); virtual void postProgressStartedNotification(); virtual void postProgressEstimateChangedNotification(); @@ -129,12 +127,7 @@ namespace WebCore { virtual void willChangeTitle(DocumentLoader*); virtual void didChangeTitle(DocumentLoader*); virtual void finishedLoading(DocumentLoader*); - virtual void finalSetupForReplace(DocumentLoader*); - virtual void setDefersLoading(bool); - virtual bool isArchiveLoadPending(ResourceLoader*) const; - virtual void cancelPendingArchiveLoad(ResourceLoader*); - virtual void clearArchivedResources(); virtual bool canShowMIMEType(const String& MIMEType) const; virtual bool representationExistsForURLScheme(const String& URLScheme) const; virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; @@ -156,8 +149,7 @@ namespace WebCore { virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*); virtual void transitionToCommittedForNewPage(); - virtual void updateGlobalHistoryForStandardLoad(const KURL&); - virtual void updateGlobalHistoryForReload(const KURL&); + virtual void updateGlobalHistory(const KURL&); virtual bool shouldGoToHistoryItem(HistoryItem*) const; virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; @@ -189,12 +181,11 @@ namespace WebCore { virtual void dispatchDidFailLoad(const ResourceError&); virtual Frame* dispatchCreatePage(); virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String&, const ResourceRequest&); - virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, const String&); - virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction&, 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&); - virtual bool willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL&) const; // FIXME: This should probably not be here, but it's needed for the tests currently virtual void partClearedInBegin(); @@ -203,6 +194,7 @@ namespace WebCore { const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool loadManually) ; virtual void redirectDataToPlugin(Widget* pluginWidget); + virtual ResourceError pluginWillHandleLoadError(const ResourceResponse&); virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues); @@ -217,6 +209,7 @@ namespace WebCore { private: Frame *m_frame; + wxWebView *m_webView; ResourceResponse m_response; bool m_firstData; }; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp index e77a068..9e87da6 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp @@ -79,6 +79,11 @@ void InspectorClientWx::detachWindow() notImplemented(); } +void InspectorClientWx::setAttachedWindowHeight(unsigned height) +{ + notImplemented(); +} + void InspectorClientWx::highlight(Node*) { notImplemented(); @@ -94,4 +99,19 @@ void InspectorClientWx::inspectedURLChanged(const String& newURL) notImplemented(); } +void InspectorClientWx::populateSetting(const String& key, InspectorController::Setting& setting) +{ + notImplemented(); +} + +void InspectorClientWx::storeSetting(const String& key, const InspectorController::Setting& setting) +{ + notImplemented(); +} + +void InspectorClientWx::removeSetting(const String& key) +{ + notImplemented(); +} + }; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.h b/WebKit/wx/WebKitSupport/InspectorClientWx.h index 5616278..6dd05df 100644 --- a/WebKit/wx/WebKitSupport/InspectorClientWx.h +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.h @@ -51,10 +51,16 @@ public: virtual void attachWindow(); virtual void detachWindow(); + virtual void setAttachedWindowHeight(unsigned height); + virtual void highlight(Node*); virtual void hideHighlight(); virtual void inspectedURLChanged(const String& newURL); + + virtual void populateSetting(const String& key, InspectorController::Setting&); + virtual void storeSetting(const String& key, const InspectorController::Setting&); + virtual void removeSetting(const String& key); }; } // namespace WebCore diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 3ed9785..fb2164f 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -25,7 +25,6 @@ #include "config.h" #include "CString.h" -#include "DeprecatedString.h" #include "Document.h" #include "Element.h" #include "Editor.h" @@ -35,7 +34,6 @@ #include "FrameLoader.h" #include "FrameView.h" #include "GraphicsContext.h" -#include "HTMLFrameOwnerElement.h" #include "Logging.h" #include "markup.h" #include "Page.h" @@ -44,7 +42,7 @@ #include "PlatformString.h" #include "PlatformWheelEvent.h" #include "RenderObject.h" -#include "RenderTreeAsText.h" +#include "RenderView.h" #include "SelectionController.h" #include "Settings.h" #include "SubstituteData.h" @@ -56,9 +54,9 @@ #include "FrameLoaderClientWx.h" #include "InspectorClientWx.h" -#include "kjs_proxy.h" -#include "kjs_binding.h" -#include <kjs/value.h> +#include "ScriptController.h" +#include "JSDOMBinding.h" +#include <runtime/JSValue.h> #include <kjs/ustring.h> #include "wx/wxprec.h" @@ -66,18 +64,13 @@ #include "wx/wx.h" #endif +#include "WebFrame.h" #include "WebView.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 - - #if defined(_MSC_VER) int rint(double val) { @@ -97,7 +90,8 @@ wxWebViewLoadEvent::wxWebViewLoadEvent(wxWindow* win) { SetEventType( wxEVT_WEBVIEW_LOAD); SetEventObject( win ); - SetId(win->GetId()); + if (win) + SetId(win->GetId()); } IMPLEMENT_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent, wxCommandEvent) @@ -109,7 +103,8 @@ wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win) m_cancelled = false; SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD); SetEventObject(win); - SetId(win->GetId()); + if (win) + SetId(win->GetId()); } IMPLEMENT_DYNAMIC_CLASS(wxWebViewNewWindowEvent, wxCommandEvent) @@ -120,7 +115,8 @@ wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_NEW_WINDOW); SetEventObject(win); - SetId(win->GetId()); + if (win) + SetId(win->GetId()); } IMPLEMENT_DYNAMIC_CLASS(wxWebViewRightClickEvent, wxCommandEvent) @@ -131,7 +127,8 @@ wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK); SetEventObject(win); - SetId(win->GetId()); + if (win) + SetId(win->GetId()); } IMPLEMENT_DYNAMIC_CLASS(wxWebViewConsoleMessageEvent, wxCommandEvent) @@ -142,7 +139,20 @@ wxWebViewConsoleMessageEvent::wxWebViewConsoleMessageEvent(wxWindow* win) { SetEventType(wxEVT_WEBVIEW_CONSOLE_MESSAGE); SetEventObject(win); - SetId(win->GetId()); + 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()); } //--------------------------------------------------------- @@ -170,16 +180,39 @@ BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_ACTIVATE(wxWebView::OnActivate) 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_title(wxEmptyString) +{ +} + wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, - const wxSize& size, WebViewFrameData* data) : + const wxSize& size, long style, const wxString& name) : m_textMagnifier(1.0), m_isEditable(false), m_isInitialized(false), m_beingDestroyed(false), m_title(wxEmptyString) { - if (!wxWindow::Create(parent, id, position, size, wxBORDER_NONE | wxHSCROLL | wxVSCROLL)) - return; + 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 ( (style & wxBORDER_MASK) == 0) + style |= wxBORDER_NONE; + style |= wxHSCROLL | wxVSCROLL; + + if (!wxWindow::Create(parent, id, position, size, style, name)) + return false; // This is necessary because we are using SharedTimerWin.cpp on Windows, // due to a problem with exceptions getting eaten when using the callback @@ -196,35 +229,12 @@ wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, WebCore::InitializeLoggingChannelsIfNecessary(); WebCore::HTMLFrameOwnerElement* parentFrame = 0; - // FIXME: This cast is obviously not as safe as a dynamic - // cast, but this allows us to get around requiring RTTI - // support for the moment. This is only used for subframes - // in any case, which aren't currently supported. - wxWebView* parentWebView = static_cast<wxWebView*>(parent); - - if (data) { - parentFrame = data->ownerElement; - m_impl->page = parentWebView->m_impl->frame->page(); - } - else { - WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); - m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx()); - editorClient->setPage(m_impl->page); - } - - WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); - - m_impl->frame = new WebCore::Frame(m_impl->page, parentFrame, loaderClient); - m_impl->frame->deref(); - m_impl->frameView = new WebCore::FrameView(m_impl->frame.get()); - m_impl->frameView->deref(); + WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); + m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx()); + editorClient->setPage(m_impl->page); - m_impl->frame->setView(m_impl->frameView.get()); - m_impl->frame->init(); - - m_impl->frameView->setNativeWindow(this); - loaderClient->setFrame(m_impl->frame.get()); - + m_mainFrame = new wxWebFrame(this); + // Default settings - we should have wxWebViewSettings class for this // eventually WebCore::Settings* settings = m_impl->page->settings(); @@ -238,162 +248,142 @@ wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, settings->setJavaScriptEnabled(true); m_isInitialized = true; + + return true; } wxWebView::~wxWebView() { m_beingDestroyed = true; - m_impl->frame->loader()->detachFromParent(); + delete m_mainFrame; delete m_impl->page; - m_impl->page = 0; - // Since frameView has the last reference to Frame, once it is - // destroyed the destructor for Frame will happen as well. - m_impl->frameView = 0; + m_impl->page = 0; } void wxWebView::Stop() { - if (m_impl->frame && m_impl->frame->loader()) - m_impl->frame->loader()->stop(); + if (m_mainFrame) + m_mainFrame->Stop(); } void wxWebView::Reload() { - if (m_impl->frame && m_impl->frame->loader()) - m_impl->frame->loader()->reload(); + if (m_mainFrame) + m_mainFrame->Reload(); } wxString wxWebView::GetPageSource() { - if (m_impl->frame) { - if (m_impl->frameView && m_impl->frameView->layoutPending()) - m_impl->frameView->layout(); - - WebCore::Document* doc = m_impl->frame->document(); - - if (doc) { - wxString source = doc->toString(); - return source; - } - } + if (m_mainFrame) + return m_mainFrame->GetPageSource(); + return wxEmptyString; } void wxWebView::SetPageSource(const wxString& source, const wxString& baseUrl) { - if (m_impl->frame && m_impl->frame->loader()) { - WebCore::FrameLoader* loader = m_impl->frame->loader(); - loader->begin(WebCore::KURL(static_cast<const char*>(baseUrl.mb_str(wxConvUTF8)))); - loader->write(source); - loader->end(); - } + if (m_mainFrame) + m_mainFrame->SetPageSource(source, baseUrl); } wxString wxWebView::GetInnerText() { - if (m_impl->frameView && m_impl->frameView->layoutPending()) - m_impl->frameView->layout(); + if (m_mainFrame) + return m_mainFrame->GetInnerText(); - WebCore::Element *documentElement = m_impl->frame->document()->documentElement(); - return documentElement->innerText(); + return wxEmptyString; } wxString wxWebView::GetAsMarkup() { - if (!m_impl->frame || !m_impl->frame->document()) - return wxEmptyString; - - return createMarkup(m_impl->frame->document()); + if (m_mainFrame) + return m_mainFrame->GetAsMarkup(); + + return wxEmptyString; } wxString wxWebView::GetExternalRepresentation() { - if (m_impl->frameView && m_impl->frameView->layoutPending()) - m_impl->frameView->layout(); - - return externalRepresentation(m_impl->frame->renderer()); + if (m_mainFrame) + return m_mainFrame->GetExternalRepresentation(); + + return wxEmptyString; } wxString wxWebView::RunScript(const wxString& javascript) { - wxString returnValue = wxEmptyString; - if (m_impl->frame) { - KJS::JSValue* result = m_impl->frame->loader()->executeScript(javascript, true); - if (result) - returnValue = wxString(result->toString(m_impl->frame->scriptProxy()->globalObject()->globalExec()).UTF8String().c_str(), wxConvUTF8); - } - return returnValue; + if (m_mainFrame) + return m_mainFrame->RunScript(javascript); + + return wxEmptyString; } -void wxWebView::LoadURL(wxString url) +void wxWebView::LoadURL(const wxString& url) { - if (m_impl->frame && m_impl->frame->loader()) { - WebCore::KURL kurl = WebCore::KURL(static_cast<const char*>(url.mb_str(wxConvUTF8))); - // 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); - } + if (m_mainFrame) + m_mainFrame->LoadURL(url); } bool wxWebView::GoBack() { - if (m_impl->frame && m_impl->frame->page()) { - return m_impl->frame->page()->goBack(); - } + if (m_mainFrame) + return m_mainFrame->GoBack(); + + return false; } bool wxWebView::GoForward() { - if (m_impl->frame && m_impl->frame->page()) - return m_impl->frame->page()->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_impl->frame) { - if (m_textMagnifier*TextSizeMultiplierRatio <= MaximumTextSizeMultiplier) - return true; - } + if (m_mainFrame) + return m_mainFrame->CanIncreaseTextSize(); + return false; } void wxWebView::IncreaseTextSize() { - if (CanIncreaseTextSize()) { - m_textMagnifier = m_textMagnifier*TextSizeMultiplierRatio; - m_impl->frame->setZoomFactor((int)rint(m_textMagnifier*100)); - } + if (m_mainFrame) + m_mainFrame->IncreaseTextSize(); } bool wxWebView::CanDecreaseTextSize() const { - if (m_impl->frame) { - if (m_textMagnifier/TextSizeMultiplierRatio >= MinimumTextSizeMultiplier) - return true; - } + if (m_mainFrame) + m_mainFrame->CanDecreaseTextSize(); + return false; } void wxWebView::DecreaseTextSize() { - if (CanDecreaseTextSize()) { - m_textMagnifier = m_textMagnifier/TextSizeMultiplierRatio; - m_impl->frame->setZoomFactor( (int)rint(m_textMagnifier*100)); - } + if (m_mainFrame) + m_mainFrame->DecreaseTextSize(); } void wxWebView::MakeEditable(bool enable) @@ -408,12 +398,17 @@ void wxWebView::MakeEditable(bool enable) void wxWebView::OnPaint(wxPaintEvent& event) { - if (m_beingDestroyed || !m_impl->frameView || !m_impl->frame) + + if (m_beingDestroyed || !m_mainFrame) + return; + + WebCore::Frame* frame = m_mainFrame->GetFrame(); + if (!frame || !frame->view()) return; wxAutoBufferedPaintDC dc(this); - if (IsShown() && m_impl->frame && m_impl->frame->document()) { + if (IsShown() && frame->document()) { #if USE(WXGC) wxGCDC gcdc(dc); #endif @@ -421,7 +416,10 @@ void wxWebView::OnPaint(wxPaintEvent& event) if (dc.IsOk()) { wxRect paintRect = GetUpdateRegion().GetBox(); - WebCore::IntSize offset = m_impl->frameView->scrollOffset(); + WebCore::IntSize offset = frame->view()->scrollOffset(); +#if USE(WXGC) + gcdc.SetDeviceOrigin(-offset.width(), -offset.height()); +#endif dc.SetDeviceOrigin(-offset.width(), -offset.height()); paintRect.Offset(offset.width(), offset.height()); @@ -430,103 +428,113 @@ void wxWebView::OnPaint(wxPaintEvent& event) #else WebCore::GraphicsContext* gc = new WebCore::GraphicsContext((wxWindowDC*)&dc); #endif - if (gc && m_impl->frame->renderer()) { - if (m_impl->frameView->needsLayout()) - m_impl->frameView->layout(); + if (gc && frame->contentRenderer()) { + if (frame->view()->needsLayout()) + frame->view()->layout(); - m_impl->frame->paint(gc, paintRect); + frame->view()->paintContents(gc, paintRect); } + delete gc; } } } void wxWebView::OnSize(wxSizeEvent& event) { - if (m_isInitialized && m_impl->frame && m_impl->frameView) { - m_impl->frame->sendResizeEvent(); - m_impl->frameView->layout(); + if (m_isInitialized && m_mainFrame) { + WebCore::Frame* frame = m_mainFrame->GetFrame(); + frame->sendResizeEvent(); + frame->view()->layout(); + frame->view()->adjustScrollbars(); } - + event.Skip(); - } void wxWebView::OnMouseEvents(wxMouseEvent& event) { event.Skip(); - if (!m_impl->frame && m_impl->frameView) + if (!m_mainFrame) 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) { WebCore::PlatformWheelEvent wkEvent(event, globalPoint); - m_impl->frame->eventHandler()->handleWheelEvent(wkEvent); + frame->eventHandler()->handleWheelEvent(wkEvent); return; } WebCore::PlatformMouseEvent wkEvent(event, globalPoint); if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN) - m_impl->frame->eventHandler()->handleMousePressEvent(wkEvent); + frame->eventHandler()->handleMousePressEvent(wkEvent); else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) - m_impl->frame->eventHandler()->handleMouseReleaseEvent(wkEvent); + frame->eventHandler()->handleMouseReleaseEvent(wkEvent); else if (type == wxEVT_MOTION) - m_impl->frame->eventHandler()->handleMouseMoveEvent(wkEvent); + frame->eventHandler()->mouseMoved(wkEvent); } bool wxWebView::CanCopy() { - if (m_impl->frame && m_impl->frameView) - return (m_impl->frame->editor()->canCopy() || m_impl->frame->editor()->canDHTMLCopy()); + if (m_mainFrame) + return m_mainFrame->CanCopy(); return false; } void wxWebView::Copy() { - if (CanCopy()) - m_impl->frame->editor()->copy(); + if (m_mainFrame) + m_mainFrame->Copy(); } bool wxWebView::CanCut() { - if (m_impl->frame && m_impl->frameView) - return (m_impl->frame->editor()->canCut() || m_impl->frame->editor()->canDHTMLCut()); + if (m_mainFrame) + m_mainFrame->CanCut(); return false; } void wxWebView::Cut() { - if (CanCut()) - m_impl->frame->editor()->cut(); + if (m_mainFrame) + m_mainFrame->Cut(); } bool wxWebView::CanPaste() { - if (m_impl->frame && m_impl->frameView) - return (m_impl->frame->editor()->canPaste() || m_impl->frame->editor()->canDHTMLPaste()); + if (m_mainFrame) + m_mainFrame->CanPaste(); return false; } void wxWebView::Paste() { - if (CanPaste()) - m_impl->frame->editor()->paste(); + if (m_mainFrame) + m_mainFrame->Paste(); } void wxWebView::OnKeyEvents(wxKeyEvent& event) { - if (m_impl->frame && m_impl->frameView) { + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (frame && frame->view()) { // WebCore doesn't handle these events itself, so we need to do // it and not send the event down or else CTRL+C will erase the text // and replace it with c. @@ -539,9 +547,9 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event) else { WebCore::PlatformKeyboardEvent wkEvent(event); if (wkEvent.type() == WebCore::PlatformKeyboardEvent::Char && wkEvent.altKey()) - m_impl->frame->eventHandler()->handleAccessKey(wkEvent); + frame->eventHandler()->handleAccessKey(wkEvent); else - m_impl->frame->eventHandler()->keyEvent(wkEvent); + frame->eventHandler()->keyEvent(wkEvent); } } @@ -552,17 +560,28 @@ void wxWebView::OnKeyEvents(wxKeyEvent& event) void wxWebView::OnSetFocus(wxFocusEvent& event) { - if (m_impl->frame) - m_impl->frame->selectionController()->setFocused(true); + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (frame) { + m_impl->page->focusController()->setActive(true); + frame->selection()->setFocused(true); + } event.Skip(); } void wxWebView::OnKillFocus(wxFocusEvent& event) { - if (m_impl->frame) - m_impl->frame->selectionController()->setFocused(false); - + WebCore::Frame* frame = 0; + if (m_mainFrame) + frame = m_mainFrame->GetFrame(); + + if (frame) { + m_impl->page->focusController()->setActive(false); + frame->selection()->setFocused(false); + } event.Skip(); } diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index 5dff4e8..b8fce63 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -35,6 +35,7 @@ class WebViewPrivate; class WebViewFrameData; +class wxWebFrame; namespace WebCore { class ChromeClientWx; @@ -55,32 +56,51 @@ namespace WebCore { #define WXDLLIMPEXP_WEBKIT #endif // SWIG +extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; + 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 "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, - WebViewFrameData* data = NULL); // For wxWebView internal data passing - + long style = 0, + const wxString& name = wxWebViewNameStr); // For wxWebView internal data passing + #ifndef SWIG ~wxWebView(); #endif - void LoadURL(wxString url); + void LoadURL(const wxString& url); bool GoBack(); bool GoForward(); void Stop(); void Reload(); + + bool CanGoBack(); + bool CanGoForward(); bool CanCut(); bool CanCopy(); @@ -109,6 +129,8 @@ public: wxString GetPageTitle() const { return m_title; } void SetPageTitle(const wxString& title) { m_title = title; } + + wxWebFrame* GetMainFrame() { return m_mainFrame; } protected: @@ -125,12 +147,14 @@ 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; WebViewPrivate* m_impl; + wxWebFrame* m_mainFrame; wxString m_title; }; @@ -244,12 +268,15 @@ class WXDLLIMPEXP_WEBKIT wxWebViewNewWindowEvent : public wxCommandEvent 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; } wxWebViewNewWindowEvent( wxWindow* win = static_cast<wxWindow*>(NULL)); wxEvent *Clone(void) const { return new wxWebViewNewWindowEvent(*this); } private: wxString m_url; + wxString m_targetName; }; class WXDLLIMPEXP_WEBKIT wxWebViewRightClickEvent : public wxCommandEvent @@ -298,11 +325,30 @@ private: wxString m_sourceID; }; +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; +}; + + 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::*wxWebViewReceivedTitleEventFunction)(wxWebViewReceivedTitleEvent&); #ifndef SWIG BEGIN_DECLARE_EVENT_TYPES() @@ -311,47 +357,56 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_CONSOLE_MESSAGE, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RECEIVED_TITLE, wxID_ANY) END_DECLARE_EVENT_TYPES() #endif -#define EVT_WEBVIEW_LOAD(func) \ +#define EVT_WEBVIEW_LOAD(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_LOAD, \ - wxID_ANY, \ + winid, \ wxID_ANY, \ (wxObjectEventFunction) \ (wxWebViewLoadEventFunction) & func, \ static_cast<wxObject*>(NULL)), -#define EVT_WEBVIEW_BEFORE_LOAD(func) \ +#define EVT_WEBVIEW_BEFORE_LOAD(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \ - wxID_ANY, \ + winid, \ wxID_ANY, \ (wxObjectEventFunction) \ (wxWebViewBeforeLoadEventFunction) & func, \ static_cast<wxObject*>(NULL)), -#define EVT_WEBVIEW_NEW_WINDOW(func) \ +#define EVT_WEBVIEW_NEW_WINDOW(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_NEW_WINDOW, \ - wxID_ANY, \ + winid, \ wxID_ANY, \ (wxObjectEventFunction) \ (wxWebViewNewWindowEventFunction) & func, \ static_cast<wxObject*>(NULL)), -#define EVT_WEBVIEW_RIGHT_CLICK(func) \ +#define EVT_WEBVIEW_RIGHT_CLICK(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \ - wxID_ANY, \ + winid, \ wxID_ANY, \ (wxObjectEventFunction) \ (wxWebViewRightClickEventFunction) & func, \ static_cast<wxObject*>(NULL)), -#define EVT_WEBVIEW_CONSOLE_MESSAGE(func) \ +#define EVT_WEBVIEW_CONSOLE_MESSAGE(winid, func) \ DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_CONSOLE_MESSAGE, \ - wxID_ANY, \ + winid, \ wxID_ANY, \ (wxObjectEventFunction) \ (wxWebViewConsoleMessageEventFunction) & 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)), + #endif // ifndef WXWEBVIEW_H diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h index 1e8ffcf..2eef499 100644 --- a/WebKit/wx/WebViewPrivate.h +++ b/WebKit/wx/WebViewPrivate.h @@ -41,12 +41,10 @@ class WebViewPrivate public: WebViewPrivate() : frame(0), - frameView(0), page(0) {} WTF::RefPtr<WebCore::Frame> frame; - WTF::RefPtr<WebCore::FrameView> frameView; WebCore::Page* page; }; diff --git a/WebKit/wx/bindings/python/webview.i b/WebKit/wx/bindings/python/webview.i index 565b12c..e9926ad 100644 --- a/WebKit/wx/bindings/python/webview.i +++ b/WebKit/wx/bindings/python/webview.i @@ -23,13 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -%module(package="wx") webview +%module webview %{ #include "wx/wxPython/wxPython.h" #include "wx/wxPython/pyclasses.h" #include "WebView.h" -#include "WebFrame.h" +#include "WebBrowserShell.h" %} //--------------------------------------------------------------------------- @@ -38,22 +38,23 @@ %import windows.i MustHaveApp(wxWebView); -MustHaveApp(wxWebFrame); +MustHaveApp(wxWebBrowserShell); %include WebView.h -%include WebFrame.h - -%pythoncode { wx = _core } -%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } +%include WebBrowserShell.h %constant wxEventType wxEVT_WEBVIEW_BEFORE_LOAD; -%constant wxEventType wxEVT_WEBVIEW_STATE_CHANGED; +%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; %pythoncode { -EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD ) -EVT_WEBVIEW_STATE_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_STATE_CHANGED ) -EVT_WEBVIEW_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEW_WINDOW ) -EVT_WEBVIEW_RIGHT_CLICK = wx.PyEventBinder( wxEVT_WEBVIEW_RIGHT_CLICK ) +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 ) } diff --git a/WebKit/wx/bindings/python/wxwebkit-py.bkl b/WebKit/wx/bindings/python/wxwebkit-py.bkl index 163d95d..d6c2f7a 100644 --- a/WebKit/wx/bindings/python/wxwebkit-py.bkl +++ b/WebKit/wx/bindings/python/wxwebkit-py.bkl @@ -72,8 +72,6 @@ Bakefile for wxWebKit Python bindings. <runtime-libs>dynamic</runtime-libs> <dllname>_webview</dllname> - <set var="BUILDDIR">obj-$(FORMAT)</set> - <include>$(WK_ROOT)/WebCore/platform/wx</include> <include>$(WK_ROOT)/WebCore/bridge/wx</include> <include>$(WK_ROOT)/WebCore/page/wx</include> @@ -83,10 +81,10 @@ Bakefile for wxWebKit Python bindings. <if cond="FORMAT=='gnu'"> <sys-lib>png</sys-lib> <set var="MAC_FLAGS"> - <if cond="WX_PORT=='mac'">-bundle</if> + <if cond="WX_PORT=='mac'">-bundle -undefined dynamic_lookup</if> </set> - <ldflags>$(MAC_FLAGS) -undefined dynamic_lookup</ldflags> + <ldflags>$(MAC_FLAGS)</ldflags> </if> <if cond="FORMAT in ['msvc','msvs2005prj']"> <set var="PY_LIBNAME"> diff --git a/WebKit/wx/dependencies.bkl b/WebKit/wx/dependencies.bkl index 089d33f..e9eedb4 100644 --- a/WebKit/wx/dependencies.bkl +++ b/WebKit/wx/dependencies.bkl @@ -107,7 +107,7 @@ and WebCore. Include this file to use these settings. </if> <if cond="PLATFORM_WIN32=='1'"> - <include>$(WK_ROOT)/WebKitLibraries/win/include/libxml</include> + <include>$(WK_ROOT)/WebKitLibraries/win/include</include> <sys-lib>libxml2</sys-lib> </if> </template> @@ -129,7 +129,7 @@ and WebCore. Include this file to use these settings. </if> <if cond="PLATFORM_WIN32=='1'"> - <include>$(WK_ROOT)/WebKitLibraries/win/include/libxslt</include> + <include>$(WK_ROOT)/WebKitLibraries/win/include</include> <sys-lib>libxslt</sys-lib> </if> </template> @@ -167,6 +167,9 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/WebKitLibraries/win/include/pthreads</include> <sys-lib>pthreadVC2</sys-lib> </if> + <if cond="FORMAT=='gnu'"> + <sys-lib>pthread</sys-lib> + </if> </template> </makefile> diff --git a/WebKit/wx/presets/wxwebkit.bkl b/WebKit/wx/presets/wxwebkit.bkl index 7fc59d2..80ffd2f 100644 --- a/WebKit/wx/presets/wxwebkit.bkl +++ b/WebKit/wx/presets/wxwebkit.bkl @@ -71,10 +71,21 @@ and WebCore. Include this file to use these settings. </option> </if> + <if cond="not isdefined('DEBUG')"> + <option name="DEBUG"> + <values>0,1</values> + <default-value>0</default-value> + <description> + Whether or not to build debug + </description> + </option> + </if> + <template id="jscore"> <if cond="FORMAT in ['msvc', 'msvs2005prj']"> <!-- MSVC chokes on #import, so don't use ForwardingHeaders... --> <include>$(WK_ROOT)/JavaScriptCore/os-win32</include><!-- stdint.h is here --> + <include>$(WKOUTPUTDIR)</include> </if> </template> @@ -90,17 +101,18 @@ and WebCore. Include this file to use these settings. <define>HAVE_FLOAT_H=1</define> <define>HAVE_FUNC__FINITE=1</define> </if> - + + <include>$(WKOUTPUTDIR)</include> <include>$(WK_ROOT)/WebCore</include> <include>$(WK_ROOT)/WebCore/DerivedSources/WebCore</include> <include>$(WK_ROOT)/WebCore/bindings/js</include> <include>$(WK_ROOT)/WebCore/bridge</include> + <include>$(WK_ROOT)/WebCore/css</include> + <include>$(WK_ROOT)/WebCore/dom</include> <include>$(WK_ROOT)/WebCore/editing</include> <include>$(WK_ROOT)/WebCore/history</include> <include>$(WK_ROOT)/WebCore/html</include> - <include>$(WK_ROOT)/WebCore/css</include> - <include>$(WK_ROOT)/WebCore/dom</include> - <include>$(WK_ROOT)/WebCore/kwq</include> + <include>$(WK_ROOT)/WebCore/inspector</include> <include>$(WK_ROOT)/WebCore/loader</include> <include>$(WK_ROOT)/WebCore/loader/icon</include> <include>$(WK_ROOT)/WebCore/page</include> @@ -116,12 +128,16 @@ and WebCore. Include this file to use these settings. <include>$(WK_ROOT)/WebCore/platform/sql</include> <include>$(WK_ROOT)/WebCore/platform/text</include> <include>$(WK_ROOT)/WebCore/rendering</include> + <include>$(WK_ROOT)/WebCore/rendering/style</include> <include>$(WK_ROOT)/WebCore/storage</include> <include>$(WK_ROOT)/WebCore/xml</include> <include>$(WK_ROOT)/JavaScriptCore</include> <include>$(WK_ROOT)/JavaScriptCore/kjs</include> <include>$(WK_ROOT)/JavaScriptCore/pcre</include> + <include>$(WK_ROOT)/JavaScriptCore/profiler</include> + <include>$(WK_ROOT)/JavaScriptCore/runtime</include> + <include>$(WK_ROOT)/JavaScriptCore/VM</include> <include>$(WK_ROOT)/JavaScriptCore/wtf</include> </template> diff --git a/WebKit/wx/wxwebkit.bkl b/WebKit/wx/wxwebkit.bkl index 7e242f0..ccf6752 100644 --- a/WebKit/wx/wxwebkit.bkl +++ b/WebKit/wx/wxwebkit.bkl @@ -34,8 +34,6 @@ This file builds the wxWebKit library. <makefile> <include file="wxwk-settings.bkl"/> - <set var="BUILDDIR">obj-$(FORMAT)</set> - <dll id="wxwebkit-dynamic" template="wxwk,jscore,webcore,xml2,iconv,xslt,icu,curl,sqlite3,gtk,pthreads"> <!-- make sure we relink wxwebkit if either webcore or jscore change --> <if cond="FORMAT=='gnu'"> @@ -49,8 +47,6 @@ This file builds the wxWebKit library. <runtime-libs>dynamic</runtime-libs> <dllname>wxwebkit</dllname> <libname>wxwebkit</libname> - - <set var="BUILDDIR">obj-$(FORMAT)</set> <include>$(WK_ROOT)/WebCore/platform/graphics/wx</include> <include>$(WK_ROOT)/WebCore/platform/wx</include> @@ -63,12 +59,9 @@ This file builds the wxWebKit library. <sys-lib>webcore-wx</sys-lib> <sys-lib>jscore</sys-lib> - <if cond="FORMAT=='gnu'"> - <sys-lib>png</sys-lib> - <sys-lib>jpeg</sys-lib> - </if> <if cond="FORMAT in ['msvc','msvs2005prj']"> <sys-lib>winmm</sys-lib> <!-- for timeGetTime --> + <sys-lib>gdiplus</sys-lib> <sys-lib>libpng</sys-lib> <sys-lib>libjpeg</sys-lib> </if> @@ -81,8 +74,9 @@ This file builds the wxWebKit library. WebKitSupport/FrameLoaderClientWx.cpp WebKitSupport/InspectorClientWx.cpp - WebView.cpp WebFrame.cpp + WebView.cpp + WebBrowserShell.cpp </sources> </dll> diff --git a/WebKit/wx/wxwk-settings.bkl b/WebKit/wx/wxwk-settings.bkl index e312c05..4328576 100644 --- a/WebKit/wx/wxwk-settings.bkl +++ b/WebKit/wx/wxwk-settings.bkl @@ -37,6 +37,7 @@ JavaScriptCore Bakefile project file. <include file="presets/wxwebkit.bkl"/> <include file="dependencies.bkl"/> + <set var="BUILDDIR">obj-$(FORMAT)</set> <!-- the WX_PYTHON option was added to presets/wx.bkl in 2.8.5, so define it in case the presets/wx.bkl doesn't define it for us. --> @@ -50,7 +51,17 @@ JavaScriptCore Bakefile project file. <cxx-rtti>on</cxx-rtti> <cxx-exceptions>on</cxx-exceptions> <define>BUILDING_WX__=1</define> - <debug-info>on</debug-info> + <define>ENABLE_DOM_STORAGE</define> + <define> + $(substituteFromDict(DEBUG,{'1':'','0':'NDEBUG'})) + </define> + <define>USE_SYSTEM_MALLOC</define> + <optimize> + $(substituteFromDict(DEBUG,{'1':'off','0':'speed'})) + </optimize> + <debug-info> + $(substituteFromDict(DEBUG,{'1':'on','0':'off'})) + </debug-info> <if cond="FORMAT in ['msvc', 'msvs2005prj']"> <set var="DEBUG_RUNTIME"> <if cond="WX_PYTHON=='1' and WX_DEBUG=='0'">off</if> @@ -72,6 +83,14 @@ JavaScriptCore Bakefile project file. </if> </template> <template id="wxwk" template="wxwk_build_settings,wx"> + <!-- + since wx 2.8's libpng and libjpeg symbols get exported when using gcc/gnu make + we need to make sure our versions appear first, so that it will get the symbols + from the right place + --> + <if cond="FORMAT=='gnu'"> + <ldflags>-ljpeg -lpng</ldflags> + </if> <wx-lib>core</wx-lib> <wx-lib>base</wx-lib> <if cond="PLATFORM_WIN32=='1'"> |