Andrew Eikum : mshtml: Store ns[i]frame reference in HTMLFrameBase.
Alexandre Julliard
julliard at winehq.org
Tue Dec 8 11:10:40 CST 2009
Module: wine
Branch: master
Commit: 6e3e7c9f4c2de451568843034fdbceba71831483
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6e3e7c9f4c2de451568843034fdbceba71831483
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon Dec 7 16:28:04 2009 -0600
mshtml: Store ns[i]frame reference in HTMLFrameBase.
---
dlls/mshtml/htmlframebase.c | 29 ++++++++++++++++-------------
dlls/mshtml/htmliframe.c | 14 +-------------
dlls/mshtml/mshtml_private.h | 3 +++
3 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index 03b48b6..dc2ea08 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -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;
diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 2132df3..ed86dd0 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -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;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 012d543..1beaf55 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -504,6 +504,9 @@ struct HTMLFrameBase {
const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
HTMLWindow *content_window;
+
+ nsIDOMHTMLFrameElement *nsframe;
+ nsIDOMHTMLIFrameElement *nsiframe;
};
typedef struct _mutation_queue_t {
More information about the wine-cvs
mailing list