Jacek Caban : mshtml: Add IHTMLPerformance:: navigation property implementation.

Alexandre Julliard julliard at winehq.org
Wed Jul 11 15:53:51 CDT 2018


Module: wine
Branch: master
Commit: dcfdcfea696bbafcb21c5d23f3758368b8e22366
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=dcfdcfea696bbafcb21c5d23f3758368b8e22366

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 11 21:37:48 2018 +0200

mshtml: Add IHTMLPerformance::navigation property implementation.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/mshtml_private.h |   1 +
 dlls/mshtml/omnavigator.c    | 176 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 175 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index e28ecbc..6ef1397 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -200,6 +200,7 @@ typedef struct EventTarget EventTarget;
     XIID(IHTMLOptionElement) \
     XIID(IHTMLOptionElementFactory) \
     XIID(IHTMLPerformance) \
+    XIID(IHTMLPerformanceNavigation) \
     XIID(IHTMLPluginsCollection) \
     XIID(IHTMLRect) \
     XIID(IHTMLScreen) \
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c
index faf15f0..a6a3e11 100644
--- a/dlls/mshtml/omnavigator.c
+++ b/dlls/mshtml/omnavigator.c
@@ -1323,8 +1323,160 @@ IOmNavigator *OmNavigator_Create(void)
 
 typedef struct {
     DispatchEx dispex;
+    IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
+
+    LONG ref;
+} HTMLPerformanceNavigation;
+
+static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLPerformanceNavigation, IHTMLPerformanceNavigation_iface);
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_QueryInterface(IHTMLPerformanceNavigation *iface, REFIID riid, void **ppv)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+
+    TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        *ppv = &This->IHTMLPerformanceNavigation_iface;
+    }else if(IsEqualGUID(&IID_IHTMLPerformanceNavigation, riid)) {
+        *ppv = &This->IHTMLPerformanceNavigation_iface;
+    }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
+        return *ppv ? S_OK : E_NOINTERFACE;
+    }else {
+        WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation *iface)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    LONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation *iface)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    LONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p) ref=%d\n", This, ref);
+
+    if(!ref) {
+        release_dispex(&This->dispex);
+        heap_free(This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfoCount(IHTMLPerformanceNavigation *iface, UINT *pctinfo)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    FIXME("(%p)->(%p)\n", This, pctinfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfo(IHTMLPerformanceNavigation *iface, UINT iTInfo,
+                                              LCID lcid, ITypeInfo **ppTInfo)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+
+    return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_GetIDsOfNames(IHTMLPerformanceNavigation *iface, REFIID riid,
+                                                          LPOLESTR *rgszNames, UINT cNames,
+                                                          LCID lcid, DISPID *rgDispId)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+
+    return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
+            lcid, rgDispId);
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_Invoke(IHTMLPerformanceNavigation *iface, DISPID dispIdMember,
+                            REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+                            VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+
+    return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
+            pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigation *iface, ULONG *p)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+
+    FIXME("(%p)->(%p) returning TYPE_NAVIGATE\n", This, p);
+
+    *p = 0; /* TYPE_NAVIGATE */
+    return S_OK;
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation *iface, ULONG *p)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    FIXME("(%p)->(%p)\n", This, p);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation *iface, BSTR *string)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    FIXME("(%p)->(%p)\n", This, string);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI HTMLPerformanceNavigation_toJSON(IHTMLPerformanceNavigation *iface, VARIANT *p)
+{
+    HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
+    FIXME("(%p)->(%p)\n", This, p);
+    return E_NOTIMPL;
+}
+
+static const IHTMLPerformanceNavigationVtbl HTMLPerformanceNavigationVtbl = {
+    HTMLPerformanceNavigation_QueryInterface,
+    HTMLPerformanceNavigation_AddRef,
+    HTMLPerformanceNavigation_Release,
+    HTMLPerformanceNavigation_GetTypeInfoCount,
+    HTMLPerformanceNavigation_GetTypeInfo,
+    HTMLPerformanceNavigation_GetIDsOfNames,
+    HTMLPerformanceNavigation_Invoke,
+    HTMLPerformanceNavigation_get_type,
+    HTMLPerformanceNavigation_get_redirectCount,
+    HTMLPerformanceNavigation_toString,
+    HTMLPerformanceNavigation_toJSON
+};
+
+static const tid_t HTMLPerformanceNavigation_iface_tids[] = {
+    IHTMLPerformanceNavigation_tid,
+    0
+};
+static dispex_static_data_t HTMLPerformanceNavigation_dispex = {
+    NULL,
+    IHTMLPerformanceNavigation_tid,
+    HTMLPerformanceNavigation_iface_tids
+};
+
+typedef struct {
+    DispatchEx dispex;
     IHTMLPerformance IHTMLPerformance_iface;
+
     LONG ref;
+
+    IHTMLPerformanceNavigation *navigation;
 } HTMLPerformance;
 
 static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface)
@@ -1372,6 +1524,8 @@ static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
+        if(This->navigation)
+            IHTMLPerformanceNavigation_Release(This->navigation);
         release_dispex(&This->dispex);
         heap_free(This);
     }
@@ -1418,8 +1572,26 @@ static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
                                                      IHTMLPerformanceNavigation **p)
 {
     HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->navigation) {
+        HTMLPerformanceNavigation *navigation;
+
+        navigation = heap_alloc_zero(sizeof(*navigation));
+        if(!navigation)
+            return E_OUTOFMEMORY;
+
+        navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl;
+        navigation->ref = 1;
+        init_dispex(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface,
+                    &HTMLPerformanceNavigation_dispex);
+
+        This->navigation = &navigation->IHTMLPerformanceNavigation_iface;
+    }
+
+    IHTMLPerformanceNavigation_AddRef(*p = This->navigation);
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLPerformanceTiming **p)




More information about the wine-cvs mailing list