Jacek Caban : mshtml: Added IDOMUIEvent stub implementation.
Alexandre Julliard
julliard at winehq.org
Tue Feb 6 15:55:48 CST 2018
Module: wine
Branch: master
Commit: 28e2f7a85ecd2f5a9ab418feda918fbc53aa9a11
URL: https://source.winehq.org/git/wine.git/?a=commit;h=28e2f7a85ecd2f5a9ab418feda918fbc53aa9a11
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Feb 6 00:08:46 2018 +0100
mshtml: Added IDOMUIEvent stub implementation.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mshtml/htmlevent.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++
dlls/mshtml/htmlevent.h | 2 +
dlls/mshtml/tests/events.c | 19 +++++++++
3 files changed, 120 insertions(+)
diff --git a/dlls/mshtml/htmlevent.c b/dlls/mshtml/htmlevent.c
index 633c1f9..6c51819 100644
--- a/dlls/mshtml/htmlevent.c
+++ b/dlls/mshtml/htmlevent.c
@@ -861,6 +861,8 @@ static HRESULT WINAPI DOMEvent_QueryInterface(IDOMEvent *iface, REFIID riid, voi
*ppv = &This->IDOMEvent_iface;
else if(IsEqualGUID(&IID_IDOMEvent, riid))
*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))
*ppv = &This->IDOMMouseEvent_iface;
else if(dispex_query_interface(&This->dispex, riid, ppv))
@@ -893,6 +895,10 @@ static ULONG WINAPI DOMEvent_Release(IDOMEvent *iface)
TRACE("(%p) ref=%u\n", This, ref);
if(!ref) {
+ if(This->ui_event)
+ nsIDOMUIEvent_Release(This->ui_event);
+ if(This->mouse_event)
+ nsIDOMMouseEvent_Release(This->mouse_event);
if(This->target)
IDispatchEx_Release(&This->target->dispex.IDispatchEx_iface);
nsIDOMEvent_Release(This->nsevent);
@@ -1152,6 +1158,94 @@ static const IDOMEventVtbl DOMEventVtbl = {
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)
{
return CONTAINING_RECORD(iface, DOMEvent, IDOMMouseEvent_iface);
@@ -1558,6 +1652,7 @@ static DOMEvent *alloc_event(nsIDOMEvent *nsevent, eventid_t event_id)
return NULL;
event->IDOMEvent_iface.lpVtbl = &DOMEventVtbl;
+ event->IDOMUIEvent_iface.lpVtbl = &DOMUIEventVtbl;
event->IDOMMouseEvent_iface.lpVtbl = &DOMMouseEventVtbl;
event->ref = 1;
event->event_id = 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
- 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);
if(NS_SUCCEEDED(nsres))
dispex_data = &DOMMouseEvent_dispex;
diff --git a/dlls/mshtml/htmlevent.h b/dlls/mshtml/htmlevent.h
index d1b8470..fde9cb9 100644
--- a/dlls/mshtml/htmlevent.h
+++ b/dlls/mshtml/htmlevent.h
@@ -59,11 +59,13 @@ typedef enum {
typedef struct {
DispatchEx dispex;
IDOMEvent IDOMEvent_iface;
+ IDOMUIEvent IDOMUIEvent_iface;
IDOMMouseEvent IDOMMouseEvent_iface;
LONG ref;
nsIDOMEvent *nsevent;
+ nsIDOMUIEvent *ui_event;
nsIDOMMouseEvent *mouse_event;
eventid_t event_id;
diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c
index ef9b102..d8dc8da 100644
--- a/dlls/mshtml/tests/events.c
+++ b/dlls/mshtml/tests/events.c
@@ -2669,6 +2669,7 @@ static void test_create_event(IHTMLDocument2 *doc)
IDOMMouseEvent *mouse_event;
IDocumentEvent *doc_event;
IEventTarget *event_target;
+ IDOMUIEvent *ui_event;
IHTMLElement *elem;
IDOMEvent *event;
VARIANT_BOOL b;
@@ -2721,6 +2722,8 @@ static void test_create_event(IHTMLDocument2 *doc)
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);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
@@ -2731,12 +2734,28 @@ static void test_create_event(IHTMLDocument2 *doc)
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 == S_OK, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
IDOMMouseEvent_Release(mouse_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);
}
More information about the wine-cvs
mailing list