Jacek Caban : mshtml: Moved content_window to HTMLFrameBase.

Alexandre Julliard julliard at winehq.org
Tue Nov 3 15:37:17 CST 2009


Module: wine
Branch: master
Commit: bdb92707055984025fdcc9998d93b1a436d2c73e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bdb92707055984025fdcc9998d93b1a436d2c73e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov  1 19:18:38 2009 +0100

mshtml: Moved content_window to HTMLFrameBase.

---

 dlls/mshtml/htmlelem.c       |    2 +-
 dlls/mshtml/htmlframebase.c  |    9 ++++++++-
 dlls/mshtml/htmliframe.c     |   15 ++++-----------
 dlls/mshtml/mshtml_private.h |    6 ++++--
 4 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index ba02d5c..b794b73 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1541,7 +1541,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL
     else if(!strcmpW(class_name, wszBODY))
         ret = HTMLBodyElement_Create(doc, nselem);
     else if(!strcmpW(class_name, wszIFRAME))
-        ret = HTMLIFrame_Create(doc, nselem);
+        ret = HTMLIFrame_Create(doc, nselem, NULL);
     else if(!strcmpW(class_name, wszIMG))
         ret = HTMLImgElement_Create(doc, nselem);
     else if(!strcmpW(class_name, wszINPUT))
diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index d00f685..83817be 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -257,13 +257,20 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
 
 void HTMLFrameBase_destructor(HTMLFrameBase *This)
 {
+    if(This->content_window)
+        IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
+
     HTMLElement_destructor(&This->element.node);
 }
 
 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;
 
     HTMLElement_Init(&This->element, doc, nselem, dispex_data);
+
+    if(content_window)
+        IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
+    This->content_window = content_window;
 }
diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c
index 35aff3d..daef946 100644
--- a/dlls/mshtml/htmliframe.c
+++ b/dlls/mshtml/htmliframe.c
@@ -38,7 +38,6 @@ typedef struct {
     LONG ref;
 
     nsIDOMHTMLIFrameElement *nsiframe;
-    HTMLWindow *content_window;
 } HTMLIFrame;
 
 #define HTMLFRAMEBASE2(x)  (&(x)->lpIHTMLFrameBase2Vtbl)
@@ -104,9 +103,9 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
 
     TRACE("(%p)->(%p)\n", This, p);
 
-    if(This->content_window) {
-        IHTMLWindow2_AddRef(HTMLWINDOW2(This->content_window));
-        *p = HTMLWINDOW2(This->content_window);
+    if(This->framebase.content_window) {
+        IHTMLWindow2_AddRef(HTMLWINDOW2(This->framebase.content_window));
+        *p = HTMLWINDOW2(This->framebase.content_window);
     }else {
         WARN("NULL content window\n");
         *p = NULL;
@@ -206,8 +205,6 @@ static void HTMLIFrame_destructor(HTMLDOMNode *iface)
 {
     HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
 
-    if(This->content_window)
-        IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
     if(This->nsiframe)
         nsIDOMHTMLIFrameElement_Release(This->nsiframe);
 
@@ -280,8 +277,6 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
     ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
     ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
 
-    HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
-
     nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
     if(NS_FAILED(nsres))
         ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
@@ -289,9 +284,7 @@ HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem,
     if(!content_window)
         content_window = get_content_window(ret->nsiframe);
 
-    if(content_window)
-        IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
-    ret->content_window = content_window;
+    HTMLFrameBase_Init(&ret->framebase, doc, nselem, content_window, &HTMLIFrame_dispex);
 
     return &ret->framebase.element;
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 1f03cb3..340fefe 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -464,6 +464,8 @@ typedef struct {
     HTMLElement element;
 
     const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
+
+    HTMLWindow *content_window;
 } HTMLFrameBase;
 
 typedef struct _mutation_queue_t {
@@ -693,7 +695,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
 HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
 HTMLElement *HTMLAnchorElement_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 *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
 HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
@@ -709,7 +711,7 @@ void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMHTMLElement*,dispex_s
 void HTMLElement2_Init(HTMLElement*);
 void HTMLElement3_Init(HTMLElement*);
 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**);
 void HTMLDOMNode_destructor(HTMLDOMNode*);




More information about the wine-cvs mailing list