Jacek Caban : mshtml: Associate HTMLWindow with HTMLIFrame.

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


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

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

mshtml: Associate HTMLWindow with HTMLIFrame.

---

 dlls/mshtml/htmlframebase.c  |    8 ++++++--
 dlls/mshtml/mshtml_private.h |    6 ++++--
 dlls/mshtml/mutation.c       |   20 +++++++++++++++-----
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/dlls/mshtml/htmlframebase.c b/dlls/mshtml/htmlframebase.c
index 83817be..b1d53e3 100644
--- a/dlls/mshtml/htmlframebase.c
+++ b/dlls/mshtml/htmlframebase.c
@@ -257,8 +257,10 @@ HRESULT HTMLFrameBase_QI(HTMLFrameBase *This, REFIID riid, void **ppv)
 
 void HTMLFrameBase_destructor(HTMLFrameBase *This)
 {
-    if(This->content_window)
+    if(This->content_window) {
+        This->content_window->frame_element = NULL;
         IHTMLWindow2_Release(HTMLWINDOW2(This->content_window));
+    }
 
     HTMLElement_destructor(&This->element.node);
 }
@@ -270,7 +272,9 @@ void HTMLFrameBase_Init(HTMLFrameBase *This, HTMLDocumentNode *doc, nsIDOMHTMLEl
 
     HTMLElement_Init(&This->element, doc, nselem, dispex_data);
 
-    if(content_window)
+    if(content_window) {
         IHTMLWindow2_AddRef(HTMLWINDOW2(content_window));
+        content_window->frame_element = This;
+    }
     This->content_window = content_window;
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 340fefe..570f0b1 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -159,6 +159,7 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
 
 typedef struct HTMLDocumentNode HTMLDocumentNode;
 typedef struct HTMLDocumentObj HTMLDocumentObj;
+typedef struct HTMLFrameBase HTMLFrameBase;
 
 typedef enum {
     SCRIPTMODE_GECKO,
@@ -219,6 +220,7 @@ struct HTMLWindow {
     HTMLDocumentObj *doc_obj;
     nsIDOMWindow *nswindow;
     HTMLWindow *parent;
+    HTMLFrameBase *frame_element;
 
     nsChannelBSC *bscallback;
     IMoniker *mon;
@@ -460,13 +462,13 @@ typedef struct {
     ConnectionPoint cp;
 } HTMLTextContainer;
 
-typedef struct {
+struct HTMLFrameBase {
     HTMLElement element;
 
     const IHTMLFrameBaseVtbl *lpIHTMLFrameBaseVtbl;
 
     HTMLWindow *content_window;
-} HTMLFrameBase;
+};
 
 typedef struct _mutation_queue_t {
     DWORD type;
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 4999e26..edcbbd7 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -246,7 +246,7 @@ static void pop_mutation_queue(HTMLDocumentNode *doc)
     heap_free(tmp);
 }
 
-static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc)
+static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc, HTMLWindow **ret)
 {
     nsIDOMWindow *nswindow;
 
@@ -259,8 +259,12 @@ static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc)
         HRESULT hres;
 
         hres = HTMLWindow_Create(doc->basedoc.doc_obj, nswindow, doc->basedoc.window, &window);
-        if(SUCCEEDED(hres))
-            IHTMLWindow2_Release(HTMLWINDOW2(window));
+        if(SUCCEEDED(hres)) {
+            if(ret)
+                *ret = window;
+            else
+                IHTMLWindow2_Release(HTMLWINDOW2(window));
+        }
     }
 
     nsIDOMWindow_Release(nswindow);
@@ -270,6 +274,7 @@ static nsresult init_nsdoc_window(HTMLDocumentNode *doc, nsIDOMDocument *nsdoc)
 static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk)
 {
     nsIDOMHTMLIFrameElement *nsiframe;
+    HTMLWindow *window = NULL;
     nsIDOMDocument *nsdoc;
     nsresult nsres;
 
@@ -286,7 +291,12 @@ static nsresult init_iframe_window(HTMLDocumentNode *doc, nsISupports *nsunk)
         return nsres;
     }
 
-    nsres = init_nsdoc_window(doc, nsdoc);
+    nsres = init_nsdoc_window(doc, nsdoc, &window);
+
+    if(window) {
+        HTMLIFrame_Create(doc, (nsIDOMHTMLElement*)nsiframe, window);
+        IHTMLWindow2_Release(HTMLWINDOW2(window));
+    }
 
     nsIDOMDocument_Release(nsdoc);
     return nsres;
@@ -311,7 +321,7 @@ static nsresult init_frame_window(HTMLDocumentNode *doc, nsISupports *nsunk)
         return nsres;
     }
 
-    nsres = init_nsdoc_window(doc, nsdoc);
+    nsres = init_nsdoc_window(doc, nsdoc, NULL);
 
     nsIDOMDocument_Release(nsdoc);
     return nsres;




More information about the wine-cvs mailing list