mshtml: Added IHTMLDocument4::createEventObject implementation.

This commit is contained in:
Jacek Caban 2012-09-13 12:27:56 +02:00 committed by Alexandre Julliard
parent 74453fb0fd
commit fffb717b1b
3 changed files with 36 additions and 5 deletions

View File

@ -762,8 +762,15 @@ static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
{
HTMLDocument *This = impl_from_IHTMLDocument4(iface);
FIXME("(%p)->(%p %p)\n", This, pvarEventObject, ppEventObj);
return E_NOTIMPL;
TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj);
if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) {
FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject));
return E_NOTIMPL;
}
return create_event_obj(ppEventObj);
}
static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,

View File

@ -364,6 +364,11 @@ static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLEle
TRACE("(%p)->(%p)\n", This, p);
if(!This->target) {
*p = NULL;
return S_OK;
}
return IHTMLDOMNode_QueryInterface(&This->target->IHTMLDOMNode_iface, &IID_IHTMLElement,
(void**)p);
}
@ -581,6 +586,11 @@ static HRESULT WINAPI HTMLEventObj_get_type(IHTMLEventObj *iface, BSTR *p)
TRACE("(%p)->(%p)\n", This, p);
if(!This->type) {
*p = NULL;
return S_OK;
}
*p = SysAllocString(This->type->name);
return *p ? S_OK : E_OUTOFMEMORY;
}
@ -800,12 +810,12 @@ static HTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEven
ret->IHTMLEventObj_iface.lpVtbl = &HTMLEventObjVtbl;
ret->ref = 1;
ret->type = event_info+eid;
ret->type = eid != EVENTID_LAST ? event_info+eid : NULL;
ret->nsevent = nsevent;
if(nsevent) {
nsIDOMEvent_AddRef(nsevent);
}else if(event_types[event_info[eid].type]) {
}else if(eid != EVENTID_LAST && event_types[event_info[eid].type]) {
nsAString type_str;
nsresult nsres;
@ -820,13 +830,26 @@ static HTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEven
}
ret->target = target;
IHTMLDOMNode_AddRef(&target->IHTMLDOMNode_iface);
if(target)
IHTMLDOMNode_AddRef(&target->IHTMLDOMNode_iface);
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLEventObj_iface, &HTMLEventObj_dispex);
return ret;
}
HRESULT create_event_obj(IHTMLEventObj **ret)
{
HTMLEventObj *event;
event = create_event(NULL, EVENTID_LAST, NULL);
if(!event)
return E_OUTOFMEMORY;
*ret = &event->IHTMLEventObj_iface;
return S_OK;
}
static HRESULT call_disp_func(IDispatch *disp, DISPPARAMS *dp, VARIANT *retv)
{
IDispatchEx *dispex;

View File

@ -60,6 +60,7 @@ HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN;
HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN;
HRESULT create_event_obj(IHTMLEventObj**) DECLSPEC_HIDDEN;
void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;