From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmlobject.c | 35 +++-------------------------------- dlls/mshtml/pluginhost.c | 28 +++++++++++++++++++++++++--- dlls/mshtml/pluginhost.h | 7 +++++-- 3 files changed, 33 insertions(+), 37 deletions(-)
diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index 7c9892ce999..8d47dc9306d 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -653,25 +653,6 @@ static void HTMLObjectElement_unlink(DispatchEx *dispex) unlink_ref(&This->nsobject); }
-static void HTMLObjectElement_destructor(DispatchEx *dispex) -{ - HTMLObjectElement *This = impl_from_DispatchEx(dispex); - - if(This->plugin_container.plugin_host) - detach_plugin_host(This->plugin_container.plugin_host); - - HTMLElement_destructor(&This->plugin_container.element.node.event_target.dispex); -} - -static HRESULT HTMLObjectElement_get_dispid(DispatchEx *dispex, const WCHAR *name, DWORD grfdex, DISPID *dispid) -{ - HTMLObjectElement *This = impl_from_DispatchEx(dispex); - - TRACE("(%p)->(%s %lx %p)\n", This, debugstr_w(name), grfdex, dispid); - - return get_plugin_dispid(&This->plugin_container, name, dispid); -} - static HRESULT HTMLObjectElement_dispex_get_name(DispatchEx *dispex, DISPID id, BSTR *name) { HTMLObjectElement *This = impl_from_DispatchEx(dispex); @@ -681,16 +662,6 @@ static HRESULT HTMLObjectElement_dispex_get_name(DispatchEx *dispex, DISPID id, return E_NOTIMPL; }
-static HRESULT HTMLObjectElement_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) -{ - HTMLObjectElement *This = impl_from_DispatchEx(dispex); - - TRACE("(%p)->(%ld)\n", This, id); - - return invoke_plugin_prop(&This->plugin_container, id, lcid, flags, params, res, ei); -} - static const NodeImplVtbl HTMLObjectElementImplVtbl = { .clsid = &CLSID_HTMLObjectElement, .cpc_entries = HTMLElement_cpc, @@ -703,12 +674,12 @@ static const event_target_vtbl_t HTMLObjectElement_event_target_vtbl = { { HTMLELEMENT_DISPEX_VTBL_ENTRIES, .query_interface= HTMLObjectElement_query_interface, - .destructor = HTMLObjectElement_destructor, + .destructor = HTMLPluginContainer_destructor, .traverse = HTMLObjectElement_traverse, .unlink = HTMLObjectElement_unlink, - .get_dispid = HTMLObjectElement_get_dispid, + .get_dispid = HTMLPluginContainer_get_dispid, .get_name = HTMLObjectElement_dispex_get_name, - .invoke = HTMLObjectElement_invoke + .invoke = HTMLPluginContainer_invoke }, HTMLELEMENT_EVENT_TARGET_VTBL_ENTRIES, .handle_event = HTMLElement_handle_event diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index ce184315127..49e3c66a3e1 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -704,13 +704,32 @@ HRESULT get_plugin_disp(HTMLPluginContainer *plugin_container, IDispatch **ret) return S_OK; }
-HRESULT get_plugin_dispid(HTMLPluginContainer *plugin_container, const WCHAR *name, DISPID *ret) +static inline HTMLPluginContainer *impl_from_DispatchEx(DispatchEx *iface) { + return CONTAINING_RECORD(iface, HTMLPluginContainer, element.node.event_target.dispex); +} + +void HTMLPluginContainer_destructor(DispatchEx *dispex) +{ + HTMLPluginContainer *This = impl_from_DispatchEx(dispex); + + if(This->plugin_host) + detach_plugin_host(This->plugin_host); + free(This->props); + + HTMLElement_destructor(&This->element.node.event_target.dispex); +} + +HRESULT HTMLPluginContainer_get_dispid(DispatchEx *dispex, const WCHAR *name, DWORD grfdex, DISPID *ret) +{ + HTMLPluginContainer *plugin_container = impl_from_DispatchEx(dispex); IDispatch *disp; DISPID id; DWORD i; HRESULT hres;
+ TRACE("(%p)->(%s %lx %p)\n", plugin_container, debugstr_w(name), grfdex, ret); + if(!plugin_container->plugin_host) { WARN("no plugin host\n"); return DISP_E_UNKNOWNNAME; @@ -755,11 +774,14 @@ HRESULT get_plugin_dispid(HTMLPluginContainer *plugin_container, const WCHAR *na return S_OK; }
-HRESULT invoke_plugin_prop(HTMLPluginContainer *plugin_container, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei) +HRESULT HTMLPluginContainer_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { + HTMLPluginContainer *plugin_container = impl_from_DispatchEx(dispex); PluginHost *host;
+ TRACE("(%p)->(%ld)\n", plugin_container, id); + host = plugin_container->plugin_host; if(!host || !host->disp) { FIXME("Called with no disp\n"); diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h index bdef901bc80..f76aa5b10ca 100644 --- a/dlls/mshtml/pluginhost.h +++ b/dlls/mshtml/pluginhost.h @@ -67,7 +67,10 @@ void update_plugin_window(PluginHost*,HWND,const RECT*); void detach_plugin_host(PluginHost*);
HRESULT get_plugin_disp(HTMLPluginContainer*,IDispatch**); -HRESULT get_plugin_dispid(HTMLPluginContainer*,const WCHAR*,DISPID*); -HRESULT invoke_plugin_prop(HTMLPluginContainer*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*); void notif_container_change(HTMLPluginContainer*,DISPID); void bind_activex_event(HTMLDocumentNode*,HTMLPluginContainer*,WCHAR*,IDispatch*); + +void HTMLPluginContainer_destructor(DispatchEx *dispex); +HRESULT HTMLPluginContainer_get_dispid(DispatchEx *dispex, const WCHAR *name, DWORD grfdex, DISPID *dispid); +HRESULT HTMLPluginContainer_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params, + VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller);