Jacek Caban : mshtml: Added support for exposing different sets of properties from DispatchEx depending on compatibility mode.

Alexandre Julliard julliard at winehq.org
Thu Jul 7 09:48:23 CDT 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jul  7 12:49:45 2016 +0200

mshtml: Added support for exposing different sets of properties from DispatchEx depending on compatibility mode.

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

---

 dlls/mshtml/dispex.c         | 16 +++++++++-------
 dlls/mshtml/htmlwindow.c     |  2 +-
 dlls/mshtml/mshtml_private.h | 11 ++++++++---
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index 791f361..d934f56 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -362,7 +362,7 @@ static int func_name_cmp(const void *p1, const void *p2)
     return strcmpiW((*(func_info_t* const*)p1)->name, (*(func_info_t* const*)p2)->name);
 }
 
-static dispex_data_t *preprocess_dispex_data(const dispex_static_data_t *desc)
+static dispex_data_t *preprocess_dispex_data(const dispex_static_data_t *desc, compat_mode_t compat_mode)
 {
     const tid_t *tid;
     dispex_data_t *data;
@@ -396,7 +396,7 @@ static dispex_data_t *preprocess_dispex_data(const dispex_static_data_t *desc)
     list_add_tail(&dispex_data_list, &data->entry);
 
     if(desc->init_info)
-        desc->init_info(data);
+        desc->init_info(data, compat_mode);
 
     for(tid = desc->iface_tids; *tid; tid++) {
         hres = process_interface(data, *tid, dti);
@@ -1745,17 +1745,19 @@ void release_dispex(DispatchEx *This)
     heap_free(This->dynamic_data);
 }
 
-void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
+void init_dispex_with_compat_mode(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data, compat_mode_t compat_mode)
 {
-    if(!data->data) {
+    assert(compat_mode < COMPAT_MODE_CNT);
+
+    if(!data->info_cache[compat_mode]) {
         EnterCriticalSection(&cs_dispex_static_data);
-        if(!data->data)
-            data->data = preprocess_dispex_data(data);
+        if(!data->info_cache[compat_mode])
+            data->info_cache[compat_mode] = preprocess_dispex_data(data, compat_mode);
         LeaveCriticalSection(&cs_dispex_static_data);
     }
 
     dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
     dispex->outer = outer;
-    dispex->info = data->data;
+    dispex->info = data->info_cache[compat_mode];
     dispex->dynamic_data = NULL;
 }
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 54cd078..2b79226 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -2936,7 +2936,7 @@ static void HTMLWindow_bind_event(DispatchEx *dispex, int eid)
     dispex_get_vtbl(&This->doc->node.event_target.dispex)->bind_event(&This->doc->node.event_target.dispex, eid);
 }
 
-static void HTMLWindow_init_dispex_info(dispex_data_t *info)
+static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
 {
     dispex_info_add_interface(info, IHTMLWindow5_tid);
 }
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 412db24..d34f9cb 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -265,8 +265,8 @@ typedef struct {
     const dispex_static_data_vtbl_t *vtbl;
     const tid_t disp_tid;
     const tid_t* const iface_tids;
-    void (*init_info)(dispex_data_t*);
-    dispex_data_t *data;
+    void (*init_info)(dispex_data_t*,compat_mode_t);
+    dispex_data_t *info_cache[COMPAT_MODE_CNT];
 } dispex_static_data_t;
 
 struct DispatchEx {
@@ -305,7 +305,7 @@ void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback
 void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
 void (__cdecl *note_cc_edge)(nsISupports*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
 
-void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
+void init_dispex_with_compat_mode(DispatchEx*,IUnknown*,dispex_static_data_t*,compat_mode_t) DECLSPEC_HIDDEN;
 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
 HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_HIDDEN;
@@ -319,6 +319,11 @@ HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
 const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN;
 void dispex_info_add_interface(dispex_data_t*,tid_t) DECLSPEC_HIDDEN;
 
+static inline void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *desc)
+{
+    init_dispex_with_compat_mode(dispex, outer, desc, COMPAT_MODE_NONE);
+}
+
 typedef enum {
     DISPEXPROP_CUSTOM,
     DISPEXPROP_DYNAMIC,




More information about the wine-cvs mailing list