Jacek Caban : mshtml: Added ITargetContainer:: GetFramesContainer implementation.

Alexandre Julliard julliard at winehq.org
Thu Jan 19 14:56:54 CST 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Jan 19 17:03:24 2012 +0100

mshtml: Added ITargetContainer::GetFramesContainer implementation.

---

 dlls/mshtml/oleobj.c        |    9 +++++++--
 dlls/mshtml/tests/htmldoc.c |   40 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/oleobj.c b/dlls/mshtml/oleobj.c
index 9d50347..9f3d75a 100644
--- a/dlls/mshtml/oleobj.c
+++ b/dlls/mshtml/oleobj.c
@@ -924,8 +924,13 @@ static HRESULT WINAPI TargetContainer_GetFrameUrl(ITargetContainer *iface, LPWST
 static HRESULT WINAPI TargetContainer_GetFramesContainer(ITargetContainer *iface, IOleContainer **ppContainer)
 {
     HTMLDocumentObj *This = impl_from_ITargetContainer(iface);
-    FIXME("(%p)->(%p)\n", This, ppContainer);
-    return E_NOTIMPL;
+
+    TRACE("(%p)->(%p)\n", This, ppContainer);
+
+    /* NOTE: we should return wrapped interface here */
+    IOleContainer_AddRef(&This->basedoc.IOleContainer_iface);
+    *ppContainer = &This->basedoc.IOleContainer_iface;
+    return S_OK;
 }
 
 static const ITargetContainerVtbl TargetContainerVtbl = {
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index 736e60f..0fb115a 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -310,6 +310,21 @@ static BOOL is_lang_english(void)
     return PRIMARYLANGID(GetUserDefaultLangID()) == LANG_ENGLISH;
 }
 
+static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
+{
+    IUnknown *unk1, *unk2;
+
+    if(iface1 == iface2)
+        return TRUE;
+
+    IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
+    IUnknown_Release(unk1);
+    IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
+    IUnknown_Release(unk2);
+
+    return unk1 == unk2;
+}
+
 #define EXPECT_UPDATEUI  1
 #define EXPECT_SETTITLE  2
 
@@ -5212,7 +5227,6 @@ static void test_open_window(IHTMLDocument2 *doc, BOOL do_block)
     }else {
         ok(new_window != NULL, "new_window == NULL\n");
 
-        trace("WINDOW %p\n", new_window);
         hres = IHTMLWindow2_close(new_window);
         ok(hres == S_OK, "close failed: %08x\n", hres);
     }
@@ -6170,6 +6184,29 @@ static void test_external(IHTMLDocument2 *doc, BOOL initialized)
     IHTMLWindow2_Release(htmlwin);
 }
 
+static void test_target_container(IHTMLDocument2 *doc)
+{
+    IOleContainer *ole_container, *doc_ole_container;
+    ITargetContainer *target_container;
+    HRESULT hres;
+
+    hres = IHTMLDocument2_QueryInterface(doc, &IID_ITargetContainer, (void**)&target_container);
+    ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
+
+    hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleContainer, (void**)&doc_ole_container);
+    ok(hres == S_OK, "Could not get ITargetContainer iface: %08x\n", hres);
+
+    ole_container = (void*)0xdeadbeef;
+    hres = ITargetContainer_GetFramesContainer(target_container, &ole_container);
+    ok(hres == S_OK, "GetFramesContainer failed: %08x\n", hres);
+    ok(ole_container != NULL, "ole_container == NULL\n");
+    ok(iface_cmp((IUnknown*)ole_container, (IUnknown*)doc_ole_container), "ole_container != doc_ole_container\n");
+    IOleContainer_Release(ole_container);
+
+    ITargetContainer_Release(target_container);
+    IOleContainer_Release(doc_ole_container);
+}
+
 static void test_StreamLoad(IHTMLDocument2 *doc)
 {
     IPersistStreamInit *init;
@@ -6354,6 +6391,7 @@ static void test_HTMLDocument(BOOL do_load)
     test_OnAmbientPropertyChange(doc);
     test_Window(doc, TRUE);
     test_external(doc, TRUE);
+    test_target_container(doc);
 
     test_UIDeactivate();
     test_OleCommandTarget(doc);




More information about the wine-cvs mailing list