Jacek Caban : mshtml: Moved option_factory from HTMLOuterWindow to HTMLInnerWindow.

Alexandre Julliard julliard at winehq.org
Mon Jun 25 13:24:13 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jun 25 14:05:58 2012 +0200

mshtml: Moved option_factory from HTMLOuterWindow to HTMLInnerWindow.

---

 dlls/mshtml/htmloption.c     |    9 ++++++---
 dlls/mshtml/htmlwindow.c     |   21 +++++++++++++--------
 dlls/mshtml/mshtml_private.h |    7 ++++---
 3 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index ad3e8fb..8bc0f40 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -517,15 +517,18 @@ static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
     HTMLOptionElementFactory_create
 };
 
-HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow *window)
+HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionElementFactory **ret_ptr)
 {
     HTMLOptionElementFactory *ret;
 
-    ret = heap_alloc(sizeof(HTMLOptionElementFactory));
+    ret = heap_alloc(sizeof(*ret));
+    if(!ret)
+        return E_OUTOFMEMORY;
 
     ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
     ret->ref = 1;
     ret->window = window;
 
-    return ret;
+    *ret_ptr = ret;
+    return S_OK;
 }
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 94731ec..f6d6212 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -192,11 +192,6 @@ static void release_outer_window(HTMLOuterWindow *This)
     if(This->frame_element)
         This->frame_element->content_window = NULL;
 
-    if(This->option_factory) {
-        This->option_factory->window = NULL;
-        IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
-    }
-
     if(This->image_factory) {
         This->image_factory->window = NULL;
         IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface);
@@ -233,6 +228,11 @@ static void release_inner_window(HTMLInnerWindow *This)
         heap_free(This->global_props[i].name);
     heap_free(This->global_props);
 
+    if(This->option_factory) {
+        This->option_factory->window = NULL;
+        IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
+    }
+
     heap_free(This);
 }
 
@@ -1083,12 +1083,17 @@ static HRESULT WINAPI HTMLWindow2_get_screen(IHTMLWindow2 *iface, IHTMLScreen **
 static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionElementFactory **p)
 {
     HTMLWindow *This = impl_from_IHTMLWindow2(iface);
-    HTMLOuterWindow *window = This->outer_window;
+    HTMLInnerWindow *window = This->inner_window;
 
     TRACE("(%p)->(%p)\n", This, p);
 
-    if(!window->option_factory)
-        window->option_factory = HTMLOptionElementFactory_Create(window);
+    if(!window->option_factory) {
+        HRESULT hres;
+
+        hres = HTMLOptionElementFactory_Create(window, &window->option_factory);
+        if(FAILED(hres))
+            return hres;
+    }
 
     *p = &window->option_factory->IHTMLOptionElementFactory_iface;
     IHTMLOptionElementFactory_AddRef(*p);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 004a4b4..35800d8 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -269,7 +269,7 @@ typedef struct {
 
     LONG ref;
 
-    HTMLOuterWindow *window;
+    HTMLInnerWindow *window;
 } HTMLOptionElementFactory;
 
 typedef struct {
@@ -338,7 +338,6 @@ struct HTMLOuterWindow {
 
     IInternetSecurityManager *secmgr;
 
-    HTMLOptionElementFactory *option_factory;
     HTMLImageElementFactory *image_factory;
     HTMLLocation *location;
     IHTMLScreen *screen;
@@ -355,6 +354,8 @@ struct HTMLInnerWindow {
 
     HTMLDocumentNode *doc;
 
+    HTMLOptionElementFactory *option_factory;
+
     global_prop_t *global_props;
     DWORD global_prop_cnt;
     DWORD global_prop_size;
@@ -660,7 +661,7 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj*,nsIDOMWindow*,HTMLOuterWindow*,H
 HRESULT update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
 HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
-HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN;
+HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
 HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN;
 HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list