Commit f0f4b50e authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Get rid of `outer` in DispatchEx.

parent e319026f
......@@ -774,7 +774,7 @@ static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags,
return hres;
}
hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&unk);
hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&unk);
if(FAILED(hres)) {
ERR("Could not get iface %s: %08lx\n", debugstr_mshtml_guid(tid_ids[func->tid]), hres);
return E_FAIL;
......@@ -786,56 +786,6 @@ static HRESULT typeinfo_invoke(DispatchEx *This, func_info_t *func, WORD flags,
return hres;
}
static inline func_disp_t *impl_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, func_disp_t, IUnknown_iface);
}
static HRESULT WINAPI Function_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
func_disp_t *This = impl_from_IUnknown(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IUnknown_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI Function_AddRef(IUnknown *iface)
{
func_disp_t *This = impl_from_IUnknown(iface);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
return ref;
}
static ULONG WINAPI Function_Release(IUnknown *iface)
{
func_disp_t *This = impl_from_IUnknown(iface);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
return ref;
}
static const IUnknownVtbl FunctionUnkVtbl = {
Function_QueryInterface,
Function_AddRef,
Function_Release
};
static inline func_disp_t *impl_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, func_disp_t, dispex);
......@@ -925,8 +875,7 @@ static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info)
if(!ret)
return NULL;
ret->IUnknown_iface.lpVtbl = &FunctionUnkVtbl;
init_dispatch(&ret->dispex, &ret->IUnknown_iface, &function_dispex, dispex_compat_mode(obj));
init_dispatch(&ret->dispex, &function_dispex, dispex_compat_mode(obj));
ret->obj = obj;
ret->info = info;
......@@ -1115,7 +1064,7 @@ static HRESULT builtin_propget(DispatchEx *This, func_info_t *func, DISPPARAMS *
assert(func->get_vtbl_off);
hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface);
if(SUCCEEDED(hres)) {
switch(func->prop_vt) {
#define CASE_VT(vt,type,access) \
......@@ -1172,7 +1121,7 @@ static HRESULT builtin_propput(DispatchEx *This, func_info_t *func, DISPPARAMS *
v = &tmpv;
}
hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface);
if(SUCCEEDED(hres)) {
switch(func->prop_vt) {
#define CASE_VT(vt,type,access) \
......@@ -1216,7 +1165,7 @@ static HRESULT invoke_builtin_function(DispatchEx *This, func_info_t *func, DISP
return E_INVALIDARG;
}
hres = IUnknown_QueryInterface(This->outer, tid_ids[func->tid], (void**)&iface);
hres = IDispatchEx_QueryInterface(&This->IDispatchEx_iface, tid_ids[func->tid], (void**)&iface);
if(FAILED(hres))
return hres;
......@@ -1591,21 +1540,57 @@ static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid,
{
DispatchEx *This = impl_from_IDispatchEx(iface);
return IUnknown_QueryInterface(This->outer, riid, ppv);
TRACE("%s (%p)->(%s %p)\n", This->info->desc->name, This, debugstr_mshtml_guid(riid), ppv);
if(This->info->desc->vtbl->query_interface) {
*ppv = This->info->desc->vtbl->query_interface(This, riid);
if(*ppv)
goto ret;
}
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid) || IsEqualGUID(&IID_IDispatchEx, riid))
*ppv = &This->IDispatchEx_iface;
else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) {
*ppv = &dispex_ccp;
return S_OK;
}else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) {
*ppv = &This->IDispatchEx_iface;
return S_OK;
}else if(IsEqualGUID(&IID_IDispatchJS, riid) ||
IsEqualGUID(&IID_UndocumentedScriptIface, riid) ||
IsEqualGUID(&IID_IMarshal, riid) ||
IsEqualGUID(&IID_IManagedObject, riid)) {
*ppv = NULL;
return E_NOINTERFACE;
}else {
*ppv = NULL;
WARN("%s (%p)->(%s %p)\n", This->info->desc->name, This, debugstr_mshtml_guid(riid), ppv);
return E_NOINTERFACE;
}
ret:
IDispatchEx_AddRef(&This->IDispatchEx_iface);
return S_OK;
}
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
LONG ref = dispex_ref_incr(This);
TRACE("%s (%p) ref=%ld\n", This->info->desc->name, This, ref);
return IUnknown_AddRef(This->outer);
return ref;
}
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
{
DispatchEx *This = impl_from_IDispatchEx(iface);
LONG ref = dispex_ref_decr(This);
TRACE("%s (%p) ref=%ld\n", This->info->desc->name, This, ref);
return IUnknown_Release(This->outer);
return ref;
}
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
......@@ -1968,35 +1953,7 @@ static IDispatchExVtbl DispatchExVtbl = {
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
{
TRACE("%s (%p)->(%s %p)\n", This->info->desc->name, This, debugstr_mshtml_guid(riid), ppv);
if(This->info->desc->vtbl->query_interface) {
*ppv = This->info->desc->vtbl->query_interface(This, riid);
if(*ppv)
goto ret;
}
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid) || IsEqualGUID(&IID_IDispatchEx, riid))
*ppv = &This->IDispatchEx_iface;
else if(IsEqualGUID(&IID_nsXPCOMCycleCollectionParticipant, riid)) {
*ppv = &dispex_ccp;
return TRUE;
}else if(IsEqualGUID(&IID_nsCycleCollectionISupports, riid)) {
*ppv = &This->IDispatchEx_iface;
return TRUE;
}else if(IsEqualGUID(&IID_IDispatchJS, riid) ||
IsEqualGUID(&IID_UndocumentedScriptIface, riid) ||
IsEqualGUID(&IID_IMarshal, riid) ||
IsEqualGUID(&IID_IManagedObject, riid)) {
*ppv = NULL;
return TRUE;
}else {
return FALSE;
}
ret:
IDispatchEx_AddRef(&This->IDispatchEx_iface);
return TRUE;
return IDispatchEx_QueryInterface(&This->IDispatchEx_iface, riid, ppv) == S_OK;
}
LONG dispex_ref_decr(DispatchEx *dispex)
......@@ -2137,12 +2094,11 @@ const void *dispex_get_vtbl(DispatchEx *dispex)
return dispex->info->desc->vtbl;
}
void init_dispatch(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data, compat_mode_t compat_mode)
void init_dispatch(DispatchEx *dispex, dispex_static_data_t *data, compat_mode_t compat_mode)
{
assert(compat_mode < COMPAT_MODE_CNT);
dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
dispex->outer = outer;
dispex->dynamic_data = NULL;
ccref_init(&dispex->ccref, 1);
......
......@@ -537,8 +537,7 @@ HRESULT HTMLDOMAttribute_Create(const WCHAR *name, HTMLElement *elem, DISPID dis
ret->dispid = dispid;
ret->elem = elem;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLDOMAttribute_iface,
&HTMLDOMAttribute_dispex, compat_mode);
init_dispatch(&ret->dispex, &HTMLDOMAttribute_dispex, compat_mode);
/* For attributes attached to an element, (elem,dispid) pair should be valid used for its operation. */
if(elem) {
......
......@@ -890,7 +890,7 @@ static HRESULT create_html_rect(nsIDOMClientRect *nsrect, compat_mode_t compat_m
rect->IHTMLRect_iface.lpVtbl = &HTMLRectVtbl;
rect->IHTMLRect2_iface.lpVtbl = &HTMLRect2Vtbl;
init_dispatch(&rect->dispex, (IUnknown*)&rect->IHTMLRect_iface, &HTMLRect_dispex, compat_mode);
init_dispatch(&rect->dispex, &HTMLRect_dispex, compat_mode);
nsIDOMClientRect_AddRef(nsrect);
rect->nsrect = nsrect;
......@@ -3331,8 +3331,7 @@ static HRESULT WINAPI HTMLElement2_getClientRects(IHTMLElement2 *iface, IHTMLRec
rects->IHTMLRectCollection_iface.lpVtbl = &HTMLRectCollectionVtbl;
rects->rect_list = rect_list;
init_dispatch(&rects->dispex, (IUnknown*)&rects->IHTMLRectCollection_iface,
&HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
init_dispatch(&rects->dispex, &HTMLRectCollection_dispex, dispex_compat_mode(&This->node.event_target.dispex));
*pRectCol = &rects->IHTMLRectCollection_iface;
return S_OK;
......@@ -7863,7 +7862,7 @@ static HRESULT create_token_list(compat_mode_t compat_mode, IHTMLElement *elemen
}
obj->IWineDOMTokenList_iface.lpVtbl = &WineDOMTokenListVtbl;
init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineDOMTokenList_iface, &token_list_dispex, compat_mode);
init_dispatch(&obj->dispex, &token_list_dispex, compat_mode);
IHTMLElement_AddRef(element);
obj->element = element;
......@@ -8281,8 +8280,7 @@ static HRESULT create_filters_collection(compat_mode_t compat_mode, IHTMLFilters
collection->IHTMLFiltersCollection_iface.lpVtbl = &HTMLFiltersCollectionVtbl;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLFiltersCollection_iface,
&HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8));
init_dispatch(&collection->dispex, &HTMLFiltersCollection_dispex, min(compat_mode, COMPAT_MODE_IE8));
*ret = &collection->IHTMLFiltersCollection_iface;
return S_OK;
......@@ -9067,8 +9065,7 @@ HRESULT HTMLElement_get_attr_col(HTMLDOMNode *iface, HTMLAttributeCollection **a
This->attrs->elem = This;
list_init(&This->attrs->attrs);
init_dispatch(&This->attrs->dispex, (IUnknown*)&This->attrs->IHTMLAttributeCollection_iface,
&HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
init_dispatch(&This->attrs->dispex, &HTMLAttributeCollection_dispex, dispex_compat_mode(&iface->event_target.dispex));
*ac = This->attrs;
IHTMLAttributeCollection_AddRef(&This->attrs->IHTMLAttributeCollection_iface);
......
......@@ -873,8 +873,7 @@ static IHTMLElementCollection *HTMLElementCollection_Create(HTMLElement **elems,
ret->elems = elems;
ret->len = len;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLElementCollection_iface,
&HTMLElementCollection_dispex, compat_mode);
init_dispatch(&ret->dispex, &HTMLElementCollection_dispex, compat_mode);
TRACE("ret=%p len=%ld\n", ret, len);
......
......@@ -938,7 +938,7 @@ static HTMLEventObj *alloc_event_obj(DOMEvent *event, compat_mode_t compat_mode)
if(event)
IDOMEvent_AddRef(&event->IDOMEvent_iface);
init_dispatch(&event_obj->dispex, (IUnknown*)&event_obj->IHTMLEventObj_iface, &HTMLEventObj_dispex, compat_mode);
init_dispatch(&event_obj->dispex, &HTMLEventObj_dispex, compat_mode);
return event_obj;
}
......@@ -3246,7 +3246,7 @@ static void *event_ctor(unsigned size, dispex_static_data_t *dispex_data, nsIDOM
event->time_stamp = get_time_stamp();
init_dispatch(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data, compat_mode);
init_dispatch(&event->dispex, dispex_data, compat_mode);
return event;
}
......@@ -4609,10 +4609,9 @@ static int event_id_cmp(const void *key, const struct wine_rb_entry *entry)
return wcscmp(key, WINE_RB_ENTRY_VALUE(entry, listener_container_t, entry)->type);
}
void EventTarget_Init(EventTarget *event_target, IUnknown *outer, dispex_static_data_t *dispex_data,
compat_mode_t compat_mode)
void EventTarget_Init(EventTarget *event_target, dispex_static_data_t *dispex_data, compat_mode_t compat_mode)
{
init_dispatch(&event_target->dispex, outer, dispex_data, compat_mode);
init_dispatch(&event_target->dispex, dispex_data, compat_mode);
event_target->IEventTarget_iface.lpVtbl = &EventTargetVtbl;
wine_rb_init(&event_target->handler_map, event_id_cmp);
}
......
......@@ -984,8 +984,7 @@ HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow *window, HTMLImageElement
ret->IHTMLImageElementFactory_iface.lpVtbl = &HTMLImageElementFactoryVtbl;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLImageElementFactory_iface,
&HTMLImageElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
init_dispatch(&ret->dispex, &HTMLImageElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
*ret_val = ret;
return S_OK;
......
......@@ -667,8 +667,7 @@ HRESULT create_location(HTMLOuterWindow *window, HTMLLocation **ret)
location->window = window;
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
init_dispatch(&location->dispex, (IUnknown*)&location->IHTMLLocation_iface, &HTMLLocation_dispex,
COMPAT_MODE_QUIRKS);
init_dispatch(&location->dispex, &HTMLLocation_dispex, COMPAT_MODE_QUIRKS);
*ret = location;
return S_OK;
......
......@@ -477,8 +477,7 @@ HRESULT create_child_collection(nsIDOMNodeList *nslist, compat_mode_t compat_mod
nsIDOMNodeList_AddRef(nslist);
collection->nslist = nslist;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLDOMChildrenCollection_iface,
&HTMLDOMChildrenCollection_dispex, compat_mode);
init_dispatch(&collection->dispex, &HTMLDOMChildrenCollection_dispex, compat_mode);
*ret = &collection->IHTMLDOMChildrenCollection_iface;
return S_OK;
......@@ -1522,7 +1521,7 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno
node->IHTMLDOMNode2_iface.lpVtbl = &HTMLDOMNode2Vtbl;
node->IHTMLDOMNode3_iface.lpVtbl = &HTMLDOMNode3Vtbl;
EventTarget_Init(&node->event_target, (IUnknown*)&node->IHTMLDOMNode_iface, dispex_data, doc->document_mode);
EventTarget_Init(&node->event_target, dispex_data, doc->document_mode);
if(&doc->node != node)
IHTMLDOMNode_AddRef(&doc->node.IHTMLDOMNode_iface);
......
......@@ -631,8 +631,7 @@ HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow *window, HTMLOptionEleme
ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLOptionElementFactory_iface,
&HTMLOptionElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
init_dispatch(&ret->dispex, &HTMLOptionElementFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
*ret_ptr = ret;
return S_OK;
......
......@@ -1479,8 +1479,7 @@ HRESULT create_html_storage(HTMLInnerWindow *window, BOOL local, IHTMLStorage **
storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl;
storage->window = window;
init_dispatch(&storage->dispex, (IUnknown*)&storage->IHTMLStorage_iface, &HTMLStorage_dispex,
dispex_compat_mode(&window->event_target.dispex));
init_dispatch(&storage->dispex, &HTMLStorage_dispex, dispex_compat_mode(&window->event_target.dispex));
*p = &storage->IHTMLStorage_iface;
return S_OK;
......
......@@ -10082,8 +10082,7 @@ void init_css_style(CSSStyle *style, nsIDOMCSSStyleDeclaration *nsstyle, style_q
style->nsstyle = nsstyle;
nsIDOMCSSStyleDeclaration_AddRef(nsstyle);
init_dispatch(&style->dispex, (IUnknown*)&style->IHTMLCSSStyleDeclaration_iface,
dispex_info, compat_mode);
init_dispatch(&style->dispex, dispex_info, compat_mode);
}
HRESULT HTMLStyle_Create(HTMLElement *elem, HTMLStyle **ret)
......
......@@ -244,8 +244,7 @@ static HRESULT create_style_sheet_rule(nsIDOMCSSRule *nsstylesheetrule, compat_m
rule->IHTMLStyleSheetRule_iface.lpVtbl = &HTMLStyleSheetRuleVtbl;
rule->nsstylesheetrule = NULL;
init_dispatch(&rule->dispex, (IUnknown *)&rule->IHTMLStyleSheetRule_iface, &HTMLStyleSheetRule_dispex,
compat_mode);
init_dispatch(&rule->dispex, &HTMLStyleSheetRule_dispex, compat_mode);
if (nsstylesheetrule)
{
......@@ -522,8 +521,7 @@ static HRESULT create_style_sheet_rules_collection(nsIDOMCSSRuleList *nslist, co
collection->IHTMLStyleSheetRulesCollection_iface.lpVtbl = &HTMLStyleSheetRulesCollectionVtbl;
collection->nslist = nslist;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLStyleSheetRulesCollection_iface,
&HTMLStyleSheetRulesCollection_dispex, compat_mode);
init_dispatch(&collection->dispex, &HTMLStyleSheetRulesCollection_dispex, compat_mode);
if(nslist)
nsIDOMCSSRuleList_AddRef(nslist);
......@@ -964,8 +962,7 @@ HRESULT create_style_sheet_collection(nsIDOMStyleSheetList *nslist, compat_mode_
nsIDOMStyleSheetList_AddRef(nslist);
collection->nslist = nslist;
init_dispatch(&collection->dispex, (IUnknown*)&collection->IHTMLStyleSheetsCollection_iface,
&HTMLStyleSheetsCollection_dispex, compat_mode);
init_dispatch(&collection->dispex, &HTMLStyleSheetsCollection_dispex, compat_mode);
*ret = &collection->IHTMLStyleSheetsCollection_iface;
return S_OK;
......@@ -1554,8 +1551,7 @@ HRESULT create_style_sheet(nsIDOMStyleSheet *nsstylesheet, compat_mode_t compat_
style_sheet->IHTMLStyleSheet4_iface.lpVtbl = &HTMLStyleSheet4Vtbl;
style_sheet->nsstylesheet = NULL;
init_dispatch(&style_sheet->dispex, (IUnknown*)&style_sheet->IHTMLStyleSheet_iface,
&HTMLStyleSheet_dispex, compat_mode);
init_dispatch(&style_sheet->dispex, &HTMLStyleSheet_dispex, compat_mode);
if(nsstylesheet) {
nsres = nsIDOMStyleSheet_QueryInterface(nsstylesheet, &IID_nsIDOMCSSStyleSheet,
......
......@@ -4441,8 +4441,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon,
window->base.outer_window = outer_window;
window->base.inner_window = window;
EventTarget_Init(&window->event_target, (IUnknown*)&window->base.IHTMLWindow2_iface,
&HTMLWindow_dispex, COMPAT_MODE_NONE);
EventTarget_Init(&window->event_target, &HTMLWindow_dispex, COMPAT_MODE_NONE);
window->task_magic = get_task_target_magic();
......
......@@ -405,7 +405,6 @@ typedef struct {
struct DispatchEx {
IDispatchEx IDispatchEx_iface;
IUnknown *outer;
nsCycleCollectingAutoRefCnt ccref;
dispex_data_t *info;
......@@ -439,7 +438,7 @@ static inline LONG dispex_ref_incr(DispatchEx *dispex)
}
extern LONG dispex_ref_decr(DispatchEx*);
void init_dispatch(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t);
void init_dispatch(DispatchEx*,dispex_static_data_t*,compat_mode_t);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
void dispex_props_unlink(DispatchEx*);
HRESULT change_type(VARIANT*,VARIANT*,VARTYPE,IServiceProvider*);
......@@ -1209,7 +1208,7 @@ HRESULT create_svg_element(HTMLDocumentNode*,nsIDOMSVGElement*,const WCHAR*,HTML
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*,dispex_static_data_t*);
void HTMLElement_Init(HTMLElement*,HTMLDocumentNode*,nsIDOMElement*,dispex_static_data_t*);
void EventTarget_Init(EventTarget*,IUnknown*,dispex_static_data_t*,compat_mode_t);
void EventTarget_Init(EventTarget*,dispex_static_data_t*,compat_mode_t);
void *EventTarget_query_interface(EventTarget*,REFIID);
void EventTarget_init_dispex_info(dispex_data_t*,compat_mode_t);
......
......@@ -1265,8 +1265,7 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca
}
obj->IWineMSHTMLMutationObserver_iface.lpVtbl = &WineMSHTMLMutationObserverVtbl;
init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLMutationObserver_iface,
&mutation_observer_dispex, compat_mode);
init_dispatch(&obj->dispex, &mutation_observer_dispex, compat_mode);
IDispatch_AddRef(callback);
obj->callback = callback;
......@@ -1275,66 +1274,14 @@ static HRESULT create_mutation_observer(compat_mode_t compat_mode, IDispatch *ca
}
struct mutation_observer_ctor {
IUnknown IUnknown_iface;
DispatchEx dispex;
};
static inline struct mutation_observer_ctor *mutation_observer_ctor_from_IUnknown(IUnknown *iface)
{
return CONTAINING_RECORD(iface, struct mutation_observer_ctor, IUnknown_iface);
}
static inline struct mutation_observer_ctor *mutation_observer_ctor_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, struct mutation_observer_ctor, dispex);
}
static HRESULT WINAPI mutation_observer_ctor_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IUnknown_iface;
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI mutation_observer_ctor_AddRef(IUnknown *iface)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface);
LONG ref = dispex_ref_incr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
return ref;
}
static ULONG WINAPI mutation_observer_ctor_Release(IUnknown *iface)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_IUnknown(iface);
LONG ref = dispex_ref_decr(&This->dispex);
TRACE("(%p) ref=%ld\n", This, ref);
return ref;
}
static const IUnknownVtbl mutation_observer_ctor_vtbl = {
mutation_observer_ctor_QueryInterface,
mutation_observer_ctor_AddRef,
mutation_observer_ctor_Release,
};
static void mutation_observer_ctor_destructor(DispatchEx *dispex)
{
struct mutation_observer_ctor *This = mutation_observer_ctor_from_DispatchEx(dispex);
......@@ -1417,9 +1364,7 @@ HRESULT create_mutation_observer_ctor(compat_mode_t compat_mode, IDispatch **ret
return E_OUTOFMEMORY;
}
obj->IUnknown_iface.lpVtbl = &mutation_observer_ctor_vtbl;
init_dispatch(&obj->dispex, (IUnknown*)&obj->IUnknown_iface,
&mutation_observer_ctor_dispex, compat_mode);
init_dispatch(&obj->dispex, &mutation_observer_ctor_dispex, compat_mode);
*ret = (IDispatch *)&obj->dispex.IDispatchEx_iface;
return S_OK;
......
......@@ -350,8 +350,7 @@ HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementa
dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl;
dom_implementation->browser = doc_node->browser;
init_dispatch(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface,
&HTMLDOMImplementation_dispex, doc_node->document_mode);
init_dispatch(&dom_implementation->dispex, &HTMLDOMImplementation_dispex, doc_node->document_mode);
nsres = nsIDOMDocument_GetImplementation(doc_node->dom_document, &dom_implementation->implementation);
if(NS_FAILED(nsres)) {
......@@ -604,7 +603,7 @@ HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret)
screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
init_dispatch(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex, compat_mode);
init_dispatch(&screen->dispex, &HTMLScreen_dispex, compat_mode);
*ret = &screen->IHTMLScreen_iface;
return S_OK;
......@@ -777,8 +776,7 @@ HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret)
if(!history)
return E_OUTOFMEMORY;
init_dispatch(&history->dispex, (IUnknown*)&history->IOmHistory_iface, &OmHistory_dispex,
dispex_compat_mode(&window->event_target.dispex));
init_dispatch(&history->dispex, &OmHistory_dispex, dispex_compat_mode(&window->event_target.dispex));
history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl;
history->window = window;
......@@ -952,8 +950,7 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl
col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl;
col->navigator = navigator;
init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLPluginsCollection_iface,
&HTMLPluginsCollection_dispex, dispex_compat_mode(&navigator->dispex));
init_dispatch(&col->dispex, &HTMLPluginsCollection_dispex, dispex_compat_mode(&navigator->dispex));
*ret = col;
return S_OK;
......@@ -1113,8 +1110,7 @@ static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeType
col->IHTMLMimeTypesCollection_iface.lpVtbl = &HTMLMimeTypesCollectionVtbl;
col->navigator = navigator;
init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLMimeTypesCollection_iface,
&HTMLMimeTypesCollection_dispex, dispex_compat_mode(&navigator->dispex));
init_dispatch(&col->dispex, &HTMLMimeTypesCollection_dispex, dispex_compat_mode(&navigator->dispex));
*ret = col;
return S_OK;
......@@ -1560,7 +1556,7 @@ HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator)
ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IOmNavigator_iface, &OmNavigator_dispex, compat_mode);
init_dispatch(&ret->dispex, &OmNavigator_dispex, compat_mode);
*navigator = &ret->IOmNavigator_iface;
return S_OK;
......@@ -2271,8 +2267,7 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
navigation->window = This->window;
IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface,
&HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
init_dispatch(&navigation->dispex, &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
This->navigation = &navigation->IHTMLPerformanceNavigation_iface;
}
......@@ -2298,8 +2293,7 @@ static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLP
timing->window = This->window;
IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
init_dispatch(&timing->dispex, (IUnknown*)&timing->IHTMLPerformanceTiming_iface,
&HTMLPerformanceTiming_dispex, dispex_compat_mode(&This->dispex));
init_dispatch(&timing->dispex, &HTMLPerformanceTiming_dispex, dispex_compat_mode(&This->dispex));
This->timing = &timing->IHTMLPerformanceTiming_iface;
}
......@@ -2413,8 +2407,7 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret)
performance->window = window;
IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface,
&HTMLPerformance_dispex, compat_mode);
init_dispatch(&performance->dispex, &HTMLPerformance_dispex, compat_mode);
*ret = &performance->IHTMLPerformance_iface;
return S_OK;
......@@ -2578,8 +2571,7 @@ HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCol
return E_OUTOFMEMORY;
namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl;
init_dispatch(&namespaces->dispex, (IUnknown*)&namespaces->IHTMLNamespaceCollection_iface,
&HTMLNamespaceCollection_dispex, compat_mode);
init_dispatch(&namespaces->dispex, &HTMLNamespaceCollection_dispex, compat_mode);
*ret = &namespaces->IHTMLNamespaceCollection_iface;
return S_OK;
}
......@@ -2847,7 +2839,7 @@ void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret)
}
obj->IWineMSHTMLConsole_iface.lpVtbl = &WineMSHTMLConsoleVtbl;
init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLConsole_iface, &console_dispex, compat_mode);
init_dispatch(&obj->dispex, &console_dispex, compat_mode);
*ret = &obj->IWineMSHTMLConsole_iface;
}
......@@ -3228,8 +3220,7 @@ HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch
media_query_list->IWineMSHTMLMediaQueryList_iface.lpVtbl = &media_query_list_vtbl;
list_init(&media_query_list->listeners);
init_dispatch(&media_query_list->dispex, (IUnknown*)&media_query_list->IWineMSHTMLMediaQueryList_iface,
&media_query_list_dispex, dispex_compat_mode(&window->inner_window->event_target.dispex));
init_dispatch(&media_query_list->dispex, &media_query_list_dispex, dispex_compat_mode(&window->inner_window->event_target.dispex));
*ret = (IDispatch*)&media_query_list->IWineMSHTMLMediaQueryList_iface;
return S_OK;
......
......@@ -1759,8 +1759,7 @@ HRESULT HTMLTxtRange_Create(HTMLDocumentNode *doc, nsIDOMRange *nsrange, IHTMLTx
if(!ret)
return E_OUTOFMEMORY;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLTxtRange_iface, &HTMLTxtRange_dispex,
dispex_compat_mode(&doc->node.event_target.dispex));
init_dispatch(&ret->dispex, &HTMLTxtRange_dispex, dispex_compat_mode(&doc->node.event_target.dispex));
ret->IHTMLTxtRange_iface.lpVtbl = &HTMLTxtRangeVtbl;
ret->IOleCommandTarget_iface.lpVtbl = &OleCommandTargetVtbl;
......@@ -2130,7 +2129,7 @@ HRESULT create_dom_range(nsIDOMRange *nsrange, compat_mode_t compat_mode, IHTMLD
if(!ret)
return E_OUTOFMEMORY;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLDOMRange_iface, &HTMLDOMRange_dispex, compat_mode);
init_dispatch(&ret->dispex, &HTMLDOMRange_dispex, compat_mode);
ret->IHTMLDOMRange_iface.lpVtbl = &HTMLDOMRangeVtbl;
......
......@@ -371,8 +371,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect
if(!selection)
return E_OUTOFMEMORY;
init_dispatch(&selection->dispex, (IUnknown*)&selection->IHTMLSelectionObject_iface,
&HTMLSelectionObject_dispex, dispex_compat_mode(&doc->node.event_target.dispex));
init_dispatch(&selection->dispex, &HTMLSelectionObject_dispex, dispex_compat_mode(&doc->node.event_target.dispex));
selection->IHTMLSelectionObject_iface.lpVtbl = &HTMLSelectionObjectVtbl;
selection->IHTMLSelectionObject2_iface.lpVtbl = &HTMLSelectionObject2Vtbl;
......
......@@ -1739,8 +1739,7 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactor
ret->IHTMLXMLHttpRequest2_iface.lpVtbl = &HTMLXMLHttpRequest2Vtbl;
ret->IWineXMLHttpRequestPrivate_iface.lpVtbl = &WineXMLHttpRequestPrivateVtbl;
ret->IProvideClassInfo2_iface.lpVtbl = &ProvideClassInfo2Vtbl;
EventTarget_Init(&ret->event_target, (IUnknown*)&ret->IHTMLXMLHttpRequest_iface,
&HTMLXMLHttpRequest_dispex, This->window->doc->document_mode);
EventTarget_Init(&ret->event_target, &HTMLXMLHttpRequest_dispex, This->window->doc->document_mode);
/* Always register the handlers because we need them to track state */
event_listener->nsIDOMEventListener_iface.lpVtbl = &XMLHttpReqEventListenerVtbl;
......@@ -1853,8 +1852,7 @@ HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpReq
ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl;
ret->window = window;
init_dispatch(&ret->dispex, (IUnknown*)&ret->IHTMLXMLHttpRequestFactory_iface,
&HTMLXMLHttpRequestFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
init_dispatch(&ret->dispex, &HTMLXMLHttpRequestFactory_dispex, dispex_compat_mode(&window->event_target.dispex));
*ret_ptr = ret;
return S_OK;
......
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