mshtml: Follow anchors only on left button click.

This commit is contained in:
Jacek Caban 2012-01-27 15:55:33 +01:00 committed by Alexandre Julliard
parent 83693d9611
commit 0b55645820
3 changed files with 25 additions and 5 deletions

View file

@ -18,6 +18,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <assert.h>
#define COBJMACROS
@ -583,14 +584,33 @@ static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
HTMLElement_destructor(&This->element.node);
}
static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, BOOL *prevent_default)
static HRESULT HTMLAnchorElement_handle_event(HTMLDOMNode *iface, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
{
HTMLAnchorElement *This = impl_from_HTMLDOMNode(iface);
if(eid == EVENTID_CLICK) {
nsIDOMMouseEvent *mouse_event;
PRUint16 button;
nsresult nsres;
TRACE("CLICK\n");
*prevent_default = TRUE;
return navigate_anchor(This);
nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMMouseEvent, (void**)&mouse_event);
assert(nsres == NS_OK);
nsres = nsIDOMMouseEvent_GetButton(mouse_event, &button);
assert(nsres == NS_OK);
nsIDOMMouseEvent_Release(mouse_event);
switch(button) {
case 0:
*prevent_default = TRUE;
return navigate_anchor(This);
default:
*prevent_default = FALSE;
return S_OK;
}
}
return S_OK;

View file

@ -1065,7 +1065,7 @@ void fire_event(HTMLDocumentNode *doc, eventid_t eid, BOOL set_event, nsIDOMNode
break;
if(node && node->vtbl->handle_event) {
hres = node->vtbl->handle_event(node, eid, &prevent_default);
hres = node->vtbl->handle_event(node, eid, nsevent, &prevent_default);
if(FAILED(hres) || prevent_default)
break;
}

View file

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