Jacek Caban : mshtml: Added IHTMLSelectionObject2 stub implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 23 10:03:18 CDT 2015


Module: wine
Branch: master
Commit: 937405664417a682c7ebdffceecd48cbc767b8bb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=937405664417a682c7ebdffceecd48cbc767b8bb

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar 20 16:00:17 2015 +0100

mshtml: Added IHTMLSelectionObject2 stub implementation.

---

 dlls/mshtml/mshtml_private.h |  1 +
 dlls/mshtml/selection.c      | 93 +++++++++++++++++++++++++++++++++++++++++++-
 dlls/mshtml/tests/dom.c      | 10 +++++
 3 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 2156d90..6d39a72 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -177,6 +177,7 @@ typedef struct event_target_t event_target_t;
     XIID(IHTMLScriptElement) \
     XIID(IHTMLSelectElement) \
     XIID(IHTMLSelectionObject) \
+    XIID(IHTMLSelectionObject2) \
     XIID(IHTMLStorage) \
     XIID(IHTMLStyle) \
     XIID(IHTMLStyle2) \
diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c
index f34154b..cfa5910 100644
--- a/dlls/mshtml/selection.c
+++ b/dlls/mshtml/selection.c
@@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 typedef struct {
     DispatchEx dispex;
     IHTMLSelectionObject IHTMLSelectionObject_iface;
+    IHTMLSelectionObject2 IHTMLSelectionObject2_iface;
 
     LONG ref;
 
@@ -61,6 +62,8 @@ static HRESULT WINAPI HTMLSelectionObject_QueryInterface(IHTMLSelectionObject *i
         *ppv = &This->IHTMLSelectionObject_iface;
     }else if(IsEqualGUID(&IID_IHTMLSelectionObject, riid)) {
         *ppv = &This->IHTMLSelectionObject_iface;
+    }else if(IsEqualGUID(&IID_IHTMLSelectionObject2, riid)) {
+        *ppv = &This->IHTMLSelectionObject2_iface;
     }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
         return *ppv ? S_OK : E_NOINTERFACE;
     }else {
@@ -234,13 +237,100 @@ static const IHTMLSelectionObjectVtbl HTMLSelectionObjectVtbl = {
     HTMLSelectionObject_get_type
 };
 
+static inline HTMLSelectionObject *impl_from_IHTMLSelectionObject2(IHTMLSelectionObject2 *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLSelectionObject, IHTMLSelectionObject2_iface);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_QueryInterface(IHTMLSelectionObject2 *iface, REFIID riid, void **ppv)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IHTMLSelectionObject_QueryInterface(&This->IHTMLSelectionObject_iface, riid, ppv);
+}
+
+static ULONG WINAPI HTMLSelectionObject2_AddRef(IHTMLSelectionObject2 *iface)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IHTMLSelectionObject_AddRef(&This->IHTMLSelectionObject_iface);
+}
+
+static ULONG WINAPI HTMLSelectionObject2_Release(IHTMLSelectionObject2 *iface)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IHTMLSelectionObject_Release(&This->IHTMLSelectionObject_iface);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_GetTypeInfoCount(IHTMLSelectionObject2 *iface, UINT *pctinfo)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_GetTypeInfo(IHTMLSelectionObject2 *iface, UINT iTInfo,
+        LCID lcid, ITypeInfo **ppTInfo)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_GetIDsOfNames(IHTMLSelectionObject2 *iface, REFIID riid,
+        LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
+            cNames, lcid, rgDispId);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_Invoke(IHTMLSelectionObject2 *iface, DISPID dispIdMember,
+        REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
+        EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+
+    return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid,
+            lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_createRangeCollection(IHTMLSelectionObject2 *iface, IDispatch **rangeCollection)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+    FIXME("(%p)->(%p)\n", This, rangeCollection);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLSelectionObject2_get_typeDetail(IHTMLSelectionObject2 *iface, BSTR *p)
+{
+    HTMLSelectionObject *This = impl_from_IHTMLSelectionObject2(iface);
+    FIXME("(%p)->(%p)\n", This, p);
+    return E_NOTIMPL;
+}
+
+static const IHTMLSelectionObject2Vtbl HTMLSelectionObject2Vtbl = {
+    HTMLSelectionObject2_QueryInterface,
+    HTMLSelectionObject2_AddRef,
+    HTMLSelectionObject2_Release,
+    HTMLSelectionObject2_GetTypeInfoCount,
+    HTMLSelectionObject2_GetTypeInfo,
+    HTMLSelectionObject2_GetIDsOfNames,
+    HTMLSelectionObject2_Invoke,
+    HTMLSelectionObject2_createRangeCollection,
+    HTMLSelectionObject2_get_typeDetail
+};
+
 static const tid_t HTMLSelectionObject_iface_tids[] = {
     IHTMLSelectionObject_tid,
+    IHTMLSelectionObject2_tid,
     0
 };
 static dispex_static_data_t HTMLSelectionObject_dispex = {
     NULL,
-    IHTMLSelectionObject_tid,
+    IHTMLSelectionObject_tid, /* FIXME: We have a test for that, but it doesn't expose IHTMLSelectionObject2 iface. */
     NULL,
     HTMLSelectionObject_iface_tids
 };
@@ -256,6 +346,7 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect
     init_dispex(&selection->dispex, (IUnknown*)&selection->IHTMLSelectionObject_iface, &HTMLSelectionObject_dispex);
 
     selection->IHTMLSelectionObject_iface.lpVtbl = &HTMLSelectionObjectVtbl;
+    selection->IHTMLSelectionObject2_iface.lpVtbl = &HTMLSelectionObject2Vtbl;
     selection->ref = 1;
     selection->nsselection = nsselection; /* We shouldn't call AddRef here */
 
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index bcb97b9..29356d7 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -430,6 +430,15 @@ static const IID * const img_factory_iids[] = {
     NULL
 };
 
+static const IID * const selection_iids[] = {
+    &IID_IUnknown,
+    &IID_IDispatch,
+    &IID_IDispatchEx,
+    &IID_IHTMLSelectionObject,
+    &IID_IHTMLSelectionObject2,
+    NULL
+};
+
 typedef struct {
     const char *tag;
     REFIID *iids;
@@ -5151,6 +5160,7 @@ static void test_txtrange(IHTMLDocument2 *doc)
     ok(hres == S_OK, "IHTMLDocument2_get_selection failed: %08x\n", hres);
 
     test_disp((IUnknown*)selection, &IID_IHTMLSelectionObject, "[object]");
+    test_ifaces((IUnknown*)selection, selection_iids);
 
     hres = IHTMLSelectionObject_createRange(selection, &disp_range);
     ok(hres == S_OK, "IHTMLSelectionObject_createRange failed: %08x\n", hres);




More information about the wine-cvs mailing list