diff options
Diffstat (limited to 'WebKit/wx')
-rw-r--r-- | WebKit/wx/ChangeLog | 231 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.cpp | 41 | ||||
-rw-r--r-- | WebKit/wx/WebFrame.h | 6 | ||||
-rw-r--r-- | WebKit/wx/WebFramePrivate.h | 22 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.cpp | 6 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/ChromeClientWx.h | 3 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/EditorClientWx.cpp | 50 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp | 122 | ||||
-rw-r--r-- | WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 10 | ||||
-rw-r--r-- | WebKit/wx/WebView.cpp | 110 | ||||
-rw-r--r-- | WebKit/wx/WebView.h | 47 | ||||
-rw-r--r-- | WebKit/wx/WebViewPrivate.h | 20 | ||||
-rw-r--r-- | WebKit/wx/bindings/python/wscript | 19 | ||||
-rw-r--r-- | WebKit/wx/wscript | 41 |
14 files changed, 539 insertions, 189 deletions
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog index 455aebd..76f4533 100644 --- a/WebKit/wx/ChangeLog +++ b/WebKit/wx/ChangeLog @@ -1,3 +1,234 @@ +2009-10-07 Adam Barth <abarth@webkit.org> + + Reviewed by Darin Adler. + + Factor PolicyChecker out of FrameLoader + https://bugs.webkit.org/show_bug.cgi?id=30155 + + Move the policy callback to the policy object. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + +2009-09-25 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Add EmptyPluginHalterClient when creating the Page. + + * WebView.cpp: + (wxWebView::Create): + +2009-09-22 Kevin Ollivier <kevino@theolliviers.com> + + Build fix to ensure the import library gets properly installed on Windows. + + * wscript: + +2009-09-17 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Simon Hausmann. + + Make PlatformWindow return something else than PlatformWidget + https://bugs.webkit.org/show_bug.cgi?id=29085 + + Reflect the rename of platformWindow and it's return type. + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformPageClient): + * WebKitSupport/ChromeClientWx.h: + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + +2009-09-16 Kevin Ollivier <kevino@theolliviers.com> + + wxPython bindings build fixes after recent changes. + + * WebView.h: + * bindings/python/wscript: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow a way to set the cache policy via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29200 + + * WebView.cpp: + (wxWebView::SetCachePolicy): + (wxWebView::GetCachePolicy): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Allow the user to query Frame::shouldClose via wx API. + + https://bugs.webkit.org/show_bug.cgi?id=29199 + + * WebFrame.cpp: + (wxWebFrame::ShouldClose): + * WebFrame.h: + * WebView.cpp: + (wxWebView::ShouldClose): + * WebView.h: + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Fix mouse handling when the mouse leaves the window during mouse down. + + https://bugs.webkit.org/show_bug.cgi?id=29198 + + * WebView.cpp: + (wxWebView::OnMouseEvents): + +2009-09-13 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Add support for console MessageLevel at wx API level. + + https://bugs.webkit.org/show_bug.cgi?id=29197 + + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::addMessageToConsole): + * WebView.h: + +2009-09-03 Adam Barth <abarth@webkit.org> + + Reviewed by eric@webkit.org. + + https://bugs.webkit.org/show_bug.cgi?id=24696 + + Stub implementations of mixed content methods of FrameLoaderClient. + + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::didDisplayInsecureContent): + (WebCore::FrameLoaderClientWx::didRunInsecureContent): + * WebKitSupport/FrameLoaderClientWx.h: + +2009-09-03 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Frames support + https://bugs.webkit.org/show_bug.cgi?id=19041 + + * WebFrame.cpp: + (wxWebFrame::wxWebFrame): + (wxWebFrame::~wxWebFrame): + (wxWebFrame::GetFrame): + * WebFrame.h: + * WebFramePrivate.h: + * WebKitSupport/ChromeClientWx.cpp: + (WebCore::ChromeClientWx::platformWindow): + (WebCore::ChromeClientWx::scroll): + * WebKitSupport/EditorClientWx.cpp: + (WebCore::EditorClientWx::isEditable): + (WebCore::EditorClientWx::registerCommandForUndo): + (WebCore::EditorClientWx::registerCommandForRedo): + (WebCore::EditorClientWx::clearUndoRedoOperations): + (WebCore::EditorClientWx::canUndo): + (WebCore::EditorClientWx::canRedo): + (WebCore::EditorClientWx::undo): + (WebCore::EditorClientWx::redo): + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::FrameLoaderClientWx): + (WebCore::FrameLoaderClientWx::setFrame): + (WebCore::FrameLoaderClientWx::dispatchWillSubmitForm): + (WebCore::FrameLoaderClientWx::frameLoaderDestroyed): + (WebCore::FrameLoaderClientWx::committedLoad): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForMIMEType): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction): + (WebCore::FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction): + (WebCore::FrameLoaderClientWx::createFrame): + (WebCore::FrameLoaderClientWx::transitionToCommittedForNewPage): + * WebKitSupport/FrameLoaderClientWx.h: + * WebView.h: + * WebViewPrivate.h: + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + waf build fixes for Windows/MSVC. + + * bindings/python/wscript: + * wscript: + +2009-09-02 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + wx port: Call WTF::initializeThreading(). + https://bugs.webkit.org/show_bug.cgi?id=28912 + + * WebView.cpp: + (wxWebView::Create): call WTF::initializeThreading() + +2009-09-02 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Use the 2 param KURL constructor. + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-31 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28852 + Rename KURL single argument constructor to avoid confusion + + * WebFrame.cpp: (wxWebFrame::SetPageSource): Adapt to the change. + +2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Holger Freyther. + + https://bugs.webkit.org/show_bug.cgi?id=25889 + [GTK] scrollbar policy for main frame is not implementable + + Add empty implementation for new ChromeClient method. + + * WebKitSupport/ChromeClientWx.h: + (WebCore::ChromeClientWx::scrollbarsModeDidChange): + +2009-08-19 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + Use FrameLoader::load() for loading pages from a HTML page string to address + bugs with using begin/write/end loading. + + https://bugs.webkit.org/show_bug.cgi?id=28488 + + * WebFrame.cpp: + (wxWebFrame::SetPageSource): + +2009-08-13 Kevin Ollivier <kevino@theolliviers.com> + + wx build fix. Make sure that the wxWebKit dynamic library is rebuilt whenever + webcore or jscore libs change. + + * wscript: + +2009-08-12 Kevin Ollivier <kevino@theolliviers.com> + + wxPython build fix, the SWIG defines must also be available when compiling. + + * bindings/python/wscript: + 2009-08-05 Kevin Ollivier <kevino@theolliviers.com> Reviewed by Eric Seidel. diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp index 630eb8f..f205152 100644 --- a/WebKit/wx/WebFrame.cpp +++ b/WebKit/wx/WebFrame.cpp @@ -42,6 +42,7 @@ #include "RenderView.h" #include "ScriptController.h" #include "ScriptValue.h" +#include "SubstituteData.h" #include "TextEncoding.h" #include "JSDOMBinding.h" @@ -73,8 +74,7 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat m_textMagnifier(1.0), m_isEditable(false), m_isInitialized(false), - m_beingDestroyed(false), - m_title(wxEmptyString) + m_beingDestroyed(false) { m_impl = new WebFramePrivate(); @@ -86,13 +86,16 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat } WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); - - m_impl->frame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); - m_impl->frame->deref(); + RefPtr<WebCore::Frame> newFrame = WebCore::Frame::create(container->m_impl->page, parentFrame, loaderClient); + + m_impl->frame = newFrame.get(); - loaderClient->setFrame(m_impl->frame.get()); + loaderClient->setFrame(this); loaderClient->setWebView(container); + if (data && data->ownerElement) + m_impl->frame->ref(); + m_impl->frame->init(); m_isInitialized = true; @@ -100,13 +103,14 @@ wxWebFrame::wxWebFrame(wxWebView* container, wxWebFrame* parent, WebViewFrameDat wxWebFrame::~wxWebFrame() { - m_impl->frame->loader()->detachFromParent(); + if (m_impl) + delete m_impl; } WebCore::Frame* wxWebFrame::GetFrame() { if (m_impl) - return m_impl->frame.get(); + return m_impl->frame; return 0; } @@ -142,10 +146,16 @@ wxString wxWebFrame::GetPageSource() void wxWebFrame::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(WebCore::KURL(), static_cast<const char*>(baseUrl.mb_str(wxConvUTF8)), WebCore::UTF8Encoding())); - loader->write(static_cast<const WebCore::String>(source)); - loader->end(); + WebCore::KURL url(WebCore::KURL(), static_cast<const char*>(baseUrl.mb_str(wxConvUTF8))); + + wxCharBuffer charBuffer(source.mb_str(wxConvUTF8)); + const char* contents = charBuffer; + + WTF::PassRefPtr<WebCore::SharedBuffer> sharedBuffer = WebCore::SharedBuffer::create(contents, strlen(contents)); + WebCore::SubstituteData substituteData(sharedBuffer, WebCore::String("text/html"), WebCore::String("UTF-8"), WebCore::blankURL(), url); + + m_impl->frame->loader()->stop(); + m_impl->frame->loader()->load(WebCore::ResourceRequest(url), substituteData, false); } } @@ -383,3 +393,10 @@ wxWebViewDOMElementInfo wxWebFrame::HitTest(const wxPoint& pos) const return domInfo; } +bool wxWebFrame::ShouldClose() const +{ + if (m_impl->frame) + return m_impl->frame->shouldClose(); + + return true; +} diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h index 9bf21cd..bd4bdb0 100644 --- a/WebKit/wx/WebFrame.h +++ b/WebKit/wx/WebFrame.h @@ -146,21 +146,19 @@ public: void ResetTextSize(); 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(); wxWebViewDOMElementInfo HitTest(const wxPoint& post) const; + bool ShouldClose() const; + private: float m_textMagnifier; bool m_isEditable; bool m_isInitialized; bool m_beingDestroyed; WebFramePrivate* m_impl; - wxString m_title; }; diff --git a/WebKit/wx/WebFramePrivate.h b/WebKit/wx/WebFramePrivate.h index 7af70a8..58bc40a 100644 --- a/WebKit/wx/WebFramePrivate.h +++ b/WebKit/wx/WebFramePrivate.h @@ -30,11 +30,9 @@ #define WXWEBFRAMEPRIVATE_H #include "config.h" -#include "EditCommand.h" -#include "EditCommandWx.h" #include "Frame.h" -#include "wtf/RefPtr.h" -#include "wtf/Vector.h" +#include "HTMLFrameOwnerElement.h" +#include "KURL.h" class WebFramePrivate { @@ -42,11 +40,21 @@ public: WebFramePrivate() : frame(0) {} + + WebCore::Frame* frame; +}; - WTF::Vector<EditCommandWx> undoStack; - WTF::Vector<EditCommandWx> redoStack; +class WebViewFrameData +{ +public: + WebCore::KURL url; + WebCore::String name; + WebCore::HTMLFrameOwnerElement* ownerElement; - WTF::RefPtr<WebCore::Frame> frame; + WebCore::String referrer; + bool allowsScrolling; + int marginWidth; + int marginHeight; }; #endif diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp index b25fce9..9b2f264 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -212,6 +212,7 @@ void ChromeClientWx::addMessageToConsole(MessageSource source, wkEvent.SetMessage(message); wkEvent.SetLineNumber(lineNumber); wkEvent.SetSourceID(sourceID); + wkEvent.SetLevel(static_cast<wxWebViewConsoleMessageLevel>(level)); m_webView->GetEventHandler()->ProcessEvent(wkEvent); } } @@ -338,9 +339,9 @@ IntPoint ChromeClientWx::screenToWindow(const IntPoint& point) const return point; } -PlatformWidget ChromeClientWx::platformWindow() const +PlatformPageClient ChromeClientWx::platformPageClient() const { - return 0; + return m_webView; } void ChromeClientWx::contentsSizeChanged(Frame*, const IntSize&) const @@ -393,6 +394,7 @@ void ChromeClientWx::reachedMaxAppCacheSize(int64_t spaceNeeded) void ChromeClientWx::scroll(const IntSize&, const IntRect&, const IntRect&) { + m_webView->Refresh(); notImplemented(); } diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h index 85335c8..07f70a8 100644 --- a/WebKit/wx/WebKitSupport/ChromeClientWx.h +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -104,9 +104,10 @@ public: 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 PlatformPageClient platformPageClient() const; virtual void contentsSizeChanged(Frame*, const IntSize&) const; + virtual void scrollbarsModeDidChange() const { } virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); virtual void setToolTip(const String&, TextDirection); diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp index 3808bfe..bd3af48 100644 --- a/WebKit/wx/WebKitSupport/EditorClientWx.cpp +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -202,7 +202,7 @@ bool EditorClientWx::isEditable() Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) return webKitWin->IsEditable(); } @@ -285,9 +285,9 @@ void EditorClientWx::registerCommandForUndo(PassRefPtr<EditCommand> command) Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->GetMainFrame()->m_impl->undoStack.append(EditCommandWx(command)); + webKitWin->m_impl->undoStack.append(EditCommandWx(command)); } } } @@ -297,16 +297,24 @@ void EditorClientWx::registerCommandForRedo(PassRefPtr<EditCommand> command) Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); if (webKitWin) { - webKitWin->GetMainFrame()->m_impl->redoStack.insert(0, EditCommandWx(command)); + webKitWin->m_impl->redoStack.insert(0, EditCommandWx(command)); } } } void EditorClientWx::clearUndoRedoOperations() { - notImplemented(); + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->redoStack.clear(); + webKitWin->m_impl->undoStack.clear(); + } + } } bool EditorClientWx::canUndo() const @@ -314,9 +322,9 @@ bool EditorClientWx::canUndo() const Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - return webKitWin->GetMainFrame()->m_impl->undoStack.size() != 0; + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + return webKitWin->m_impl->undoStack.size() != 0; } } return false; @@ -327,9 +335,9 @@ bool EditorClientWx::canRedo() const Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - return webKitWin->GetMainFrame()->m_impl->redoStack.size() != 0; + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin && webKitWin) { + return webKitWin->m_impl->redoStack.size() != 0; } } return false; @@ -340,10 +348,10 @@ void EditorClientWx::undo() Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - webKitWin->GetMainFrame()->m_impl->undoStack.last().editCommand()->unapply(); - webKitWin->GetMainFrame()->m_impl->undoStack.removeLast(); + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->undoStack.last().editCommand()->unapply(); + webKitWin->m_impl->undoStack.removeLast(); } } } @@ -352,11 +360,11 @@ void EditorClientWx::redo() { Frame* frame = m_page->focusController()->focusedOrMainFrame(); - if (frame) { - wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->platformWidget()); - if (webKitWin && webKitWin->GetMainFrame()) { - webKitWin->GetMainFrame()->m_impl->redoStack.first().editCommand()->reapply(); - webKitWin->GetMainFrame()->m_impl->redoStack.remove(0); + if (frame) { + wxWebView* webKitWin = dynamic_cast<wxWebView*>(frame->view()->hostWindow()->platformPageClient()); + if (webKitWin) { + webKitWin->m_impl->redoStack.first().editCommand()->reapply(); + webKitWin->m_impl->redoStack.remove(0); } } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 9603bd5..0a5eeaf 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -48,10 +48,13 @@ #include "ResourceResponse.h" #include "ScriptController.h" #include "ScriptString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> #include <stdio.h> #include "WebFrame.h" +#include "WebFramePrivate.h" #include "WebView.h" #include "WebViewPrivate.h" @@ -77,7 +80,7 @@ inline int wxNavTypeFromWebNavType(NavigationType type){ } FrameLoaderClientWx::FrameLoaderClientWx() - : m_frame(0) + : m_webFrame(0) { } @@ -86,9 +89,10 @@ FrameLoaderClientWx::~FrameLoaderClientWx() { } -void FrameLoaderClientWx::setFrame(Frame *frame) +void FrameLoaderClientWx::setFrame(wxWebFrame *frame) { - m_frame = frame; + m_webFrame = frame; + m_frame = m_webFrame->m_impl->frame; } void FrameLoaderClientWx::setWebView(wxWebView *webview) @@ -96,11 +100,6 @@ void FrameLoaderClientWx::setWebView(wxWebView *webview) m_webView = webview; } -void FrameLoaderClientWx::detachFrameLoader() -{ - m_frame = 0; -} - bool FrameLoaderClientWx::hasWebView() const { return m_webView != NULL; @@ -339,9 +338,9 @@ void FrameLoaderClientWx::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState>) { // FIXME: Send an event to allow for alerts and cancellation - if (!m_frame) + if (!m_webFrame) return; - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } @@ -505,6 +504,9 @@ void FrameLoaderClientWx::dispatchDidReceiveIcon() void FrameLoaderClientWx::frameLoaderDestroyed() { + if (m_webFrame) + delete m_webFrame; + m_webFrame = 0; m_frame = 0; delete this; } @@ -536,6 +538,16 @@ bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const return true; } +void FrameLoaderClientWx::didDisplayInsecureContent() +{ + notImplemented(); +} + +void FrameLoaderClientWx::didRunInsecureContent(WebCore::SecurityOrigin*) +{ + notImplemented(); +} + void FrameLoaderClientWx::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*) { notImplemented(); @@ -553,7 +565,7 @@ void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader*, const W void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) { - if (!m_frame) + if (!m_webFrame) return; FrameLoader* fl = loader->frameLoader(); fl->setEncoding(m_response.textEncodingName(), false); @@ -693,16 +705,16 @@ Frame* FrameLoaderClientWx::dispatchCreatePage() void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request) { - if (!m_frame) + if (!m_webFrame) return; notImplemented(); - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest& request, PassRefPtr<FormState>, const String& targetName) { - if (!m_frame) + if (!m_webFrame) return; if (m_webView) { @@ -712,17 +724,17 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc if (m_webView->GetEventHandler()->ProcessEvent(wkEvent)) { // if the app handles and doesn't skip the event, // from WebKit's perspective treat it as blocked / ignored - (m_frame->loader()->*function)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); return; } } - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>) { - if (!m_frame) + if (!m_webFrame) return; if (m_webView) { @@ -732,9 +744,9 @@ void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFun m_webView->GetEventHandler()->ProcessEvent(wkEvent); if (wkEvent.IsCancelled()) - (m_frame->loader()->*function)(PolicyIgnore); + (m_frame->loader()->policyChecker()->*function)(PolicyIgnore); else - (m_frame->loader()->*function)(PolicyUse); + (m_frame->loader()->policyChecker()->*function)(PolicyUse); } } @@ -752,56 +764,34 @@ void FrameLoaderClientWx::startDownload(const ResourceRequest&) PassRefPtr<Frame> FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { -/* - FIXME: Temporarily disabling code for loading subframes. While most - (i)frames load and are destroyed properly, the iframe created by - google.com in its new homepage does not get destroyed when - document()->detach() is called, as other (i)frames do. It is destroyed on - app shutdown, but until that point, this 'in limbo' frame will do things - like steal keyboard focus and crash when clicked on. (On some platforms, - it is actually a visible object, even though it's not in a valid state.) - - Since just about every user is probably going to test against Google at - some point, I'm disabling this functionality until I have time to track down - why it is not being destroyed. -*/ - -/* - wxWindow* parent = m_webView; - WebViewFrameData* data = new WebViewFrameData(); data->name = name; data->ownerElement = ownerElement; data->url = url; data->referrer = referrer; + data->allowsScrolling = allowsScrolling; data->marginWidth = marginWidth; data->marginHeight = marginHeight; - wxWebView* newWin = new wxWebView(parent, -1, wxDefaultPosition, wxDefaultSize, data); + wxWebFrame* newFrame = new wxWebFrame(m_webView, m_webFrame, data); - RefPtr<Frame> childFrame = newWin->m_impl->frame; + RefPtr<Frame> childFrame = adoptRef(newFrame->m_impl->frame); - // FIXME: All of the below should probably be moved over into WebCore - childFrame->tree()->setName(name); m_frame->tree()->appendChild(childFrame); - // ### set override encoding if we have one + childFrame->tree()->setName(name); + childFrame->init(); - FrameLoadType loadType = m_frame->loader()->loadType(); - FrameLoadType childLoadType = FrameLoadTypeInternal; + // The creation of the frame may have run arbitrary JavaScript that removed it from the page already. + if (!childFrame->page()) + return 0; - childFrame->loader()->load(url, referrer, childLoadType, - String(), 0, 0); + childFrame->loader()->loadURLIntoChildFrame(url, referrer, childFrame.get()); // The frame's onload handler may have removed it from the document. if (!childFrame->tree()->parent()) return 0; - delete data; - - return childFrame.get(); -*/ - notImplemented(); - return 0; + return childFrame.release(); } ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const String& mimeType) @@ -880,29 +870,19 @@ void FrameLoaderClientWx::transitionToCommittedFromCachedFrame(CachedFrame*) void FrameLoaderClientWx::transitionToCommittedForNewPage() { + ASSERT(m_webFrame); ASSERT(m_frame); ASSERT(m_webView); - Page* page = m_frame->page(); - ASSERT(page); - - bool isMainFrame = m_frame == page->mainFrame(); - - m_frame->setView(0); - - RefPtr<FrameView> frameView; - if (isMainFrame) - frameView = FrameView::create(m_frame, IntRect(m_webView->GetRect()).size()); - else - frameView = FrameView::create(m_frame); - - ASSERT(frameView); - m_frame->setView(frameView); - - frameView->setPlatformWidget(m_webView); - - if (HTMLFrameOwnerElement* owner = m_frame->ownerElement()) - m_frame->view()->setScrollbarModes(owner->scrollingMode(), owner->scrollingMode()); + IntSize size = IntRect(m_webView->GetRect()).size(); + // FIXME: This value should be gotten from m_webView->IsTransparent(); + // but transitionToCommittedForNewPage() can be called while m_webView is + // still being initialized. + bool transparent = false; + Color backgroundColor = transparent ? WebCore::Color::transparent : WebCore::Color::white; + + if (m_frame) + m_frame->createView(size, backgroundColor, transparent, IntSize(), false); } } diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index 7b44149..bfa162f 100644 --- a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -33,6 +33,7 @@ #include "KURL.h" #include "ResourceResponse.h" +class wxWebFrame; class wxWebView; namespace WebCore { @@ -51,9 +52,8 @@ namespace WebCore { public: FrameLoaderClientWx(); ~FrameLoaderClientWx(); - void setFrame(Frame *frame); + void setFrame(wxWebFrame *frame); void setWebView(wxWebView *webview); - virtual void detachFrameLoader(); virtual bool hasWebView() const; // mainly for assertions @@ -150,6 +150,9 @@ namespace WebCore { virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); virtual bool canCachePage() const; + virtual void didDisplayInsecureContent(); + virtual void didRunInsecureContent(SecurityOrigin*); + virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); virtual void committedLoad(DocumentLoader*, const char*, int); virtual ResourceError cancelledError(const ResourceRequest&); @@ -207,7 +210,8 @@ namespace WebCore { virtual void registerForIconNotification(bool listen = true); private: - Frame *m_frame; + wxWebFrame *m_webFrame; + Frame* m_frame; wxWebView *m_webView; ResourceResponse m_response; bool m_firstData; diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp index 6bb1f7c..88b5990 100644 --- a/WebKit/wx/WebView.cpp +++ b/WebKit/wx/WebView.cpp @@ -24,10 +24,15 @@ */ #include "config.h" +#include "Cache.h" +#include "ContextMenu.h" +#include "ContextMenuItem.h" +#include "ContextMenuController.h" #include "CString.h" #include "Document.h" #include "Element.h" #include "Editor.h" +#include "EmptyClients.h" #include "EventHandler.h" #include "FocusController.h" #include "Frame.h" @@ -37,19 +42,18 @@ #include "Logging.h" #include "markup.h" #include "Page.h" -#include "ContextMenu.h" -#include "ContextMenuItem.h" -#include "ContextMenuController.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformString.h" #include "PlatformWheelEvent.h" +#include "PluginHalterClient.h" #include "RenderObject.h" #include "RenderView.h" #include "Scrollbar.h" #include "SelectionController.h" #include "Settings.h" #include "SubstituteData.h" +#include "Threading.h" #include "ChromeClientWx.h" #include "ContextMenuClientWx.h" @@ -222,6 +226,26 @@ wxWebViewDOMElementInfo::wxWebViewDOMElementInfo() : { } +static wxWebViewCachePolicy gs_cachePolicy; + +/* static */ +void wxWebView::SetCachePolicy(const wxWebViewCachePolicy& cachePolicy) +{ + WebCore::Cache* globalCache = WebCore::cache(); + globalCache->setCapacities(cachePolicy.GetMinDeadCapacity(), + cachePolicy.GetMaxDeadCapacity(), + cachePolicy.GetCapacity()); + + // store a copy since there is no getter for Cache values + gs_cachePolicy = cachePolicy; +} + +/* static */ +wxWebViewCachePolicy wxWebView::GetCachePolicy() +{ + return gs_cachePolicy; +} + BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_PAINT(wxWebView::OnPaint) EVT_SIZE(wxWebView::OnSize) @@ -233,7 +257,6 @@ BEGIN_EVENT_TABLE(wxWebView, wxWindow) EVT_CHAR(wxWebView::OnKeyEvents) EVT_SET_FOCUS(wxWebView::OnSetFocus) EVT_KILL_FOCUS(wxWebView::OnKillFocus) - EVT_ACTIVATE(wxWebView::OnActivate) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxWebView, wxWindow) @@ -265,11 +288,12 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, { if ( (style & wxBORDER_MASK) == 0) style |= wxBORDER_NONE; - style |= wxHSCROLL | wxVSCROLL; if (!wxWindow::Create(parent, id, position, size, style, name)) return false; + WTF::initializeThreading(); + // This is necessary because we are using SharedTimerWin.cpp on Windows, // due to a problem with exceptions getting eaten when using the callback // approach to timers (which wx itself uses). @@ -286,7 +310,7 @@ bool wxWebView::Create(wxWindow* parent, int id, const wxPoint& position, WebCore::HTMLFrameOwnerElement* parentFrame = 0; 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()); + m_impl->page = new WebCore::Page(new WebCore::ChromeClientWx(this), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx(), new WebCore::EmptyPluginHalterClient()); editorClient->setPage(m_impl->page); m_mainFrame = new wxWebFrame(this); @@ -312,7 +336,8 @@ wxWebView::~wxWebView() { m_beingDestroyed = true; - delete m_mainFrame; + if (m_mainFrame && m_mainFrame->GetFrame()) + m_mainFrame->GetFrame()->loader()->detachFromParent(); delete m_impl->page; m_impl->page = 0; @@ -484,10 +509,16 @@ void wxWebView::MakeEditable(bool enable) void wxWebView::OnPaint(wxPaintEvent& event) { - if (m_beingDestroyed || !m_mainFrame) return; - + + // WebView active state is based on TLW active state. + wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>(wxGetTopLevelParent(this)); + if (tlw && tlw->IsActive()) + m_impl->page->focusController()->setActive(true); + else { + m_impl->page->focusController()->setActive(false); + } WebCore::Frame* frame = m_mainFrame->GetFrame(); if (!frame || !frame->view()) return; @@ -502,23 +533,14 @@ void wxWebView::OnPaint(wxPaintEvent& event) if (dc.IsOk()) { wxRect paintRect = GetUpdateRegion().GetBox(); - 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()); - #if USE(WXGC) WebCore::GraphicsContext gc(&gcdc); #else WebCore::GraphicsContext gc(&dc); #endif if (frame->contentRenderer()) { - if (frame->view()->needsLayout()) - frame->view()->layout(); - - frame->view()->paintContents(&gc, paintRect); + frame->view()->layoutIfNeededRecursive(); + frame->view()->paint(&gc, paintRect); } } } @@ -536,9 +558,9 @@ void wxWebView::OnSize(wxSizeEvent& event) { if (m_isInitialized && m_mainFrame) { WebCore::Frame* frame = m_mainFrame->GetFrame(); - frame->eventHandler()->sendResizeEvent(); - frame->view()->layout(); - frame->view()->adjustScrollbars(); + frame->view()->setFrameRect(wxRect(wxPoint(0,0), event.GetSize())); + frame->view()->forceLayout(); + frame->view()->adjustViewSize(); } event.Skip(); @@ -557,10 +579,7 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) { event.Skip(); - if (m_beingDestroyed) - return; - - if (!m_mainFrame) + if (!m_impl->page) return; WebCore::Frame* frame = m_mainFrame->GetFrame(); @@ -593,13 +612,15 @@ void wxWebView::OnMouseEvents(wxMouseEvent& event) WebCore::PlatformMouseEvent wkEvent(event, globalPoint, clickCount); if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN || - type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) + type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) { frame->eventHandler()->handleMousePressEvent(wkEvent); - - else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) + if (!HasCapture()) + CaptureMouse(); + } else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP) { frame->eventHandler()->handleMouseReleaseEvent(wkEvent); - - else if (type == wxEVT_MOTION) + while (HasCapture()) + ReleaseMouse(); + } else if (type == wxEVT_MOTION || type == wxEVT_ENTER_WINDOW || type == wxEVT_LEAVE_WINDOW) frame->eventHandler()->mouseMoved(wkEvent); } @@ -608,10 +629,10 @@ void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) m_impl->page->contextMenuController()->clearContextMenu(); wxPoint localEventPoint = ScreenToClient(event.GetPosition()); - if (!m_mainFrame) + if (!m_impl->page) return; - WebCore::Frame* focusedFrame = m_mainFrame->GetFrame(); + WebCore::Frame* focusedFrame = m_impl->page->focusController()->focusedOrMainFrame(); if (!focusedFrame->view()) return; @@ -691,8 +712,8 @@ void wxWebView::Paste() void wxWebView::OnKeyEvents(wxKeyEvent& event) { WebCore::Frame* frame = 0; - if (m_mainFrame) - frame = m_mainFrame->GetFrame(); + if (m_impl->page) + frame = m_impl->page->focusController()->focusedOrMainFrame(); if (!(frame && frame->view())) return; @@ -833,7 +854,6 @@ void wxWebView::OnSetFocus(wxFocusEvent& event) frame = m_mainFrame->GetFrame(); if (frame) { - m_impl->page->focusController()->setActive(true); frame->selection()->setFocused(true); } @@ -847,20 +867,11 @@ void wxWebView::OnKillFocus(wxFocusEvent& event) frame = m_mainFrame->GetFrame(); if (frame) { - m_impl->page->focusController()->setActive(false); frame->selection()->setFocused(false); } event.Skip(); } -void wxWebView::OnActivate(wxActivateEvent& event) -{ - if (m_impl->page) - m_impl->page->focusController()->setActive(event.GetActive()); - - event.Skip(); -} - wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const { if (m_mainFrame) @@ -869,3 +880,10 @@ wxWebViewDOMElementInfo wxWebView::HitTest(const wxPoint& pos) const return wxWebViewDOMElementInfo(); } +bool wxWebView::ShouldClose() const +{ + if (m_mainFrame) + return m_mainFrame->ShouldClose(); + + return true; +} diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h index 3e6b8f2..e83c420 100644 --- a/WebKit/wx/WebView.h +++ b/WebKit/wx/WebView.h @@ -65,6 +65,35 @@ namespace WebCore { extern WXDLLIMPEXP_WEBKIT const wxChar* wxWebViewNameStr; #endif +static const int defaultCacheCapacity = 8192 * 1024; // mirrors Cache.cpp + +class WXDLLIMPEXP_WEBKIT wxWebViewCachePolicy +{ +public: + wxWebViewCachePolicy(unsigned minDead = 0, unsigned maxDead = defaultCacheCapacity, unsigned totalCapacity = defaultCacheCapacity) + : m_minDeadCapacity(minDead) + , m_maxDeadCapacity(maxDead) + , m_capacity(totalCapacity) + {} + + ~wxWebViewCachePolicy() {} + + unsigned GetCapacity() const { return m_capacity; } + void SetCapacity(int capacity) { m_capacity = capacity; } + + unsigned GetMinDeadCapacity() const { return m_minDeadCapacity; } + void SetMinDeadCapacity(unsigned minDeadCapacity) { m_minDeadCapacity = minDeadCapacity; } + + unsigned GetMaxDeadCapacity() const { return m_maxDeadCapacity; } + void SetMaxDeadCapacity(unsigned maxDeadCapacity) { m_maxDeadCapacity = maxDeadCapacity; } + +protected: + unsigned m_capacity; + unsigned m_minDeadCapacity; + unsigned m_maxDeadCapacity; +}; + + // copied from WebKit/mac/Misc/WebKitErrors[Private].h enum { WebKitErrorCannotShowMIMEType = 100, @@ -159,6 +188,11 @@ public: wxWebFrame* GetMainFrame() { return m_mainFrame; } wxWebViewDOMElementInfo HitTest(const wxPoint& pos) const; + + bool ShouldClose() const; + + static void SetCachePolicy(const wxWebViewCachePolicy& cachePolicy); + static wxWebViewCachePolicy GetCachePolicy(); protected: @@ -171,7 +205,6 @@ protected: void OnKeyEvents(wxKeyEvent& event); void OnSetFocus(wxFocusEvent& event); void OnKillFocus(wxFocusEvent& event); - void OnActivate(wxActivateEvent& event); private: // any class wishing to process wxWindows events must use this macro @@ -299,6 +332,14 @@ private: wxPoint m_position; }; +// copied from page/Console.h +enum wxWebViewConsoleMessageLevel { + TipMessageLevel, + LogMessageLevel, + WarningMessageLevel, + ErrorMessageLevel +}; + class WXDLLIMPEXP_WEBKIT wxWebViewConsoleMessageEvent : public wxCommandEvent { #ifndef SWIG @@ -318,10 +359,14 @@ public: wxWebViewConsoleMessageEvent( wxWindow* win = (wxWindow*) NULL ); wxEvent *Clone(void) const { return new wxWebViewConsoleMessageEvent(*this); } + wxWebViewConsoleMessageLevel GetLevel() const { return m_level; } + void SetLevel(wxWebViewConsoleMessageLevel level) { m_level = level; } + private: unsigned int m_lineNumber; wxString m_message; wxString m_sourceID; + wxWebViewConsoleMessageLevel m_level; }; class WXDLLIMPEXP_WEBKIT wxWebViewAlertEvent : public wxCommandEvent diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h index c6f24d1..989a579 100644 --- a/WebKit/wx/WebViewPrivate.h +++ b/WebKit/wx/WebViewPrivate.h @@ -30,10 +30,10 @@ #define WXWEBVIEWPRIVATE_H #include "config.h" -#include "HTMLFrameOwnerElement.h" +#include "EditCommand.h" +#include "EditCommandWx.h" #include "Page.h" -#include "wtf/RefPtr.h" -#include "KURL.h" +#include "wtf/Vector.h" #include <wx/timer.h> @@ -48,19 +48,9 @@ public: wxTimer tripleClickTimer; wxPoint tripleClickPos; -}; - -class WebViewFrameData -{ -public: - WebCore::KURL url; - WebCore::String name; - WebCore::HTMLFrameOwnerElement* ownerElement; - WebCore::String referrer; - bool allowsScrolling; - int marginWidth; - int marginHeight; + WTF::Vector<EditCommandWx> undoStack; + WTF::Vector<EditCommandWx> redoStack; }; #endif diff --git a/WebKit/wx/bindings/python/wscript b/WebKit/wx/bindings/python/wscript index f9d73c3..41e5d41 100644 --- a/WebKit/wx/bindings/python/wscript +++ b/WebKit/wx/bindings/python/wscript @@ -55,13 +55,18 @@ def set_options(opt): common_set_options(opt) def configure(conf): - common_configure(conf) - conf.check_tool('swig', tooldir='.') - conf.check_swig_version('1.3.29') + if Options.options.wxpython: + common_configure(conf) + conf.check_tool('swig', tooldir='.') + conf.check_swig_version('1.3.29') def build(bld): if Options.options.wxpython: - wx_swig_args = ['-DSWIG_TYPE_TABLE=_wxPython_table', '-DWXP_USE_THREAD=1', '-DSWIG_PYTHON_OUTPUT_TUPLE'] + defines = ['SWIG_TYPE_TABLE=_wxPython_table', 'WXP_USE_THREAD=1', 'SWIG_PYTHON_OUTPUT_TUPLE'] + wx_swig_args = [] + for define in defines: + wx_swig_args.append('-D%s' % define) + try: import wx.build.config wx_swig_args += wx.build.config.swig_args @@ -76,13 +81,17 @@ def build(bld): Logs.warn("Cannot find location of wxPython .i files, wxPython extension will not be built.") return + for inc_path in include_paths: + wx_swig_args.append('-I' + inc_path) + obj = bld.new_task_gen( features = 'cxx cshlib pyext', includes = ' '.join(include_paths), source = 'webview.i', swig_flags = ' '.join(wx_swig_args), + defines = defines, target = '_webview', - uselib = 'WX CURL ICU XSLT XML SQLITE3 WXWEBKIT ' + waf_configname, + uselib = 'WX CURL ICU XSLT XML SQLITE3 WXWEBKIT ' + get_config(), libpath = [output_dir], uselib_local = '', diff --git a/WebKit/wx/wscript b/WebKit/wx/wscript index 695ddc3..b5ba580 100644 --- a/WebKit/wx/wscript +++ b/WebKit/wx/wscript @@ -40,6 +40,13 @@ include_paths = webkit_dirs + common_includes + ['.', '..', os.path.join(wk_root, 'WebCore', 'platform', 'graphics', 'wx'), ] +windows_deps = [ + 'lib/pthreadVC2.dll', + 'bin/icuuc40.dll', 'bin/icudt40.dll', 'bin/icuin40.dll', + 'bin/libcurl.dll', 'bin/libeay32.dll', 'bin/ssleay32.dll', 'bin/zlib1.dll', + 'lib/sqlite3.dll', 'bin/libxml2.dll', 'bin/libxslt.dll', 'bin/iconv.dll', + ] + webcore_include_dirs = [] for dir in webcore_dirs + ['DerivedSources']: include_paths.append(os.path.join(wk_root, 'WebCore', dir)) @@ -54,15 +61,47 @@ def set_options(opt): def configure(conf): common_configure(conf) +def pre_build(bld): + """ + The wxWebKit library should be rebuilt if jscore or webcore changes, + so we make those static libs as dependencies. + """ + + ext = '.a' + if sys.platform.startswith('win'): + ext = '.lib' + + libjscore = os.path.join(output_dir, 'libjscore%s' % ext) + libwebcore = os.path.join(output_dir, 'libwebcore%s' % ext) + + assert os.path.exists(libjscore) + assert os.path.exists(libwebcore) + + bld.env.CXXDEPS_JSCORE = Utils.h_file(libjscore) + bld.env.CXXDEPS_WEBCORE = Utils.h_file(libwebcore) + def build(bld): + bld.add_pre_fun(pre_build) + + bld.env.LIBDIR = output_dir + obj = bld.new_task_gen( features = 'cxx cshlib implib', includes = ' '.join(include_paths + js_include_dirs), target = 'wxwebkit', defines = ['WXMAKINGDLL_WEBKIT'], - uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + waf_configname, + uselib = 'WX CURL ICU XSLT XML SQLITE3 WEBCORE JSCORE ' + get_config(), libpath = [output_dir], uselib_local = '', install_path = output_dir) obj.find_sources_in_dirs(webkit_dirs) + + if building_on_win32: + for wxlib in bld.env['LIB_WX']: + wxlibname = os.path.join(bld.env['LIBPATH_WX'][0], wxlib + '_vc.dll') + if os.path.exists(wxlibname): + bld.install_files(obj.install_path, [wxlibname]) + + for dep in windows_deps: + bld.install_files(obj.install_path, [os.path.join(msvclibs_dir, dep)]) |