Module: wine Branch: master Commit: 6e319087a997da62e4330e7882b7cc4e5e3680c8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6e319087a997da62e4330e7882...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Oct 13 00:42:22 2009 +0200
mshtml: Added IHTMLElement::click implementation.
---
dlls/mshtml/htmlelem.c | 6 ++++-- dlls/mshtml/htmlevent.c | 16 ++++++++++++++++ dlls/mshtml/htmlevent.h | 1 + dlls/mshtml/htmlinput.c | 21 +++++++++++++++++++++ dlls/mshtml/htmlselect.c | 1 + dlls/mshtml/htmltextarea.c | 1 + dlls/mshtml/mshtml_private.h | 1 + 7 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 28421bb..d019634 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1103,8 +1103,10 @@ static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BO static HRESULT WINAPI HTMLElement_click(IHTMLElement *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, diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c index b006478..a6c95a3 100644 --- a/dlls/mshtml/htmlevent.c +++ b/dlls/mshtml/htmlevent.c @@ -877,6 +877,22 @@ HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *even 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) { if(!*event_target_ptr) diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h index 6c716a8..21e7ff0 100644 --- a/dlls/mshtml/htmlevent.h +++ b/dlls/mshtml/htmlevent.h @@ -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 attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,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) { diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 7db777c..488e2b1 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -28,6 +28,7 @@ #include "wine/debug.h"
#include "mshtml_private.h" +#include "htmlevent.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@@ -1129,6 +1130,25 @@ static void HTMLInputElement_destructor(HTMLDOMNode *iface) 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) { HTMLInputElement *This = HTMLINPUT_NODE_THIS(iface); @@ -1147,6 +1167,7 @@ static const NodeImplVtbl HTMLInputElementImplVtbl = { HTMLInputElement_QI, HTMLInputElement_destructor, NULL, + HTMLInputElementImpl_call_event, HTMLInputElementImpl_put_disabled, HTMLInputElementImpl_get_disabled, }; diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index f3dd757..ded73f6 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -481,6 +481,7 @@ static const NodeImplVtbl HTMLSelectElementImplVtbl = { HTMLSelectElement_QI, HTMLSelectElement_destructor, NULL, + NULL, HTMLSelectElementImpl_put_disabled, HTMLSelectElementImpl_get_disabled }; diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index 2ff5c25..c34c841 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -406,6 +406,7 @@ static const NodeImplVtbl HTMLTextAreaElementImplVtbl = { HTMLTextAreaElement_QI, HTMLTextAreaElement_destructor, NULL, + NULL, HTMLTextAreaElementImpl_put_disabled, HTMLTextAreaElementImpl_get_disabled }; diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 44a816e..51074ed 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -425,6 +425,7 @@ typedef struct { HRESULT (*qi)(HTMLDOMNode*,REFIID,void**); void (*destructor)(HTMLDOMNode*); event_target_t **(*get_event_target)(HTMLDOMNode*); + HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*); HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL); HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*); } NodeImplVtbl;