Commit 676d4af4 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Move GetContentDOMWindow call from HTMLWindow_Create.

parent b5aa4dd8
......@@ -1551,6 +1551,7 @@ static dispex_static_data_t HTMLDocument_dispex = {
HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
{
nsIDOMWindow *nswindow;
HTMLDocument *ret;
HRESULT hres;
......@@ -1596,7 +1597,12 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
ret->nscontainer = NSContainer_Create(ret, NULL);
update_nsdocument(ret);
ret->window = HTMLWindow_Create(ret);
if(ret->nscontainer)
nsIWebBrowser_GetContentDOMWindow(ret->nscontainer->webbrowser, &nswindow);
HTMLWindow_Create(ret, nswindow, &ret->window);
if(nswindow)
nsIDOMWindow_Release(nswindow);
get_thread_hwnd();
......
......@@ -1182,29 +1182,31 @@ static dispex_static_data_t HTMLWindow_dispex = {
HTMLWindow_iface_tids
};
HTMLWindow *HTMLWindow_Create(HTMLDocument *doc)
HRESULT HTMLWindow_Create(HTMLDocument *doc, nsIDOMWindow *nswindow, HTMLWindow **ret)
{
HTMLWindow *ret = heap_alloc_zero(sizeof(HTMLWindow));
HTMLWindow *window;
ret->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
ret->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
ret->lpIDispatchExVtbl = &WindowDispExVtbl;
ret->ref = 1;
ret->doc = doc;
window = heap_alloc_zero(sizeof(HTMLWindow));
if(!window)
return E_OUTOFMEMORY;
init_dispex(&ret->dispex, (IUnknown*)HTMLWINDOW2(ret), &HTMLWindow_dispex);
window->lpHTMLWindow2Vtbl = &HTMLWindow2Vtbl;
window->lpHTMLWindow3Vtbl = &HTMLWindow3Vtbl;
window->lpIDispatchExVtbl = &WindowDispExVtbl;
window->ref = 1;
window->doc = doc;
if(doc->nscontainer) {
nsresult nsres;
init_dispex(&window->dispex, (IUnknown*)HTMLWINDOW2(window), &HTMLWindow_dispex);
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &ret->nswindow);
if(NS_FAILED(nsres))
ERR("GetContentDOMWindow failed: %08x\n", nsres);
if(nswindow) {
nsIDOMWindow_AddRef(nswindow);
window->nswindow = nswindow;
}
list_add_head(&window_list, &ret->entry);
list_add_head(&window_list, &window->entry);
return ret;
*ret = window;
return S_OK;
}
HTMLWindow *nswindow_to_window(const nsIDOMWindow *nswindow)
......
......@@ -460,7 +460,7 @@ typedef struct {
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
HTMLWindow *HTMLWindow_Create(HTMLDocument*);
HRESULT HTMLWindow_Create(HTMLDocument*,nsIDOMWindow*,HTMLWindow**);
HTMLWindow *nswindow_to_window(const nsIDOMWindow*);
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLDocument*);
HTMLLocation *HTMLLocation_Create(HTMLDocument*);
......
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