diff options
Diffstat (limited to 'WebKit/wx/WebKitSupport')
-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 |
5 files changed, 93 insertions, 98 deletions
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; |