Commit 79356c65 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved document node from HTMLOuterWindow to HTMLInnerWindow.

parent 08964ede
......@@ -1568,7 +1568,7 @@ static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
if(This->window)
update_cp_events(This->window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
}
static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
......@@ -2448,7 +2448,6 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
if(FAILED(hres))
return hres;
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
if(NS_FAILED(nsres))
ERR("GetContentDOMWindow failed: %08x\n", nsres);
......@@ -2461,8 +2460,8 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
return hres;
}
if(!doc->basedoc.doc_node && doc->basedoc.window->doc) {
doc->basedoc.doc_node = doc->basedoc.window->doc;
if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
htmldoc_addref(&doc->basedoc.doc_node->basedoc);
}
......
......@@ -1348,7 +1348,7 @@ HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name,
return S_OK;
}
void update_cp_events(HTMLOuterWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode)
void update_cp_events(HTMLInnerWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode)
{
event_target_t *event_target;
int i;
......
......@@ -54,7 +54,7 @@ HRESULT attach_event(event_target_t**,nsIDOMNode*,HTMLDocument*,BSTR,IDispatch*,
HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
void update_cp_events(HTMLOuterWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN;
......
......@@ -206,12 +206,12 @@ static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
{
HTMLFrameElement *This = impl_from_HTMLDOMNode(iface);
if(!This->framebase.content_window || !This->framebase.content_window->doc) {
if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
*p = NULL;
return S_OK;
}
*p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
*p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
IDispatch_AddRef(*p);
return S_OK;
}
......
......@@ -461,12 +461,12 @@ static HRESULT WINAPI HTMLFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR
TRACE("(%p)->(%p)\n", This, p);
if(!This->content_window || !This->content_window->doc) {
if(!This->content_window || !This->content_window->base.inner_window->doc) {
FIXME("no document associated\n");
return E_FAIL;
}
return IHTMLDocument2_get_readyState(&This->content_window->doc->basedoc.IHTMLDocument2_iface, p);
return IHTMLDocument2_get_readyState(&This->content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface, p);
}
static HRESULT WINAPI HTMLFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
......
......@@ -184,12 +184,12 @@ static HRESULT HTMLIFrame_get_document(HTMLDOMNode *iface, IDispatch **p)
{
HTMLIFrame *This = impl_from_HTMLDOMNode(iface);
if(!This->framebase.content_window || !This->framebase.content_window->doc) {
if(!This->framebase.content_window || !This->framebase.content_window->base.inner_window->doc) {
*p = NULL;
return S_OK;
}
*p = (IDispatch*)&This->framebase.content_window->doc->basedoc.IHTMLDocument2_iface;
*p = (IDispatch*)&This->framebase.content_window->base.inner_window->doc->basedoc.IHTMLDocument2_iface;
IDispatch_AddRef(*p);
return S_OK;
}
......
......@@ -807,6 +807,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
VARIANT width, VARIANT height, IHTMLImgElement **img_elem)
{
HTMLImageElementFactory *This = impl_from_IHTMLImageElementFactory(iface);
HTMLDocumentNode *doc;
IHTMLImgElement *img;
HTMLElement *elem;
nsIDOMHTMLElement *nselem;
......@@ -818,18 +819,20 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&width),
debugstr_variant(&height), img_elem);
if(!This->window || !This->window->doc) {
if(!This->window || !This->window->base.inner_window->doc) {
WARN("NULL doc\n");
return E_UNEXPECTED;
}
doc = This->window->base.inner_window->doc;
*img_elem = NULL;
hres = create_nselem(This->window->doc, imgW, &nselem);
hres = create_nselem(doc, imgW, &nselem);
if(FAILED(hres))
return hres;
hres = HTMLElement_Create(This->window->doc, (nsIDOMNode*)nselem, FALSE, &elem);
hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, FALSE, &elem);
nsIDOMHTMLElement_Release(nselem);
if(FAILED(hres)) {
ERR("HTMLElement_Create failed\n");
......
......@@ -468,18 +468,18 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
if(!This->window || !This->window->doc) {
if(!This->window || !This->window->base.inner_window->doc) {
WARN("NULL doc\n");
return E_UNEXPECTED;
}
*optelem = NULL;
hres = create_nselem(This->window->doc, optionW, &nselem);
hres = create_nselem(This->window->base.inner_window->doc, optionW, &nselem);
if(FAILED(hres))
return hres;
hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node);
hres = get_node(This->window->base.inner_window->doc, (nsIDOMNode*)nselem, TRUE, &node);
nsIDOMHTMLElement_Release(nselem);
if(FAILED(hres))
return hres;
......
......@@ -321,7 +321,6 @@ struct HTMLOuterWindow {
windowref_t *window_ref;
LONG task_magic;
HTMLDocumentNode *doc;
HTMLDocumentObj *doc_obj;
nsIDOMWindow *nswindow;
HTMLOuterWindow *parent;
......@@ -357,6 +356,8 @@ struct HTMLOuterWindow {
struct HTMLInnerWindow {
HTMLWindow base;
HTMLDocumentNode *doc;
};
typedef enum {
......@@ -656,7 +657,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument*,HTMLDocumentObj*,HTMLOuterWind
HRESULT create_document_fragment(nsIDOMNode*,HTMLDocumentNode*,HTMLDocumentNode**) DECLSPEC_HIDDEN;
HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
void update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
HRESULT update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN;
......
......@@ -726,7 +726,7 @@ HRESULT start_binding(HTMLOuterWindow *window, HTMLDocumentNode *doc, BSCallback
bscallback->doc = doc;
if(!doc && window)
bscallback->doc = window->doc;
bscallback->doc = window->base.inner_window->doc;
/* NOTE: IE7 calls IsSystemMoniker here*/
......@@ -998,10 +998,10 @@ static HRESULT on_start_nsrequest(nsChannelBSC *This)
list_remove(&This->bsc.entry);
list_init(&This->bsc.entry);
update_window_doc(This->window);
if(This->window->doc != This->bsc.doc) {
if(This->window->base.inner_window->doc != This->bsc.doc) {
if(This->bsc.doc)
list_remove(&This->bsc.entry);
This->bsc.doc = This->window->doc;
This->bsc.doc = This->window->base.inner_window->doc;
}
list_add_head(&This->bsc.doc->bindings, &This->bsc.entry);
if(This->window->readystate != READYSTATE_LOADING)
......@@ -1276,7 +1276,7 @@ static HRESULT nsChannelBSC_start_binding(BSCallback *bsc)
nsChannelBSC *This = nsChannelBSC_from_BSCallback(bsc);
if(This->window)
This->window->doc->skip_mutation_notif = FALSE;
This->window->base.inner_window->doc->skip_mutation_notif = FALSE;
return S_OK;
}
......@@ -1668,7 +1668,7 @@ void set_window_bscallback(HTMLOuterWindow *window, nsChannelBSC *callback)
if(callback) {
callback->window = window;
IBindStatusCallback_AddRef(&callback->bsc.IBindStatusCallback_iface);
callback->bsc.doc = window->doc;
callback->bsc.doc = window->base.inner_window->doc;
}
}
......@@ -2150,7 +2150,7 @@ HRESULT navigate_url(HTMLOuterWindow *window, const WCHAR *new_url, const WCHAR
if(window->doc_obj && window == window->doc_obj->basedoc.window) {
BOOL cancel;
hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0, &cancel);
hres = hlink_frame_navigate(&window->base.inner_window->doc->basedoc, url, NULL, 0, &cancel);
if(FAILED(hres))
return hres;
......
......@@ -234,7 +234,7 @@ static nsIDOMElement *get_dom_element(NPP instance)
return elem;
}
static HTMLOuterWindow *get_elem_window(nsIDOMElement *elem)
static HTMLInnerWindow *get_elem_window(nsIDOMElement *elem)
{
nsIDOMWindow *nswindow;
nsIDOMDocument *nsdoc;
......@@ -253,7 +253,7 @@ static HTMLOuterWindow *get_elem_window(nsIDOMElement *elem)
window = nswindow_to_window(nswindow);
nsIDOMWindow_Release(nswindow);
return window;
return window->base.inner_window;
}
static BOOL parse_classid(const PRUnichar *classid, CLSID *clsid)
......@@ -313,7 +313,7 @@ static BOOL get_elem_clsid(nsIDOMElement *elem, CLSID *clsid)
return ret;
}
static IUnknown *create_activex_object(HTMLOuterWindow *window, nsIDOMElement *nselem, CLSID *clsid)
static IUnknown *create_activex_object(HTMLInnerWindow *window, nsIDOMElement *nselem, CLSID *clsid)
{
IClassFactoryEx *cfex;
IClassFactory *cf;
......@@ -357,7 +357,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I
char **argv, NPSavedData *saved)
{
nsIDOMElement *nselem;
HTMLOuterWindow *window;
HTMLInnerWindow *window;
IUnknown *obj;
CLSID clsid;
NPError err = NPERR_NO_ERROR;
......
......@@ -285,10 +285,10 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsChannelBSC *channe
}
uri->channel_bsc = channelbsc;
doc = window->doc;
doc = window->base.inner_window->doc;
doc->skip_mutation_notif = TRUE;
nsres = nsIDocShell_LoadURI(doc_shell, (nsIURI*)&uri->nsIURL_iface, NULL, flags, FALSE);
if(doc == window->doc)
if(doc == window->base.inner_window->doc)
doc->skip_mutation_notif = FALSE;
uri->channel_bsc = NULL;
nsIDocShell_Release(doc_shell);
......@@ -1022,9 +1022,9 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
}else {
start_binding_task_t *task = heap_alloc(sizeof(start_binding_task_t));
task->doc = window->doc;
task->doc = window->base.inner_window->doc;
task->bscallback = bscallback;
push_task(&task->header, start_binding_proc, start_binding_task_destr, window->doc->basedoc.task_magic);
push_task(&task->header, start_binding_proc, start_binding_task_destr, window->base.inner_window->doc->basedoc.task_magic);
}
return NS_OK;
......
......@@ -406,7 +406,7 @@ void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
if(window->doc_obj && window->doc_obj->basedoc.window == window)
call_property_onchanged(&window->doc_obj->basedoc.cp_propnotif, DISPID_READYSTATE);
fire_event(window->doc, EVENTID_READYSTATECHANGE, FALSE, window->doc->node.nsnode, NULL);
fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE, window->base.inner_window->doc->node.nsnode, NULL);
if(window->frame_element)
fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
......
......@@ -573,10 +573,10 @@ static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, RE
if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) {
TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This);
if(!This->window || !This->window->doc)
if(!This->window || !This->window->base.inner_window->doc)
return E_NOINTERFACE;
return IInternetHostSecurityManager_QueryInterface(&This->window->doc->IInternetHostSecurityManager_iface,
return IInternetHostSecurityManager_QueryInterface(&This->window->base.inner_window->doc->IInternetHostSecurityManager_iface,
riid, ppv);
}
......@@ -659,7 +659,7 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
if(FAILED(hres))
return;
hres = bind_mon_to_buffer(script_host->window->doc, mon, (void**)&buf, &size);
hres = bind_mon_to_buffer(script_host->window->base.inner_window->doc, mon, (void**)&buf, &size);
IMoniker_Release(mon);
if(FAILED(hres))
return;
......
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