Commit 3eba9c84 authored by bfulgham@apple.com's avatar bfulgham@apple.com

[Windows] Let Page create the main Frame.

https://bugs.webkit.org/show_bug.cgi?id=120323

Reviewed by Anders Carlsson.

* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::WebFrameLoaderClient): Remove assertion that frame
is passed as construction argument.
(WebFrameLoaderClient::createFrame): Call new 'createSubframeWithOwnerElement'
* WebCoreSupport/WebFrameLoaderClient.h: Update constructor to
handle case of no default frame argument.
(WebFrameLoaderClient::setWebFrame): Added.
* WebFrame.cpp:
(WebFrame::createSubframeWithOwnerElement): Renamed from 'init'.
(WebFrame::initWithWebFrameView): Added for new page-driven load path.
* WebFrame.h: Added new method signatures.
* WebView.cpp:
(WebView::initWithFrame): Update to match behavior of other ports.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154631 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6441bf1f
2013-08-26 Brent Fulgham <bfulgham@apple.com>
[Windows] Let Page create the main Frame.
https://bugs.webkit.org/show_bug.cgi?id=120323
Reviewed by Anders Carlsson.
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::WebFrameLoaderClient): Remove assertion that frame
is passed as construction argument.
(WebFrameLoaderClient::createFrame): Call new 'createSubframeWithOwnerElement'
* WebCoreSupport/WebFrameLoaderClient.h: Update constructor to
handle case of no default frame argument.
(WebFrameLoaderClient::setWebFrame): Added.
* WebFrame.cpp:
(WebFrame::createSubframeWithOwnerElement): Renamed from 'init'.
(WebFrame::initWithWebFrameView): Added for new page-driven load path.
* WebFrame.h: Added new method signatures.
* WebView.cpp:
(WebView::initWithFrame): Update to match behavior of other ports.
2013-08-23 Roger Fong <roger_fong@apple.com>
<https://bugs.webkit.org/show_bug.cgi?id=119829> Add IAccessibleText and IAccessibleEditableText implementation.
......
......@@ -108,7 +108,6 @@ WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* webFrame)
, m_policyListenerPrivate(adoptPtr(new WebFramePolicyListenerPrivate))
, m_hasSentResponseToPlugin(false)
{
ASSERT_ARG(webFrame, webFrame);
}
WebFrameLoaderClient::~WebFrameLoaderClient()
......@@ -1089,7 +1088,7 @@ PassRefPtr<Frame> WebFrameLoaderClient::createFrame(const KURL& URL, const Strin
COMPtr<WebFrame> webFrame(AdoptCOM, WebFrame::createInstance());
RefPtr<Frame> childFrame = webFrame->init(m_webFrame->webView(), coreFrame->page(), ownerElement);
RefPtr<Frame> childFrame = webFrame->createSubframeWithOwnerElement(m_webFrame->webView(), coreFrame->page(), ownerElement);
childFrame->tree().setName(name);
coreFrame->tree().appendChild(childFrame);
......
......@@ -43,9 +43,10 @@ class WebHistory;
class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
public:
WebFrameLoaderClient(WebFrame*);
WebFrameLoaderClient(WebFrame* = 0);
~WebFrameLoaderClient();
void setWebFrame(WebFrame* webFrame) { m_webFrame = webFrame; }
WebFrame* webFrame() const { return m_webFrame; }
virtual bool hasWebView() const;
......
......@@ -1071,7 +1071,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::deselectAll()
// WebFrame ---------------------------------------------------------------
PassRefPtr<Frame> WebFrame::init(IWebView* webView, Page* page, HTMLFrameOwnerElement* ownerElement)
PassRefPtr<Frame> WebFrame::createSubframeWithOwnerElement(IWebView* webView, Page* page, HTMLFrameOwnerElement* ownerElement)
{
webView->QueryInterface(&d->webView);
d->webView->Release(); // don't hold the extra ref
......@@ -1085,6 +1085,18 @@ PassRefPtr<Frame> WebFrame::init(IWebView* webView, Page* page, HTMLFrameOwnerEl
return frame.release();
}
void WebFrame::initWithWebView(IWebView* webView, Page* page)
{
webView->QueryInterface(&d->webView);
d->webView->Release(); // don't hold the extra ref
HWND viewWindow;
d->webView->viewWindow((OLE_HANDLE*)&viewWindow);
this->AddRef(); // We release this ref in frameLoaderDestroyed()
d->frame = page->mainFrame();
}
Frame* WebFrame::impl()
{
return d->frame;
......
......@@ -298,7 +298,8 @@ public:
virtual void frameLoaderDestroyed();
// WebFrame
PassRefPtr<WebCore::Frame> init(IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*);
PassRefPtr<WebCore::Frame> createSubframeWithOwnerElement(IWebView*, WebCore::Page*, WebCore::HTMLFrameOwnerElement*);
void initWithWebView(IWebView*, WebCore::Page*);
WebCore::Frame* impl();
void invalidate();
void unmarkAllMisspellings();
......
/*
* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved.
* Copyright (C) 2006-2013 Apple, Inc. All rights reserved.
* Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved.
* Copyright (C) 2011 Brent Fulgham. All rights reserved.
*
......@@ -45,6 +45,7 @@
#include "WebEditorClient.h"
#include "WebElementPropertyBag.h"
#include "WebFrame.h"
#include "WebFrameLoaderClient.h"
#include "WebFrameNetworkingContext.h"
#include "WebGeolocationClient.h"
#include "WebGeolocationPosition.h"
......@@ -2718,6 +2719,7 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
#if ENABLE(INSPECTOR)
pageClients.inspectorClient = m_inspectorClient;
#endif // ENABLE(INSPECTOR)
pageClients.loaderClientForMainFrame = new WebFrameLoaderClient;
m_page = new Page(pageClients);
provideGeolocationTo(m_page, new WebGeolocationClient(this));
......@@ -2736,12 +2738,13 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame(
}
WebFrame* webFrame = WebFrame::createInstance();
RefPtr<Frame> coreFrame = webFrame->init(this, m_page, 0);
webFrame->initWithWebView(this, m_page);
static_cast<WebFrameLoaderClient&>(m_page->mainFrame()->loader().client()).setWebFrame(webFrame);
m_mainFrame = webFrame;
webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
coreFrame->tree().setName(toString(frameName));
coreFrame->init();
m_page->mainFrame()->tree().setName(toString(frameName));
m_page->mainFrame()->init();
setGroupName(groupName);
addToAllWebViewsSet();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment