Commit 0b556458 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Follow anchors only on left button click.

parent 83693d96
......@@ -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;
......
......@@ -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;
}
......
......@@ -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**);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment