mshtml: Added IHTMLElement3::fireEvent implementation.

This commit is contained in:
Jacek Caban 2009-10-13 00:42:02 +02:00 committed by Alexandre Julliard
parent 672bca557a
commit 946bd4ae1c
3 changed files with 31 additions and 2 deletions

View File

@ -29,6 +29,7 @@
#include "wine/unicode.h"
#include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@ -292,8 +293,11 @@ static HRESULT WINAPI HTMLElement3_fireEvent(IHTMLElement3 *iface, BSTR bstrEven
VARIANT *pvarEventObject, VARIANT_BOOL *pfCancelled)
{
HTMLElement *This = HTMLELEM3_THIS(iface);
FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCancelled);
return E_NOTIMPL;
TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(bstrEventName), debugstr_variant(pvarEventObject),
pfCancelled);
return dispatch_event(&This->node, bstrEventName, pvarEventObject, pfCancelled);
}
static HRESULT WINAPI HTMLElement3_put_onresizestart(IHTMLElement3 *iface, VARIANT v)

View File

@ -853,6 +853,30 @@ void fire_event(HTMLDocumentNode *doc, eventid_t eid, nsIDOMNode *target, nsIDOM
doc->basedoc.window->event = prev_event;
}
HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *event_obj, VARIANT_BOOL *cancelled)
{
eventid_t eid;
eid = attr_to_eid(event_name);
if(eid == EVENTID_LAST) {
WARN("unknown event %s\n", debugstr_w(event_name));
return E_INVALIDARG;
}
if(event_obj && V_VT(event_obj) != VT_EMPTY && V_VT(event_obj) != VT_ERROR)
FIXME("event_obj not implemented\n");
if(!(event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
FIXME("not EVENT_DEFAULTEVENTHANDLER\n");
return E_NOTIMPL;
}
fire_event(node->doc, eid, node->nsnode, NULL);
*cancelled = VARIANT_TRUE; /* FIXME */
return S_OK;
}
static inline event_target_t *get_event_target(event_target_t **event_target_ptr)
{
if(!*event_target_ptr)

View File

@ -45,6 +45,7 @@ void fire_event(HTMLDocumentNode*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*);
HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*);
static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
{