mshtml: Make HTMLInnerWindow inherit from EventTarget.
This commit is contained in:
parent
a1d837c341
commit
2f4e85abb8
|
@ -95,7 +95,7 @@ static inline HRESULT set_window_event(HTMLWindow *window, eventid_t eid, VARIAN
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return set_event_handler(&window->inner_window->dispex, &window->inner_window->doc->body_event_target,
|
return set_event_handler(&window->inner_window->event_target.dispex, &window->inner_window->doc->body_event_target,
|
||||||
window->inner_window->doc, eid, var);
|
window->inner_window->doc, eid, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIAN
|
||||||
return E_FAIL;
|
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)
|
static void detach_inner_window(HTMLInnerWindow *window)
|
||||||
|
@ -170,7 +170,7 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii
|
||||||
*ppv = &This->ITravelLogClient_iface;
|
*ppv = &This->ITravelLogClient_iface;
|
||||||
}else if(IsEqualGUID(&IID_IObjectIdentity, riid)) {
|
}else if(IsEqualGUID(&IID_IObjectIdentity, riid)) {
|
||||||
*ppv = &This->IObjectIdentity_iface;
|
*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);
|
assert(!*ppv);
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}else {
|
}else {
|
||||||
|
@ -236,7 +236,7 @@ static void release_inner_window(HTMLInnerWindow *This)
|
||||||
htmldoc_release(&This->doc->basedoc);
|
htmldoc_release(&This->doc->basedoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
release_dispex(&This->dispex);
|
release_dispex(&This->event_target.dispex);
|
||||||
|
|
||||||
for(i=0; i < This->global_prop_cnt; i++)
|
for(i=0; i < This->global_prop_cnt; i++)
|
||||||
heap_free(This->global_props[i].name);
|
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);
|
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,
|
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);
|
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,
|
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 */
|
/* 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);
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2547,7 +2547,7 @@ static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName,
|
||||||
if(hres != DISP_E_UNKNOWNNAME)
|
if(hres != DISP_E_UNKNOWNNAME)
|
||||||
return hres;
|
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)
|
if(hres != DISP_E_UNKNOWNNAME)
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
@ -2614,7 +2614,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
|
||||||
return hres;
|
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)
|
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);
|
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)
|
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);
|
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)
|
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);
|
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);
|
pgrfdex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2651,7 +2651,7 @@ static HRESULT WINAPI WindowDispEx_GetMemberName(IDispatchEx *iface, DISPID id,
|
||||||
|
|
||||||
TRACE("(%p)->(%x %p)\n", This, id, pbstrName);
|
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)
|
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);
|
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)
|
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)
|
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,
|
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: {
|
case DISPATCH_PROPERTYPUT: {
|
||||||
DISPID dispex_id;
|
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))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
prop->type = GLOBAL_DISPEXVAR;
|
prop->type = GLOBAL_DISPEXVAR;
|
||||||
prop->id = dispex_id;
|
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:
|
default:
|
||||||
FIXME("Not supported flags: %x\n", flags);
|
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;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
case GLOBAL_DISPEXVAR:
|
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:
|
default:
|
||||||
ERR("invalid type %d\n", prop->type);
|
ERR("invalid type %d\n", prop->type);
|
||||||
hres = DISP_E_MEMBERNOTFOUND;
|
hres = DISP_E_MEMBERNOTFOUND;
|
||||||
|
@ -2849,12 +2849,18 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
|
||||||
return hres;
|
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 = {
|
static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl = {
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
HTMLWindow_invoke,
|
HTMLWindow_invoke,
|
||||||
NULL
|
NULL,
|
||||||
|
HTMLWindow_get_event_target_ptr
|
||||||
};
|
};
|
||||||
|
|
||||||
static const tid_t HTMLWindow_iface_tids[] = {
|
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.outer_window = outer_window;
|
||||||
window->base.inner_window = 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();
|
window->task_magic = get_task_target_magic();
|
||||||
|
|
||||||
|
|
|
@ -426,7 +426,7 @@ struct HTMLOuterWindow {
|
||||||
|
|
||||||
struct HTMLInnerWindow {
|
struct HTMLInnerWindow {
|
||||||
HTMLWindow base;
|
HTMLWindow base;
|
||||||
DispatchEx dispex;
|
EventTarget event_target;
|
||||||
|
|
||||||
HTMLDocumentNode *doc;
|
HTMLDocumentNode *doc;
|
||||||
|
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ static event_target_t **find_event_target(HTMLDocumentNode *doc, HTMLScriptEleme
|
||||||
htmldoc_addref(&doc->basedoc);
|
htmldoc_addref(&doc->basedoc);
|
||||||
}else if(!strcmpW(target_id, windowW)) {
|
}else if(!strcmpW(target_id, windowW)) {
|
||||||
if(doc->window) {
|
if(doc->window) {
|
||||||
target_dispex = &doc->window->dispex;
|
target_dispex = &doc->window->event_target.dispex;
|
||||||
IDispatchEx_AddRef(&target_dispex->IDispatchEx_iface);
|
IDispatchEx_AddRef(&target_dispex->IDispatchEx_iface);
|
||||||
target = &doc->body_event_target;
|
target = &doc->body_event_target;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue