mshtml: Initialize DOMEvent object with compat mode.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-11 20:40:19 +01:00 committed by Alexandre Julliard
parent 78be56291a
commit c833238a21
5 changed files with 11 additions and 11 deletions

View file

@ -2201,7 +2201,7 @@ static BOOL check_event_iface(nsIDOMEvent *event, REFIID riid)
return TRUE;
}
static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
static DOMEvent *alloc_event(nsIDOMEvent *nsevent, compat_mode_t compat_mode, eventid_t event_id)
{
dispex_static_data_t *dispex_data = &DOMEvent_dispex;
DOMEvent *event = NULL;
@ -2266,11 +2266,11 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
else
event->keyboard_event = NULL;
init_dispex(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data);
init_dispex_with_compat_mode(&event->dispex, (IUnknown*)&event->IDOMEvent_iface, dispex_data, compat_mode);
return event;
}
HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, DOMEvent **ret_event)
HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, compat_mode_t compat_mode, DOMEvent **ret_event)
{
eventid_t event_id = EVENTID_LAST;
DOMEvent *event;
@ -2290,7 +2290,7 @@ HRESULT create_event_from_nsevent(nsIDOMEvent *nsevent, DOMEvent **ret_event)
}
nsAString_Finish(&nsstr);
event = alloc_event(nsevent, event_id);
event = alloc_event(nsevent, compat_mode, event_id);
if(!event)
return E_OUTOFMEMORY;
@ -2313,7 +2313,7 @@ HRESULT create_document_event_str(HTMLDocumentNode *doc, const WCHAR *type, IDOM
return E_FAIL;
}
event = alloc_event(nsevent, EVENTID_LAST);
event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), EVENTID_LAST);
nsIDOMEvent_Release(nsevent);
if(!event)
return E_OUTOFMEMORY;
@ -2337,7 +2337,7 @@ HRESULT create_document_event(HTMLDocumentNode *doc, eventid_t event_id, DOMEven
return E_FAIL;
}
event = alloc_event(nsevent, event_id);
event = alloc_event(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), event_id);
if(!event)
return E_OUTOFMEMORY;

View file

@ -110,7 +110,7 @@ void dispatch_event(EventTarget*,DOMEvent*) DECLSPEC_HIDDEN;
HRESULT create_document_event(HTMLDocumentNode*,eventid_t,DOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_document_event_str(HTMLDocumentNode*,const WCHAR*,IDOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_event_from_nsevent(nsIDOMEvent*,DOMEvent**) DECLSPEC_HIDDEN;
HRESULT create_event_from_nsevent(nsIDOMEvent*,compat_mode_t,DOMEvent**) DECLSPEC_HIDDEN;
void init_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;
void release_nsevents(HTMLDocumentNode*) DECLSPEC_HIDDEN;

View file

@ -1659,7 +1659,7 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
if(FAILED(hres))
return NS_ERROR_FAILURE;
hres = create_event_from_nsevent(aEvent, &event);
hres = create_event_from_nsevent(aEvent, dispex_compat_mode(&node->event_target.dispex), &event);
if(SUCCEEDED(hres)) {
dispatch_event(&node->event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);

View file

@ -270,7 +270,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
}
if(doc->window) {
hres = create_event_from_nsevent(event, &load_event);
hres = create_event_from_nsevent(event, dispex_compat_mode(&doc->node.event_target.dispex), &load_event);
if(SUCCEEDED(hres)) {
dispatch_event(&doc->window->event_target, load_event);
IDOMEvent_Release(&load_event->IDOMEvent_iface);
@ -319,7 +319,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
if(FAILED(hres))
return NS_OK;
hres = create_event_from_nsevent(nsevent, &event);
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&doc->node.event_target.dispex), &event);
if(FAILED(hres)) {
node_release(node);
return NS_OK;

View file

@ -205,7 +205,7 @@ static nsresult NSAPI XMLHttpReqEventListener_HandleEvent(nsIDOMEventListener *i
if(!This->xhr)
return NS_OK;
hres = create_event_from_nsevent(nsevent, &event);
hres = create_event_from_nsevent(nsevent, dispex_compat_mode(&This->xhr->event_target.dispex), &event);
if(SUCCEEDED(hres) ){
dispatch_event(&This->xhr->event_target, event);
IDOMEvent_Release(&event->IDOMEvent_iface);