summaryrefslogtreecommitdiffstats
path: root/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp')
-rw-r--r--WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp122
1 files changed, 51 insertions, 71 deletions
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);
}
}