mshtml: Added IHTMLWindow2::onhelp property implementation.

This commit is contained in:
Jacek Caban 2012-09-04 13:58:58 +02:00 committed by Alexandre Julliard
parent 4ff0a82416
commit f63da13c28
26 changed files with 72 additions and 20 deletions

View File

@ -673,17 +673,15 @@ static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid,
} }
} }
return S_OK; return HTMLElement_handle_event(&This->element.node, eid, event, prevent_default);
} }
static const NodeImplVtbl HTMLAnchorElementImplVtbl = { static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
HTMLAnchorElement_QI, HTMLAnchorElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_get_attr_col, HTMLAnchorElement_handle_event,
NULL, HTMLElement_get_attr_col
NULL,
HTMLAnchorElement_handle_event
}; };
static const tid_t HTMLAnchorElement_iface_tids[] = { static const tid_t HTMLAnchorElement_iface_tids[] = {

View File

@ -769,6 +769,7 @@ static const NodeImplVtbl HTMLBodyElementImplVtbl = {
HTMLBodyElement_QI, HTMLBodyElement_QI,
HTMLBodyElement_destructor, HTMLBodyElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
HTMLBodyElement_get_event_target HTMLBodyElement_get_event_target
}; };

View File

@ -173,6 +173,7 @@ static const NodeImplVtbl HTMLCommentElementImplVtbl = {
HTMLCommentElement_QI, HTMLCommentElement_QI,
HTMLCommentElement_destructor, HTMLCommentElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -1604,10 +1604,41 @@ HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **
return S_OK; return S_OK;
} }
HRESULT HTMLElement_handle_event(HTMLDOMNode *iface, DWORD eid, nsIDOMEvent *event, BOOL *prevent_default)
{
HTMLElement *This = impl_from_HTMLDOMNode(iface);
switch(eid) {
case EVENTID_KEYDOWN: {
nsIDOMKeyEvent *key_event;
nsresult nsres;
nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
if(NS_SUCCEEDED(nsres)) {
PRUint32 code = 0;
nsIDOMKeyEvent_GetKeyCode(key_event, &code);
switch(code) {
case VK_F1: /* DOM_VK_F1 */
TRACE("F1 pressed\n");
fire_event(This->node.doc, EVENTID_HELP, TRUE, This->node.nsnode, NULL);
*prevent_default = TRUE;
}
nsIDOMKeyEvent_Release(key_event);
}
}
}
return S_OK;
}
static const NodeImplVtbl HTMLElementImplVtbl = { static const NodeImplVtbl HTMLElementImplVtbl = {
HTMLElement_QI, HTMLElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -255,6 +255,7 @@ static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
HTMLEmbedElement_QI, HTMLEmbedElement_QI,
HTMLEmbedElement_destructor, HTMLEmbedElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -74,6 +74,9 @@ static const WCHAR onerrorW[] = {'o','n','e','r','r','o','r',0};
static const WCHAR focusW[] = {'f','o','c','u','s',0}; static const WCHAR focusW[] = {'f','o','c','u','s',0};
static const WCHAR onfocusW[] = {'o','n','f','o','c','u','s',0}; static const WCHAR onfocusW[] = {'o','n','f','o','c','u','s',0};
static const WCHAR helpW[] = {'h','e','l','p',0};
static const WCHAR onhelpW[] = {'o','n','h','e','l','p',0};
static const WCHAR keydownW[] = {'k','e','y','d','o','w','n',0}; static const WCHAR keydownW[] = {'k','e','y','d','o','w','n',0};
static const WCHAR onkeydownW[] = {'o','n','k','e','y','d','o','w','n',0}; static const WCHAR onkeydownW[] = {'o','n','k','e','y','d','o','w','n',0};
@ -170,8 +173,10 @@ static const event_info_t event_info[] = {
EVENT_NODEHANDLER}, EVENT_NODEHANDLER},
{focusW, onfocusW, EVENTT_HTML, DISPID_EVMETH_ONFOCUS, {focusW, onfocusW, EVENTT_HTML, DISPID_EVMETH_ONFOCUS,
EVENT_DEFAULTLISTENER}, EVENT_DEFAULTLISTENER},
{helpW, onhelpW, EVENTT_KEY, DISPID_EVMETH_ONHELP,
EVENT_BUBBLE|EVENT_CANCELABLE},
{keydownW, onkeydownW, EVENTT_KEY, DISPID_EVMETH_ONKEYDOWN, {keydownW, onkeydownW, EVENTT_KEY, DISPID_EVMETH_ONKEYDOWN,
EVENT_DEFAULTLISTENER|EVENT_BUBBLE}, EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_HASDEFAULTHANDLERS},
{keypressW, onkeypressW, EVENTT_KEY, DISPID_EVMETH_ONKEYPRESS, {keypressW, onkeypressW, EVENTT_KEY, DISPID_EVMETH_ONKEYPRESS,
EVENT_DEFAULTLISTENER|EVENT_BUBBLE}, EVENT_DEFAULTLISTENER|EVENT_BUBBLE},
{keyupW, onkeyupW, EVENTT_KEY, DISPID_EVMETH_ONKEYUP, {keyupW, onkeyupW, EVENTT_KEY, DISPID_EVMETH_ONKEYUP,

View File

@ -27,6 +27,7 @@ typedef enum {
EVENTID_DRAGSTART, EVENTID_DRAGSTART,
EVENTID_ERROR, EVENTID_ERROR,
EVENTID_FOCUS, EVENTID_FOCUS,
EVENTID_HELP,
EVENTID_KEYDOWN, EVENTID_KEYDOWN,
EVENTID_KEYPRESS, EVENTID_KEYPRESS,
EVENTID_KEYUP, EVENTID_KEYUP,

View File

@ -632,6 +632,7 @@ static const NodeImplVtbl HTMLFormElementImplVtbl = {
HTMLFormElement_QI, HTMLFormElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
@ -639,7 +640,6 @@ static const NodeImplVtbl HTMLFormElementImplVtbl = {
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLFormElement_get_dispid, HTMLFormElement_get_dispid,
HTMLFormElement_invoke HTMLFormElement_invoke
}; };

View File

@ -270,12 +270,12 @@ static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI, HTMLFrameElement_QI,
HTMLFrameElement_destructor, HTMLFrameElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLFrameElement_get_document, HTMLFrameElement_get_document,
HTMLFrameElement_get_readystate, HTMLFrameElement_get_readystate,
HTMLFrameElement_get_dispid, HTMLFrameElement_get_dispid,

View File

@ -155,6 +155,7 @@ static const NodeImplVtbl HTMLGenericElementImplVtbl = {
HTMLGenericElement_QI, HTMLGenericElement_QI,
HTMLGenericElement_destructor, HTMLGenericElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -156,6 +156,7 @@ static const NodeImplVtbl HTMLTitleElementImplVtbl = {
HTMLTitleElement_QI, HTMLTitleElement_QI,
HTMLTitleElement_destructor, HTMLTitleElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };
@ -314,6 +315,7 @@ static const NodeImplVtbl HTMLHeadElementImplVtbl = {
HTMLHeadElement_QI, HTMLHeadElement_QI,
HTMLHeadElement_destructor, HTMLHeadElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -482,12 +482,12 @@ static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_QI, HTMLIFrame_QI,
HTMLIFrame_destructor, HTMLIFrame_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLIFrame_get_document, HTMLIFrame_get_document,
HTMLIFrame_get_readystate, HTMLIFrame_get_readystate,
HTMLIFrame_get_dispid, HTMLIFrame_get_dispid,

View File

@ -633,13 +633,13 @@ static const NodeImplVtbl HTMLImgElementImplVtbl = {
HTMLImgElement_QI, HTMLImgElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLImgElement_get_readystate HTMLImgElement_get_readystate
}; };

View File

@ -1177,10 +1177,10 @@ static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLInputElement_QI, HTMLInputElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
HTMLInputElementImpl_fire_event, HTMLInputElementImpl_fire_event,
NULL,
HTMLInputElementImpl_put_disabled, HTMLInputElementImpl_put_disabled,
HTMLInputElementImpl_get_disabled, HTMLInputElementImpl_get_disabled,
}; };

View File

@ -254,6 +254,7 @@ static const NodeImplVtbl HTMLMetaElementImplVtbl = {
HTMLMetaElement_QI, HTMLMetaElement_QI,
HTMLMetaElement_destructor, HTMLMetaElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -697,13 +697,13 @@ static const NodeImplVtbl HTMLObjectElementImplVtbl = {
HTMLObjectElement_QI, HTMLObjectElement_QI,
HTMLObjectElement_destructor, HTMLObjectElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLObjectElement_get_readystate, HTMLObjectElement_get_readystate,
HTMLObjectElement_get_dispid, HTMLObjectElement_get_dispid,
HTMLObjectElement_invoke HTMLObjectElement_invoke

View File

@ -315,6 +315,7 @@ static const NodeImplVtbl HTMLOptionElementImplVtbl = {
HTMLOptionElement_QI, HTMLOptionElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -317,13 +317,13 @@ static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_QI, HTMLScriptElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
NULL,
HTMLScriptElement_get_readystate HTMLScriptElement_get_readystate
}; };

View File

@ -600,10 +600,10 @@ static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLSelectElement_QI, HTMLSelectElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL,
HTMLSelectElementImpl_put_disabled, HTMLSelectElementImpl_put_disabled,
HTMLSelectElementImpl_get_disabled, HTMLSelectElementImpl_get_disabled,
NULL, NULL,

View File

@ -287,6 +287,7 @@ static const NodeImplVtbl HTMLStyleElementImplVtbl = {
HTMLStyleElement_QI, HTMLStyleElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -746,6 +746,7 @@ static const NodeImplVtbl HTMLTableImplVtbl = {
HTMLTable_QI, HTMLTable_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -341,6 +341,7 @@ static const NodeImplVtbl HTMLTableCellImplVtbl = {
HTMLTableCell_QI, HTMLTableCell_QI,
HTMLTableCell_destructor, HTMLTableCell_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -292,6 +292,7 @@ static const NodeImplVtbl HTMLTableRowImplVtbl = {
HTMLTableRow_QI, HTMLTableRow_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col HTMLElement_get_attr_col
}; };

View File

@ -415,10 +415,10 @@ static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLTextAreaElement_QI, HTMLTextAreaElement_QI,
HTMLElement_destructor, HTMLElement_destructor,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event,
HTMLElement_get_attr_col, HTMLElement_get_attr_col,
NULL, NULL,
NULL, NULL,
NULL,
HTMLTextAreaElementImpl_put_disabled, HTMLTextAreaElementImpl_put_disabled,
HTMLTextAreaElementImpl_get_disabled HTMLTextAreaElementImpl_get_disabled
}; };

View File

@ -1021,15 +1021,19 @@ static HRESULT WINAPI HTMLWindow2_get_onunload(IHTMLWindow2 *iface, VARIANT *p)
static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v) static HRESULT WINAPI HTMLWindow2_put_onhelp(IHTMLWindow2 *iface, VARIANT v)
{ {
HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLWindow *This = impl_from_IHTMLWindow2(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL; TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
return set_window_event(This, EVENTID_HELP, &v);
} }
static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p) static HRESULT WINAPI HTMLWindow2_get_onhelp(IHTMLWindow2 *iface, VARIANT *p)
{ {
HTMLWindow *This = impl_from_IHTMLWindow2(iface); HTMLWindow *This = impl_from_IHTMLWindow2(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL; TRACE("(%p)->(%p)\n", This, p);
return get_window_event(This, EVENTID_HELP, p);
} }
static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v) static HRESULT WINAPI HTMLWindow2_put_onerror(IHTMLWindow2 *iface, VARIANT v)

View File

@ -592,10 +592,10 @@ typedef struct {
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**); HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
void (*destructor)(HTMLDOMNode*); void (*destructor)(HTMLDOMNode*);
HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**); HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*);
HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**); HRESULT (*get_attr_col)(HTMLDOMNode*,HTMLAttributeCollection**);
event_target_t **(*get_event_target)(HTMLDOMNode*); event_target_t **(*get_event_target)(HTMLDOMNode*);
HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*); HRESULT (*fire_event)(HTMLDOMNode*,DWORD,BOOL*);
HRESULT (*handle_event)(HTMLDOMNode*,DWORD,nsIDOMEvent*,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*);
HRESULT (*get_document)(HTMLDOMNode*,IDispatch**); HRESULT (*get_document)(HTMLDOMNode*,IDispatch**);
@ -892,6 +892,7 @@ HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**) DECLSPEC_HIDDEN;
void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN; void HTMLElement_destructor(HTMLDOMNode*) DECLSPEC_HIDDEN;
HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN; HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN; HRESULT HTMLElement_get_attr_col(HTMLDOMNode*,HTMLAttributeCollection**) DECLSPEC_HIDDEN;
HRESULT HTMLElement_handle_event(HTMLDOMNode*,DWORD,nsIDOMEvent*,BOOL*) DECLSPEC_HIDDEN;
HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**) DECLSPEC_HIDDEN;
void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN; void HTMLFrameBase_destructor(HTMLFrameBase*) DECLSPEC_HIDDEN;