Skip to content

Commit

Permalink
mshtml: Pass DOMEvent instead of nsIDOMEvent during handle_event.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan McGrath authored and julliard committed Feb 29, 2024
1 parent 6cbe072 commit 277acf6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions dlls/mshtml/htmlanchor.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,13 +829,13 @@ static void HTMLAnchorElement_unlink(DispatchEx *dispex)
unlink_ref(&This->nsanchor);
}

static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default)
{
HTMLAnchorElement *This = impl_from_DispatchEx(dispex);
nsAString href_str, target_str;
nsresult nsres;

if(eid == EVENTID_CLICK) {
if(event->event_id == EVENTID_CLICK) {
nsAString_Init(&href_str, NULL);
nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str);
if (NS_FAILED(nsres)) {
Expand All @@ -850,14 +850,14 @@ static HRESULT HTMLAnchorElement_handle_event(DispatchEx *dispex, eventid_t eid,
goto fallback;
}

return handle_link_click_event(&This->element, &href_str, &target_str, event, prevent_default);
return handle_link_click_event(&This->element, &href_str, &target_str, event->nsevent, prevent_default);

fallback:
nsAString_Finish(&href_str);
nsAString_Finish(&target_str);
}

return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default);
return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default);
}

static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
Expand Down
8 changes: 4 additions & 4 deletions dlls/mshtml/htmlarea.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,13 @@ static void HTMLAreaElement_unlink(DispatchEx *dispex)
unlink_ref(&This->nsarea);
}

static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default)
{
HTMLAreaElement *This = impl_from_DispatchEx(dispex);
nsAString href_str, target_str;
nsresult nsres;

if(eid == EVENTID_CLICK) {
if(event->event_id == EVENTID_CLICK) {
nsAString_Init(&href_str, NULL);
nsres = nsIDOMHTMLAreaElement_GetHref(This->nsarea, &href_str);
if (NS_FAILED(nsres)) {
Expand All @@ -460,14 +460,14 @@ static HRESULT HTMLAreaElement_handle_event(DispatchEx *dispex, eventid_t eid, n
goto fallback;
}

return handle_link_click_event(&This->element, &href_str, &target_str, event, prevent_default);
return handle_link_click_event(&This->element, &href_str, &target_str, event->nsevent, prevent_default);

fallback:
nsAString_Finish(&href_str);
nsAString_Finish(&target_str);
}

return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default);
return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default);
}

static const NodeImplVtbl HTMLAreaElementImplVtbl = {
Expand Down
6 changes: 3 additions & 3 deletions dlls/mshtml/htmlelem.c
Original file line number Diff line number Diff line change
Expand Up @@ -7001,16 +7001,16 @@ void HTMLElement_bind_event(DispatchEx *dispex, eventid_t eid)
ensure_doc_nsevent_handler(This->node.doc, This->node.nsnode, eid);
}

HRESULT HTMLElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
HRESULT HTMLElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default)
{
HTMLElement *This = impl_from_DispatchEx(dispex);

switch(eid) {
switch(event->event_id) {
case EVENTID_KEYDOWN: {
nsIDOMKeyEvent *key_event;
nsresult nsres;

nsres = nsIDOMEvent_QueryInterface(event, &IID_nsIDOMKeyEvent, (void**)&key_event);
nsres = nsIDOMEvent_QueryInterface(event->nsevent, &IID_nsIDOMKeyEvent, (void**)&key_event);
if(NS_SUCCEEDED(nsres)) {
UINT32 code = 0;

Expand Down
2 changes: 1 addition & 1 deletion dlls/mshtml/htmlevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -5133,7 +5133,7 @@ static HRESULT dispatch_event_object(EventTarget *event_target, DOMEvent *event,
vtbl = dispex_get_vtbl(&target_chain[i]->dispex);
if(!vtbl->handle_event)
continue;
hres = vtbl->handle_event(&target_chain[i]->dispex, event->event_id, event->nsevent, &prevent_default);
hres = vtbl->handle_event(&target_chain[i]->dispex, event, &prevent_default);
if(FAILED(hres) || event->stop_propagation)
break;
if(prevent_default)
Expand Down
4 changes: 2 additions & 2 deletions dlls/mshtml/htmlevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ typedef struct {
nsISupports *(*get_gecko_target)(DispatchEx*);
void (*bind_event)(DispatchEx*,eventid_t);
EventTarget *(*get_parent_event_target)(DispatchEx*);
HRESULT (*handle_event)(DispatchEx*,eventid_t,nsIDOMEvent*,BOOL*);
HRESULT (*handle_event)(DispatchEx*,DOMEvent*,BOOL*);
ConnectionPointContainer *(*get_cp_container)(DispatchEx*);
IHTMLEventObj *(*set_current_event)(DispatchEx*,IHTMLEventObj*);
} event_target_vtbl_t;
Expand All @@ -141,7 +141,7 @@ IHTMLEventObj *default_set_current_event(HTMLInnerWindow*,IHTMLEventObj*);
nsISupports *HTMLElement_get_gecko_target(DispatchEx*);
void HTMLElement_bind_event(DispatchEx*,eventid_t);
EventTarget *HTMLElement_get_parent_event_target(DispatchEx*);
HRESULT HTMLElement_handle_event(DispatchEx*,eventid_t,nsIDOMEvent*,BOOL*);
HRESULT HTMLElement_handle_event(DispatchEx*,DOMEvent*,BOOL*);
ConnectionPointContainer *HTMLElement_get_cp_container(DispatchEx*);
IHTMLEventObj *HTMLElement_set_current_event(DispatchEx*,IHTMLEventObj*);

Expand Down
6 changes: 3 additions & 3 deletions dlls/mshtml/htmlform.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,16 +944,16 @@ static HRESULT HTMLFormElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid,
return S_OK;
}

static HRESULT HTMLFormElement_handle_event(DispatchEx *dispex, eventid_t eid, nsIDOMEvent *event, BOOL *prevent_default)
static HRESULT HTMLFormElement_handle_event(DispatchEx *dispex, DOMEvent *event, BOOL *prevent_default)
{
HTMLFormElement *This = impl_from_DispatchEx(dispex);

if(eid == EVENTID_SUBMIT) {
if(event->event_id == EVENTID_SUBMIT) {
*prevent_default = TRUE;
return IHTMLFormElement_submit(&This->IHTMLFormElement_iface);
}

return HTMLElement_handle_event(&This->element.node.event_target.dispex, eid, event, prevent_default);
return HTMLElement_handle_event(&This->element.node.event_target.dispex, event, prevent_default);
}

static const NodeImplVtbl HTMLFormElementImplVtbl = {
Expand Down

0 comments on commit 277acf6

Please sign in to comment.