Module: wine Branch: master Commit: 94b591cdf226693de946971d76d7273951966fd8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=94b591cdf226693de946971d76...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Dec 15 00:42:44 2010 +0100
mshtml: Added PluginHost::GetContainer implementation.
---
dlls/mshtml/pluginhost.c | 13 +++++++++++-- dlls/mshtml/tests/activex.c | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index 9ab0983..f037eca 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -364,8 +364,17 @@ static HRESULT WINAPI PHClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAss static HRESULT WINAPI PHClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer) { PluginHost *This = impl_from_IOleClientSite(iface); - FIXME("(%p)->(%p)\n", This, ppContainer); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, ppContainer); + + if(!This->doc) { + ERR("Called on detached object\n"); + return E_UNEXPECTED; + } + + *ppContainer = &This->doc->basedoc.IOleContainer_iface; + IOleContainer_AddRef(*ppContainer); + return S_OK; }
static HRESULT WINAPI PHClientSite_ShowObject(IOleClientSite *iface) diff --git a/dlls/mshtml/tests/activex.c b/dlls/mshtml/tests/activex.c index a89d7e7..1036577 100644 --- a/dlls/mshtml/tests/activex.c +++ b/dlls/mshtml/tests/activex.c @@ -1164,6 +1164,32 @@ static const IClassFactoryVtbl ClassFactoryVtbl = {
static IClassFactory activex_cf = { &ClassFactoryVtbl };
+static void test_container(IHTMLDocument2 *doc_obj) +{ + IHTMLWindow2 *parent_window; + IOleContainer *container; + IHTMLDocument2 *doc; + HRESULT hres; + + container = NULL; + hres = IOleClientSite_GetContainer(client_site, &container); + ok(hres == S_OK, "GetContainer failed: %08x\n", hres); + ok(container != NULL, "container == NULL\n"); + + hres = IHTMLDocument2_get_parentWindow(doc_obj, &parent_window); + ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres); + ok(parent_window != NULL, "parentWindow == NULL\n"); + + hres = IHTMLWindow2_get_document(parent_window, &doc); + ok(hres == S_OK, "get_document failed: %08x\n", hres); + ok(doc != NULL, "doc == NULL\n"); + ok(iface_cmp((IUnknown*)doc, (IUnknown*)container), "container != doc\n"); + IHTMLDocument2_Release(doc); + + IHTMLWindow2_Release(parent_window); + IOleContainer_Release(container); +} + static void test_ui_activate(void) { IOleInPlaceSite *ip_site; @@ -1779,6 +1805,7 @@ static void test_object_ax(void) CHECK_CALLED(SetObjectRects);
test_ui_activate(); + test_container(notif_doc);
SET_EXPECT(UIDeactivate); SET_EXPECT(Invoke_ENABLED);