mshtml: Make HTMLInnerWindow inherit from EventTarget.

This commit is contained in:
Jacek Caban 2015-05-14 13:24:44 +02:00 committed by Alexandre Julliard
parent a1d837c341
commit 2f4e85abb8
3 changed files with 29 additions and 23 deletions

View File

@ -95,8 +95,8 @@ static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIAN
return E_FAIL;
}
return set_event_handler(&window->inner_window->dispex, &window->inner_window->doc->body_event_target,
window->inner_window->doc, eid, var);
return set_event_handler(&window->inner_window->event_target.dispex, &window->inner_window->doc->body_event_target,
window->inner_window->doc, eid, var);
}
static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var)
@ -106,7 +106,7 @@ static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIAN
return E_FAIL;
}
return get_event_handler(&window->inner_window->dispex, &window->inner_window->doc->body_event_target, eid, var);
return get_event_handler(&window->inner_window->event_target.dispex, &window->inner_window->doc->body_event_target, eid, var);
}
static void detach_inner_window(HTMLInnerWindow *window)
@ -170,7 +170,7 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii
*ppv = &This->ITravelLogClient_iface;
}else if(IsEqualGUID(&IID_IObjectIdentity, riid)) {
*ppv = &This->IObjectIdentity_iface;
}else if(dispex_query_interface(&This->inner_window->dispex, riid, ppv)) {
}else if(dispex_query_interface(&This->inner_window->event_target.dispex, riid, ppv)) {
assert(!*ppv);
return E_NOINTERFACE;
}else {
@ -236,7 +236,7 @@ static void release_inner_window(HTMLInnerWindow *This)
htmldoc_release(&This->doc->basedoc);
}
release_dispex(&This->dispex);
release_dispex(&This->event_target.dispex);
for(i=0; i < This->global_prop_cnt; i++)
heap_free(This->global_props[i].name);
@ -2424,7 +2424,7 @@ static HRESULT WINAPI WindowDispEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pc
TRACE("(%p)->(%p)\n", This, pctinfo);
return IDispatchEx_GetTypeInfoCount(&This->inner_window->dispex.IDispatchEx_iface, pctinfo);
return IDispatchEx_GetTypeInfoCount(&This->inner_window->event_target.dispex.IDispatchEx_iface, pctinfo);
}
static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
@ -2434,7 +2434,7 @@ static HRESULT WINAPI WindowDispEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return IDispatchEx_GetTypeInfo(&This->inner_window->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
return IDispatchEx_GetTypeInfo(&This->inner_window->event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI WindowDispEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
@ -2468,7 +2468,7 @@ static HRESULT WINAPI WindowDispEx_Invoke(IDispatchEx *iface, DISPID dispIdMembe
/* FIXME: Use script dispatch */
return IDispatchEx_Invoke(&This->inner_window->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
return IDispatchEx_Invoke(&This->inner_window->event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
}
@ -2547,7 +2547,7 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
if(hres != DISP_E_UNKNOWNNAME)
return hres;
hres = IDispatchEx_GetDispID(&window->base.inner_window->dispex.IDispatchEx_iface, bstrName, grfdex, pid);
hres = IDispatchEx_GetDispID(&window->base.inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex, pid);
if(hres != DISP_E_UNKNOWNNAME)
return hres;
@ -2614,7 +2614,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
return hres;
}
return IDispatchEx_InvokeEx(&window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
return IDispatchEx_InvokeEx(&window->event_target.dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
}
static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
@ -2623,7 +2623,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR b
TRACE("(%p)->(%s %x)\n", This, debugstr_w(bstrName), grfdex);
return IDispatchEx_DeleteMemberByName(&This->inner_window->dispex.IDispatchEx_iface, bstrName, grfdex);
return IDispatchEx_DeleteMemberByName(&This->inner_window->event_target.dispex.IDispatchEx_iface, bstrName, grfdex);
}
static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
@ -2632,7 +2632,7 @@ static HRESULT WINAPI WindowDispEx_DeleteMemberByDispID(IDispatchEx *iface, DISP
TRACE("(%p)->(%x)\n", This, id);
return IDispatchEx_DeleteMemberByDispID(&This->inner_window->dispex.IDispatchEx_iface, id);
return IDispatchEx_DeleteMemberByDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, id);
}
static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
@ -2641,7 +2641,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberProperties(IDispatchEx *iface, DISPI
TRACE("(%p)->(%x %x %p)\n", This, id, grfdexFetch, pgrfdex);
return IDispatchEx_GetMemberProperties(&This->inner_window->dispex.IDispatchEx_iface, id, grfdexFetch,
return IDispatchEx_GetMemberProperties(&This->inner_window->event_target.dispex.IDispatchEx_iface, id, grfdexFetch,
pgrfdex);
}
@ -2651,7 +2651,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id,
TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
return IDispatchEx_GetMemberName(&This->inner_window->dispex.IDispatchEx_iface, id, pbstrName);
return IDispatchEx_GetMemberName(&This->inner_window->event_target.dispex.IDispatchEx_iface, id, pbstrName);
}
static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
@ -2660,7 +2660,7 @@ static HRESULT WINAPI WindowDispEx_GetNextDispID(IDispatchEx *iface, DWORD grfde
TRACE("(%p)->(%x %x %p)\n", This, grfdex, id, pid);
return IDispatchEx_GetNextDispID(&This->inner_window->dispex.IDispatchEx_iface, grfdex, id, pid);
return IDispatchEx_GetNextDispID(&This->inner_window->event_target.dispex.IDispatchEx_iface, grfdex, id, pid);
}
static HRESULT WINAPI WindowDispEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
@ -2741,7 +2741,7 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
static inline HTMLInnerWindow *impl_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, HTMLInnerWindow, dispex);
return CONTAINING_RECORD(iface, HTMLInnerWindow, event_target.dispex);
}
static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
@ -2803,13 +2803,13 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
case DISPATCH_PROPERTYPUT: {
DISPID dispex_id;
hres = dispex_get_dynid(&This->dispex, prop->name, &dispex_id);
hres = dispex_get_dynid(&This->event_target.dispex, prop->name, &dispex_id);
if(FAILED(hres))
return hres;
prop->type = GLOBAL_DISPEXVAR;
prop->id = dispex_id;
return IDispatchEx_InvokeEx(&This->dispex.IDispatchEx_iface, dispex_id, 0, flags, params, res, ei, caller);
return IDispatchEx_InvokeEx(&This->event_target.dispex.IDispatchEx_iface, dispex_id, 0, flags, params, res, ei, caller);
}
default:
FIXME("Not supported flags: %x\n", flags);
@ -2840,7 +2840,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
return E_NOTIMPL;
}
case GLOBAL_DISPEXVAR:
return IDispatchEx_InvokeEx(&This->dispex.IDispatchEx_iface, prop->id, 0, flags, params, res, ei, caller);
return IDispatchEx_InvokeEx(&This->event_target.dispex.IDispatchEx_iface, prop->id, 0, flags, params, res, ei, caller);
default:
ERR("invalid type %d\n", prop->type);
hres = DISP_E_MEMBERNOTFOUND;
@ -2849,12 +2849,18 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
return hres;
}
static event_target_t **HTMLWindow_get_event_target_ptr(DispatchEx *dispex)
{
HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
return &This->doc->body_event_target;
}
static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl = {
NULL,
NULL,
HTMLWindow_invoke,
NULL
NULL,
HTMLWindow_get_event_target_ptr
};
static const tid_t HTMLWindow_iface_tids[] = {
@ -2910,7 +2916,7 @@ static HRESULT create_inner_window(HTMLOuterWindow *outer_window, IMoniker *mon,
window->base.outer_window = outer_window;
window->base.inner_window = window;
init_dispex(&window->dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex);
init_dispex(&window->event_target.dispex, (IUnknown*)&window->base.IHTMLWindow2_iface, &HTMLWindow_dispex);
window->task_magic = get_task_target_magic();

View File

@ -426,7 +426,7 @@ struct HTMLOuterWindow {
struct HTMLInnerWindow {
HTMLWindow base;
DispatchEx dispex;
EventTarget event_target;
HTMLDocumentNode *doc;

View File

@ -1340,7 +1340,7 @@ static event_target_t **find_event_target(HTMLDocumentNode *doc, HTMLScriptEleme
htmldoc_addref(&doc->basedoc);
}else if(!strcmpW(target_id, windowW)) {
if(doc->window) {
target_dispex = &doc->window->dispex;
target_dispex = &doc->window->event_target.dispex;
IDispatchEx_AddRef(&target_dispex->IDispatchEx_iface);
target = &doc->body_event_target;
}