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

mshtml: Added IHTMLDocument4::createEventObject implementation.

parent 74453fb0
......@@ -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);
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,
......
......@@ -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,6 +830,7 @@ static HTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEven
}
ret->target = target;
if(target)
IHTMLDOMNode_AddRef(&target->IHTMLDOMNode_iface);
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLEventObj_iface, &HTMLEventObj_dispex);
......@@ -827,6 +838,18 @@ static HTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEven
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;
......
......@@ -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;
......
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