Commit bdb92707 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved content_window to HTMLFrameBase.

parent 20ed399b
...@@ -1541,7 +1541,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL ...@@ -1541,7 +1541,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL
else if(!strcmpW(class_name, wszBODY)) else if(!strcmpW(class_name, wszBODY))
ret = HTMLBodyElement_Create(doc, nselem); ret = HTMLBodyElement_Create(doc, nselem);
else if(!strcmpW(class_name, wszIFRAME)) else if(!strcmpW(class_name, wszIFRAME))
ret = HTMLIFrame_Create(doc, nselem); ret = HTMLIFrame_Create(doc, nselem, NULL);
else if(!strcmpW(class_name, wszIMG)) else if(!strcmpW(class_name, wszIMG))
ret = HTMLImgElement_Create(doc, nselem); ret = HTMLImgElement_Create(doc, nselem);
else if(!strcmpW(class_name, wszINPUT)) else if(!strcmpW(class_name, wszINPUT))
......
...@@ -257,13 +257,20 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv) ...@@ -257,13 +257,20 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
void HTMLFrameBase_destructor(HTMLFrameBase *This) void HTMLFrameBase_destructor(HTMLFrameBase *This)
{ {
if(This->content_window)
IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
HTMLElement_destructor(&This->element.node); HTMLElement_destructor(&This->element.node);
} }
void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
dispex_static_data_t *dispex_data) HTMLWindow *content_window, dispex_static_data_t *dispex_data)
{ {
This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl; This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl;
HTMLElement_Init(&This->element, doc, nselem, dispex_data); HTMLElement_Init(&This->element, doc, nselem, dispex_data);
if(content_window)
IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
This->content_window = content_window;
} }
...@@ -38,7 +38,6 @@ typedef struct { ...@@ -38,7 +38,6 @@ typedef struct {
LONG ref; LONG ref;
nsIDOMHTMLIFrameElement *nsiframe; nsIDOMHTMLIFrameElement *nsiframe;
HTMLWindow *content_window;
} HTMLIFrame; } HTMLIFrame;
#define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl) #define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl)
...@@ -104,9 +103,9 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, ...@@ -104,9 +103,9 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
if(This->content_window) { if(This->framebase.content_window) {
IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window)); IHTMLWindow2_AddRef(HTMLWINDOW2(This->framebase.content_window));
*p = HTMLWINDOW2(This->content_window); *p = HTMLWINDOW2(This->framebase.content_window);
}else { }else {
WARN("NULL content window\n"); WARN("NULL content window\n");
*p = NULL; *p = NULL;
...@@ -206,8 +205,6 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface) ...@@ -206,8 +205,6 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface)
{ {
HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface); HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
if(This->content_window)
IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
if(This->nsiframe) if(This->nsiframe)
nsIDOMHTMLIFrameElement_Release(This->nsiframe); nsIDOMHTMLIFrameElement_Release(This->nsiframe);
...@@ -280,8 +277,6 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, ...@@ -280,8 +277,6 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl; ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl; ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres); ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
...@@ -289,9 +284,7 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, ...@@ -289,9 +284,7 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
if(!content_window) if(!content_window)
content_window = get_content_window(ret->nsiframe); content_window = get_content_window(ret->nsiframe);
if(content_window) HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, &HTMLIFrame_dispex);
IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
ret->content_window = content_window;
return &ret->framebase.element; return &ret->framebase.element;
} }
...@@ -464,6 +464,8 @@ typedef struct { ...@@ -464,6 +464,8 @@ typedef struct {
HTMLElement element; HTMLElement element;
const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl; const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
HTMLWindow *content_window;
} HTMLFrameBase; } HTMLFrameBase;
typedef struct _mutation_queue_t { typedef struct _mutation_queue_t {
...@@ -693,7 +695,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL); ...@@ -693,7 +695,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*); HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*);
HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
...@@ -709,7 +711,7 @@ void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_s ...@@ -709,7 +711,7 @@ void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_s
void HTMLElement2_Init(HTMLElement*); void HTMLElement2_Init(HTMLElement*);
void HTMLElement3_Init(HTMLElement*); void HTMLElement3_Init(HTMLElement*);
void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*); void HTMLTextContainer_Init(HTMLTextContainer*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*);
void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_static_data_t*); void HTMLFrameBase_Init(HTMLFrameBase*,HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLWindow*,dispex_static_data_t*);
HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**); HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
void HTMLDOMNode_destructor(HTMLDOMNode*); void HTMLDOMNode_destructor(HTMLDOMNode*);
......
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