mshtml: Simplify IHTMLElement::click implementation.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-10-12 14:26:57 +02:00 committed by Alexandre Julliard
parent 4895156369
commit 353d9d826a
23 changed files with 13 additions and 58 deletions

View File

@ -794,7 +794,6 @@ static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLAnchorElement_traverse,
HTMLAnchorElement_unlink
};

View File

@ -872,7 +872,6 @@ static const NodeImplVtbl HTMLBodyElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLBodyElement_traverse,
HTMLBodyElement_unlink,
HTMLBodyElement_is_text_edit,

View File

@ -4949,7 +4949,6 @@ static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLDocumentNode_traverse,
HTMLDocumentNode_unlink
};

View File

@ -1785,10 +1785,22 @@ static HRESULT WINAPI HTMLElement_get_isTextEdit(IHTMLElement *iface, VARIANT_BO
static HRESULT WINAPI HTMLElement_click(IHTMLElement *iface)
{
HTMLElement *This = impl_from_IHTMLElement(iface);
nsresult nsres;
TRACE("(%p)\n", This);
return call_fire_event(&This->node, EVENTID_CLICK);
if(!This->nselem) {
FIXME("not implemented for comments\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_Click(This->nselem);
if(NS_FAILED(nsres)) {
ERR("Click failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
}
static HRESULT WINAPI HTMLElement_get_filters(IHTMLElement *iface,

View File

@ -1264,22 +1264,6 @@ HRESULT dispatch_event(HTMLDOMNode *node, const WCHAR *event_name, VARIANT *even
return S_OK;
}
HRESULT call_fire_event(HTMLDOMNode *node, eventid_t eid)
{
HRESULT hres;
if(node->vtbl->fire_event) {
BOOL handled = FALSE;
hres = node->vtbl->fire_event(node, eid, &handled);
if(handled)
return hres;
}
fire_event(node->doc, eid, TRUE, node, NULL, NULL);
return S_OK;
}
HRESULT ensure_doc_nsevent_handler(HTMLDocumentNode *doc, eventid_t eid)
{
nsIDOMNode *nsnode = NULL;

View File

@ -64,7 +64,6 @@ HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT attach_event(EventTarget*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT detach_event(EventTarget*,BSTR,IDispatch*) DECLSPEC_HIDDEN;
HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN;
void update_doc_cp_events(HTMLDocumentNode*,cp_static_data_t*) DECLSPEC_HIDDEN;
HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN;

View File

@ -778,7 +778,6 @@ static const NodeImplVtbl HTMLFormElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLFormElement_get_dispid,
HTMLFormElement_invoke,
NULL,

View File

@ -297,7 +297,6 @@ static const NodeImplVtbl HTMLFrameElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLFrameElement_get_document,
HTMLFrameElement_get_readystate,
HTMLFrameElement_get_dispid,

View File

@ -343,7 +343,6 @@ static const NodeImplVtbl HTMLHtmlElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLHtmlElement_is_settable
};

View File

@ -570,7 +570,6 @@ static const NodeImplVtbl HTMLIFrameImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLIFrame_get_document,
HTMLIFrame_get_readystate,
HTMLIFrame_get_dispid,

View File

@ -718,7 +718,6 @@ static const NodeImplVtbl HTMLImgElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLImgElement_get_readystate,
NULL,
NULL,

View File

@ -1397,25 +1397,6 @@ static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
return HTMLElement_QI(&This->element.node, riid, ppv);
}
static HRESULT HTMLInputElementImpl_fire_event(HTMLDOMNode *iface, eventid_t eid, BOOL *handled)
{
HTMLInputElement *This = impl_from_HTMLDOMNode(iface);
if(eid == EVENTID_CLICK) {
nsresult nsres;
*handled = TRUE;
nsres = nsIDOMHTMLElement_Click(This->element.nselem);
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 = impl_from_HTMLDOMNode(iface);
@ -1483,7 +1464,6 @@ static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLElement_handle_event,
HTMLElement_get_attr_col,
NULL,
HTMLInputElementImpl_fire_event,
HTMLInputElementImpl_put_disabled,
HTMLInputElementImpl_get_disabled,
NULL,
@ -2031,7 +2011,6 @@ static const NodeImplVtbl HTMLButtonElementImplVtbl = {
HTMLElement_handle_event,
HTMLElement_get_attr_col,
NULL,
NULL,
HTMLButtonElementImpl_put_disabled,
HTMLButtonElementImpl_get_disabled,
NULL,

View File

@ -430,7 +430,6 @@ static const NodeImplVtbl HTMLLinkElementImplVtbl = {
HTMLElement_handle_event,
HTMLElement_get_attr_col,
NULL,
NULL,
HTMLLinkElementImpl_put_disabled,
HTMLLinkElementImpl_get_disabled,
NULL,

View File

@ -756,7 +756,6 @@ static const NodeImplVtbl HTMLObjectElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLObjectElement_get_readystate,
HTMLObjectElement_get_dispid,
HTMLObjectElement_invoke,

View File

@ -432,7 +432,6 @@ static const NodeImplVtbl HTMLOptionElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLOptionElement_traverse,
HTMLOptionElement_unlink
};

View File

@ -441,7 +441,6 @@ static const NodeImplVtbl HTMLScriptElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLScriptElement_get_readystate,
NULL,
NULL,

View File

@ -697,7 +697,6 @@ static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLElement_handle_event,
HTMLElement_get_attr_col,
NULL,
NULL,
HTMLSelectElementImpl_put_disabled,
HTMLSelectElementImpl_get_disabled,
NULL,

View File

@ -355,7 +355,6 @@ static const NodeImplVtbl HTMLStyleElementImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLStyleElement_traverse,
HTMLStyleElement_unlink
};

View File

@ -1057,7 +1057,6 @@ static const NodeImplVtbl HTMLTableImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLTable_traverse,
HTMLTable_unlink
};

View File

@ -476,7 +476,6 @@ static const NodeImplVtbl HTMLTableCellImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLTableCell_traverse,
HTMLTableCell_unlink
};

View File

@ -438,7 +438,6 @@ static const NodeImplVtbl HTMLTableRowImplVtbl = {
NULL,
NULL,
NULL,
NULL,
HTMLTableRow_traverse,
HTMLTableRow_unlink
};

View File

@ -484,7 +484,6 @@ static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLElement_handle_event,
HTMLElement_get_attr_col,
NULL,
NULL,
HTMLTextAreaElementImpl_put_disabled,
HTMLTextAreaElementImpl_get_disabled,
NULL,

View File

@ -715,7 +715,6 @@ typedef struct {
HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
EventTarget *(*get_event_target)(HTMLDOMNode*);
HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
HRESULT (*get_disabled)(HTMLDOMNode*,VARIANT_BOOL*);
HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);