Commit 91e7a028 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added support for exposing different sets of properties from DispatchEx…

mshtml: Added support for exposing different sets of properties from DispatchEx depending on compatibility mode. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 9e4df5ef
...@@ -362,7 +362,7 @@ static int func_name_cmp(const void *p1, const void *p2) ...@@ -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); 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; const tid_t *tid;
dispex_data_t *data; dispex_data_t *data;
...@@ -396,7 +396,7 @@ static dispex_data_t *preprocess_dispex_data(const dispex_static_data_t *desc) ...@@ -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); list_add_tail(&dispex_data_list, &data->entry);
if(desc->init_info) if(desc->init_info)
desc->init_info(data); desc->init_info(data, compat_mode);
for(tid = desc->iface_tids; *tid; tid++) { for(tid = desc->iface_tids; *tid; tid++) {
hres = process_interface(data, *tid, dti); hres = process_interface(data, *tid, dti);
...@@ -1745,17 +1745,19 @@ void release_dispex(DispatchEx *This) ...@@ -1745,17 +1745,19 @@ void release_dispex(DispatchEx *This)
heap_free(This->dynamic_data); 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); EnterCriticalSection(&cs_dispex_static_data);
if(!data->data) if(!data->info_cache[compat_mode])
data->data = preprocess_dispex_data(data); data->info_cache[compat_mode] = preprocess_dispex_data(data, compat_mode);
LeaveCriticalSection(&cs_dispex_static_data); LeaveCriticalSection(&cs_dispex_static_data);
} }
dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl;
dispex->outer = outer; dispex->outer = outer;
dispex->info = data->data; dispex->info = data->info_cache[compat_mode];
dispex->dynamic_data = NULL; dispex->dynamic_data = NULL;
} }
...@@ -2936,7 +2936,7 @@ static void HTMLWindow_bind_event(DispatchEx *dispex, int eid) ...@@ -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); 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); dispex_info_add_interface(info, IHTMLWindow5_tid);
} }
......
...@@ -265,8 +265,8 @@ typedef struct { ...@@ -265,8 +265,8 @@ typedef struct {
const dispex_static_data_vtbl_t *vtbl; const dispex_static_data_vtbl_t *vtbl;
const tid_t disp_tid; const tid_t disp_tid;
const tid_t* const iface_tids; const tid_t* const iface_tids;
void (*init_info)(dispex_data_t*); void (*init_info)(dispex_data_t*,compat_mode_t);
dispex_data_t *data; dispex_data_t *info_cache[COMPAT_MODE_CNT];
} dispex_static_data_t; } dispex_static_data_t;
struct DispatchEx { struct DispatchEx {
...@@ -305,7 +305,7 @@ void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback ...@@ -305,7 +305,7 @@ void (__cdecl *ccp_init)(ExternalCycleCollectionParticipant*,const CCObjCallback
void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN; void (__cdecl *describe_cc_node)(nsCycleCollectingAutoRefCnt*,const char*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
void (__cdecl *note_cc_edge)(nsISupports*,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; void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN; BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) 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; ...@@ -319,6 +319,11 @@ HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
const dispex_static_data_vtbl_t *dispex_get_vtbl(DispatchEx*) 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; 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 { typedef enum {
DISPEXPROP_CUSTOM, DISPEXPROP_CUSTOM,
DISPEXPROP_DYNAMIC, DISPEXPROP_DYNAMIC,
......
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