mshtml: Added IHTMLElement::click implementation.

This commit is contained in:
Jacek Caban 2009-10-13 00:42:22 +02:00 committed by Alexandre Julliard
parent 946bd4ae1c
commit 6e319087a9
7 changed files with 45 additions and 2 deletions

View File

@ -1103,8 +1103,10 @@ static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BO
static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface) static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
{ {
HTMLElement *This = HTMLELEM_THIS(iface); HTMLElement *This = HTMLELEM_THIS(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL; TRACE("(%p)\n", This);
return call_event(&This->node, EVENTID_CLICK);
} }
static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface, static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,

View File

@ -877,6 +877,22 @@ HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *even
return S_OK; return S_OK;
} }
HRESULT call_event(HTMLDOMNode *node, eventid_t eid)
{
HRESULT hres;
if(node->vtbl->call_event) {
BOOL handled = FALSE;
hres = node->vtbl->call_event(node, eid, &handled);
if(handled)
return hres;
}
fire_event(node->doc, eid, node->nsnode, NULL);
return S_OK;
}
static inline event_target_t *get_event_target(event_target_t **event_target_ptr) static inline event_target_t *get_event_target(event_target_t **event_target_ptr)
{ {
if(!*event_target_ptr) if(!*event_target_ptr)

View File

@ -46,6 +46,7 @@ HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
HRESULT get_event_handler(event_target_t**,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 attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*); HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*);
HRESULT call_event(HTMLDOMNode*,eventid_t);
static inline event_target_t **get_node_event_target(HTMLDOMNode *node) static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
{ {

View File

@ -28,6 +28,7 @@
#include "wine/debug.h" #include "wine/debug.h"
#include "mshtml_private.h" #include "mshtml_private.h"
#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@ -1129,6 +1130,25 @@ static void HTMLInputElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(&This->element.node); HTMLElement_destructor(&This->element.node);
} }
static HRESULT HTMLInputElementImpl_call_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
{
HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
if(eid == EVENTID_CLICK) {
nsresult nsres;
*handled = TRUE;
nsres = nsIDOMHTMLInputElement_Click(This->nsinput);
if(NS_FAILED(nsres)) {
ERR("Click failed: %08x\n", nsres);
return E_FAIL;
}
}
return S_OK;
}
static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v) static HRESULT HTMLInputElementImpl_put_disabled(HTMLDOMNode *iface, VARIANT_BOOL v)
{ {
HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface); HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface);
@ -1147,6 +1167,7 @@ static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLInputElement_QI, HTMLInputElement_QI,
HTMLInputElement_destructor, HTMLInputElement_destructor,
NULL, NULL,
HTMLInputElementImpl_call_event,
HTMLInputElementImpl_put_disabled, HTMLInputElementImpl_put_disabled,
HTMLInputElementImpl_get_disabled, HTMLInputElementImpl_get_disabled,
}; };

View File

@ -481,6 +481,7 @@ static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLSelectElement_QI, HTMLSelectElement_QI,
HTMLSelectElement_destructor, HTMLSelectElement_destructor,
NULL, NULL,
NULL,
HTMLSelectElementImpl_put_disabled, HTMLSelectElementImpl_put_disabled,
HTMLSelectElementImpl_get_disabled HTMLSelectElementImpl_get_disabled
}; };

View File

@ -406,6 +406,7 @@ static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLTextAreaElement_QI, HTMLTextAreaElement_QI,
HTMLTextAreaElement_destructor, HTMLTextAreaElement_destructor,
NULL, NULL,
NULL,
HTMLTextAreaElementImpl_put_disabled, HTMLTextAreaElementImpl_put_disabled,
HTMLTextAreaElementImpl_get_disabled HTMLTextAreaElementImpl_get_disabled
}; };

View File

@ -425,6 +425,7 @@ typedef struct {
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**); HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
void (*destructor)(HTMLDOMNode*); void (*destructor)(HTMLDOMNode*);
event_target_t **(*get_event_target)(HTMLDOMNode*); event_target_t **(*get_event_target)(HTMLDOMNode*);
HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL); HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*); HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
} NodeImplVtbl; } NodeImplVtbl;