Commit b85631ba authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved image_factory to HTMLInnerWindow.

parent b7f74922
......@@ -920,11 +920,13 @@ static dispex_static_data_t HTMLImageElementFactory_dispex = {
HTMLImageElementFactory_iface_tids
};
HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow *window)
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElementFactory **ret_val)
{
HTMLImageElementFactory *ret;
ret = heap_alloc(sizeof(HTMLImageElementFactory));
if(!ret)
return E_OUTOFMEMORY;
ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl;
ret->ref = 1;
......@@ -933,5 +935,6 @@ HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow *window)
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLImageElementFactory_iface,
&HTMLImageElementFactory_dispex);
return ret;
*ret_val = ret;
return S_OK;
}
......@@ -192,11 +192,6 @@ static void release_outer_window(HTMLOuterWindow *This)
if(This->frame_element)
This->frame_element->content_window = NULL;
if(This->image_factory) {
This->image_factory->window = NULL;
IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface);
}
if(This->location) {
This->location->window = NULL;
IHTMLLocation_Release(&This->location->IHTMLLocation_iface);
......@@ -228,6 +223,11 @@ static void release_inner_window(HTMLInnerWindow *This)
heap_free(This->global_props[i].name);
heap_free(This->global_props);
if(This->image_factory) {
This->image_factory->window = NULL;
IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface);
}
if(This->option_factory) {
This->option_factory->window = NULL;
IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
......@@ -647,12 +647,17 @@ static HRESULT WINAPI HTMLWindow2_prompt(IHTMLWindow2 *iface, BSTR message,
static HRESULT WINAPI HTMLWindow2_get_Image(IHTMLWindow2 *iface, IHTMLImageElementFactory **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->image_factory)
window->image_factory = HTMLImageElementFactory_Create(window);
if(!window->image_factory) {
HRESULT hres;
hres = HTMLImageElementFactory_Create(window, &window->image_factory);
if(FAILED(hres))
return hres;
}
*p = &window->image_factory->IHTMLImageElementFactory_iface;
IHTMLImageElementFactory_AddRef(*p);
......
......@@ -278,7 +278,7 @@ typedef struct {
LONG ref;
HTMLOuterWindow *window;
HTMLInnerWindow *window;
} HTMLImageElementFactory;
struct HTMLLocation {
......@@ -335,7 +335,6 @@ struct HTMLOuterWindow {
IInternetSecurityManager *secmgr;
HTMLImageElementFactory *image_factory;
HTMLLocation *location;
IHTMLScreen *screen;
IOmHistory *history;
......@@ -355,6 +354,7 @@ struct HTMLInnerWindow {
IHTMLEventObj *event;
HTMLImageElementFactory *image_factory;
HTMLOptionElementFactory *option_factory;
global_prop_t *global_props;
......@@ -663,7 +663,7 @@ HRESULT update_window_doc(HTMLOuterWindow*) DECLSPEC_HIDDEN;
HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
HTMLImageElementFactory *HTMLImageElementFactory_Create(HTMLOuterWindow*) DECLSPEC_HIDDEN;
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment