Commit 28e2f7a8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IDOMUIEvent stub implementation.

parent 2e8dfbb1
...@@ -861,6 +861,8 @@ static HRESULT WINAPI DOMEvent_QueryInterface(IDOMEvent *iface, REFIID riid, voi ...@@ -861,6 +861,8 @@ static HRESULT WINAPI DOMEvent_QueryInterface(IDOMEvent *iface, REFIID riid, voi
*ppv = &This->IDOMEvent_iface; *ppv = &This->IDOMEvent_iface;
else if(IsEqualGUID(&IID_IDOMEvent, riid)) else if(IsEqualGUID(&IID_IDOMEvent, riid))
*ppv = &This->IDOMEvent_iface; *ppv = &This->IDOMEvent_iface;
else if(This->ui_event && IsEqualGUID(&IID_IDOMUIEvent, riid))
*ppv = &This->IDOMUIEvent_iface;
else if(This->mouse_event && IsEqualGUID(&IID_IDOMMouseEvent, riid)) else if(This->mouse_event && IsEqualGUID(&IID_IDOMMouseEvent, riid))
*ppv = &This->IDOMMouseEvent_iface; *ppv = &This->IDOMMouseEvent_iface;
else if(dispex_query_interface(&This->dispex, riid, ppv)) else if(dispex_query_interface(&This->dispex, riid, ppv))
...@@ -893,6 +895,10 @@ static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface) ...@@ -893,6 +895,10 @@ static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface)
TRACE("(%p) ref=%u\n", This, ref); TRACE("(%p) ref=%u\n", This, ref);
if(!ref) { if(!ref) {
if(This->ui_event)
nsIDOMUIEvent_Release(This->ui_event);
if(This->mouse_event)
nsIDOMMouseEvent_Release(This->mouse_event);
if(This->target) if(This->target)
IDispatchEx_Release(&This->target->dispex.IDispatchEx_iface); IDispatchEx_Release(&This->target->dispex.IDispatchEx_iface);
nsIDOMEvent_Release(This->nsevent); nsIDOMEvent_Release(This->nsevent);
...@@ -1152,6 +1158,94 @@ static const IDOMEventVtbl DOMEventVtbl = { ...@@ -1152,6 +1158,94 @@ static const IDOMEventVtbl DOMEventVtbl = {
DOMEvent_get_srcElement DOMEvent_get_srcElement
}; };
static inline DOMEvent *impl_from_IDOMUIEvent(IDOMUIEvent *iface)
{
return CONTAINING_RECORD(iface, DOMEvent, IDOMUIEvent_iface);
}
static HRESULT WINAPI DOMUIEvent_QueryInterface(IDOMUIEvent *iface, REFIID riid, void **ppv)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDOMEvent_QueryInterface(&This->IDOMEvent_iface, riid, ppv);
}
static ULONG WINAPI DOMUIEvent_AddRef(IDOMUIEvent *iface)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDOMEvent_AddRef(&This->IDOMEvent_iface);
}
static ULONG WINAPI DOMUIEvent_Release(IDOMUIEvent *iface)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDOMEvent_Release(&This->IDOMEvent_iface);
}
static HRESULT WINAPI DOMUIEvent_GetTypeInfoCount(IDOMUIEvent *iface, UINT *pctinfo)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
}
static HRESULT WINAPI DOMUIEvent_GetTypeInfo(IDOMUIEvent *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI DOMUIEvent_GetIDsOfNames(IDOMUIEvent *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
lcid, rgDispId);
}
static HRESULT WINAPI DOMUIEvent_Invoke(IDOMUIEvent *iface, DISPID dispIdMember,
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI DOMUIEvent_get_view(IDOMUIEvent *iface, IHTMLWindow2 **p)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI DOMUIEvent_get_detail(IDOMUIEvent *iface, LONG *p)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI DOMUIEvent_initUIEvent(IDOMUIEvent *iface, BSTR type, VARIANT_BOOL can_bubble,
VARIANT_BOOL cancelable, IHTMLWindow2 *view, LONG detail)
{
DOMEvent *This = impl_from_IDOMUIEvent(iface);
FIXME("(%p)->(%s %x %x %p %x)\n", This, debugstr_w(type), can_bubble, cancelable, view, detail);
return E_NOTIMPL;
}
static const IDOMUIEventVtbl DOMUIEventVtbl = {
DOMUIEvent_QueryInterface,
DOMUIEvent_AddRef,
DOMUIEvent_Release,
DOMUIEvent_GetTypeInfoCount,
DOMUIEvent_GetTypeInfo,
DOMUIEvent_GetIDsOfNames,
DOMUIEvent_Invoke,
DOMUIEvent_get_view,
DOMUIEvent_get_detail,
DOMUIEvent_initUIEvent
};
static inline DOMEvent *impl_from_IDOMMouseEvent(IDOMMouseEvent *iface) static inline DOMEvent *impl_from_IDOMMouseEvent(IDOMMouseEvent *iface)
{ {
return CONTAINING_RECORD(iface, DOMEvent, IDOMMouseEvent_iface); return CONTAINING_RECORD(iface, DOMEvent, IDOMMouseEvent_iface);
...@@ -1558,6 +1652,7 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id) ...@@ -1558,6 +1652,7 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
return NULL; return NULL;
event->IDOMEvent_iface.lpVtbl = &DOMEventVtbl; event->IDOMEvent_iface.lpVtbl = &DOMEventVtbl;
event->IDOMUIEvent_iface.lpVtbl = &DOMUIEventVtbl;
event->IDOMMouseEvent_iface.lpVtbl = &DOMMouseEventVtbl; event->IDOMMouseEvent_iface.lpVtbl = &DOMMouseEventVtbl;
event->ref = 1; event->ref = 1;
event->event_id = event_id; event->event_id = event_id;
...@@ -1576,6 +1671,10 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id) ...@@ -1576,6 +1671,10 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
event->time_stamp = (((ULONGLONG)time.dwHighDateTime<<32) + time.dwLowDateTime) / 10000 event->time_stamp = (((ULONGLONG)time.dwHighDateTime<<32) + time.dwLowDateTime) / 10000
- time_epoch; - time_epoch;
nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMUIEvent, (void**)&event->ui_event);
if(NS_FAILED(nsres))
event->ui_event = NULL;
nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMMouseEvent, (void**)&event->mouse_event); nsres = nsIDOMEvent_QueryInterface(nsevent, &IID_nsIDOMMouseEvent, (void**)&event->mouse_event);
if(NS_SUCCEEDED(nsres)) if(NS_SUCCEEDED(nsres))
dispex_data = &DOMMouseEvent_dispex; dispex_data = &DOMMouseEvent_dispex;
......
...@@ -59,11 +59,13 @@ typedef enum { ...@@ -59,11 +59,13 @@ typedef enum {
typedef struct { typedef struct {
DispatchEx dispex; DispatchEx dispex;
IDOMEvent IDOMEvent_iface; IDOMEvent IDOMEvent_iface;
IDOMUIEvent IDOMUIEvent_iface;
IDOMMouseEvent IDOMMouseEvent_iface; IDOMMouseEvent IDOMMouseEvent_iface;
LONG ref; LONG ref;
nsIDOMEvent *nsevent; nsIDOMEvent *nsevent;
nsIDOMUIEvent *ui_event;
nsIDOMMouseEvent *mouse_event; nsIDOMMouseEvent *mouse_event;
eventid_t event_id; eventid_t event_id;
......
...@@ -2669,6 +2669,7 @@ static void test_create_event(IHTMLDocument2 *doc) ...@@ -2669,6 +2669,7 @@ static void test_create_event(IHTMLDocument2 *doc)
IDOMMouseEvent *mouse_event; IDOMMouseEvent *mouse_event;
IDocumentEvent *doc_event; IDocumentEvent *doc_event;
IEventTarget *event_target; IEventTarget *event_target;
IDOMUIEvent *ui_event;
IHTMLElement *elem; IHTMLElement *elem;
IDOMEvent *event; IDOMEvent *event;
VARIANT_BOOL b; VARIANT_BOOL b;
...@@ -2721,6 +2722,8 @@ static void test_create_event(IHTMLDocument2 *doc) ...@@ -2721,6 +2722,8 @@ static void test_create_event(IHTMLDocument2 *doc)
IEventTarget_Release(event_target); IEventTarget_Release(event_target);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event); hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres); ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
...@@ -2731,12 +2734,28 @@ static void test_create_event(IHTMLDocument2 *doc) ...@@ -2731,12 +2734,28 @@ static void test_create_event(IHTMLDocument2 *doc)
SysFreeString(str); SysFreeString(str);
ok(hres == S_OK, "createEvent failed: %08x\n", hres); ok(hres == S_OK, "createEvent failed: %08x\n", hres);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
ok(hres == S_OK, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
IDOMUIEvent_Release(ui_event);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event); hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
ok(hres == S_OK, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres); ok(hres == S_OK, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
IDOMMouseEvent_Release(mouse_event); IDOMMouseEvent_Release(mouse_event);
IDOMEvent_Release(event); IDOMEvent_Release(event);
str = a2bstr("UIEvent");
hres = IDocumentEvent_createEvent(doc_event, str, &event);
SysFreeString(str);
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
ok(hres == S_OK, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
IDOMUIEvent_Release(ui_event);
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
IDOMEvent_Release(event);
IDocumentEvent_Release(doc_event); IDocumentEvent_Release(doc_event);
} }
......
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