mshtml: Store ns[i]frame reference in HTMLFrameBase.

This commit is contained in:
Andrew Eikum 2009-12-07 16:28:04 -06:00 committed by Alexandre Julliard
parent 662653c8ff
commit 6e3e7c9f4c
3 changed files with 20 additions and 26 deletions

View File

@ -443,16 +443,31 @@ void HTMLFrameBase_destructor(HTMLFrameBase *This)
if(This->content_window)
This->content_window->frame_element = NULL;
if(This->nsframe)
nsIDOMHTMLFrameElement_Release(This->nsframe);
if(This->nsiframe)
nsIDOMHTMLIFrameElement_Release(This->nsiframe);
HTMLElement_destructor(&This->element.node);
}
void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
dispex_static_data_t *dispex_data)
{
nsresult nsres;
This->lpIHTMLFrameBaseVtbl = &HTMLFrameBaseVtbl;
This->lpIHTMLFrameBase2Vtbl = &HTMLFrameBase2Vtbl;
HTMLElement_Init(&This->element, doc, nselem, dispex_data);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&This->nsframe);
if(NS_FAILED(nsres)) {
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&This->nsiframe);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTML[I]Frame interface\n");
}else
This->nsiframe = NULL;
}
typedef struct {
@ -492,17 +507,11 @@ static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
{
HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
nsIDOMHTMLFrameElement *nsframe;
nsIDOMDocument *nsdoc;
nsresult nsres;
HRESULT hres;
nsres = nsIDOMHTMLElement_QueryInterface(This->framebase.element.nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
if(NS_FAILED(nsres))
return E_FAIL;
nsres = nsIDOMHTMLFrameElement_GetContentDocument(nsframe, &nsdoc);
nsIDOMHTMLFrameElement_Release(nsframe);
nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
if(NS_FAILED(nsres) || !nsdoc) {
ERR("GetContentDocument failed: %08x\n", nsres);
return E_FAIL;
@ -531,18 +540,12 @@ static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
{
nsIDOMHTMLFrameElement *nsframe;
HTMLFrameElement *ret;
nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLFrameElement));
ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLFrameElement iface: %08x\n", nsres);
HTMLFrameBase_Init(&ret->framebase, doc, nselem, NULL);
return &ret->framebase.element;

View File

@ -33,10 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct {
HTMLFrameBase framebase;
LONG ref;
nsIDOMHTMLIFrameElement *nsiframe;
} HTMLIFrame;
#define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, framebase.element.node, iface)
@ -52,9 +48,6 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface)
{
HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
if(This->nsiframe)
nsIDOMHTMLIFrameElement_Release(This->nsiframe);
HTMLFrameBase_destructor(&This->framebase);
}
@ -86,7 +79,7 @@ static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
nsresult nsres;
HRESULT hres;
nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->nsiframe, &nsdoc);
nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->framebase.nsiframe, &nsdoc);
if(NS_FAILED(nsres) || !nsdoc) {
ERR("GetContentDocument failed: %08x\n", nsres);
return E_FAIL;
@ -134,16 +127,11 @@ static dispex_static_data_t HTMLIFrame_dispex = {
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
{
HTMLIFrame *ret;
nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLIFrame));
ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
return &ret->framebase.element;

View File

@ -504,6 +504,9 @@ struct HTMLFrameBase {
const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
HTMLWindow *content_window;
nsIDOMHTMLFrameElement *nsframe;
nsIDOMHTMLIFrameElement *nsiframe;
};
typedef struct _mutation_queue_t {