Jacek Caban : mshtml: Added IHTMLWindow2::get_document implementation.
Alexandre Julliard
julliard at winehq.org
Tue Apr 22 06:46:57 CDT 2008
Module: wine
Branch: master
Commit: aeb1095b47482fdbdb46814d51a54601712837ef
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aeb1095b47482fdbdb46814d51a54601712837ef
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Apr 21 18:12:32 2008 +0200
mshtml: Added IHTMLWindow2::get_document implementation.
---
dlls/mshtml/htmlwindow.c | 14 ++++++++++++--
dlls/mshtml/tests/dom.c | 21 ++++++++++++++++++++-
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 5ed5701..43c893f 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -467,8 +467,18 @@ static HRESULT WINAPI HTMLWindow2_get_onscroll(IHTMLWindow2 *iface, VARIANT *p)
static HRESULT WINAPI HTMLWindow2_get_document(IHTMLWindow2 *iface, IHTMLDocument2 **p)
{
HTMLWindow *This = HTMLWINDOW2_THIS(iface);
- FIXME("(%p)->(%p)\n", This, p);
- return E_NOTIMPL;
+
+ TRACE("(%p)->(%p)\n", This, p);
+
+ if(This->doc) {
+ /* FIXME: We should return a wrapper object here */
+ *p = HTMLDOC(This->doc);
+ IHTMLDocument2_AddRef(*p);
+ }else {
+ *p = NULL;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI HTMLWindow2_get_event(IHTMLWindow2 *iface, IHTMLEventObj **p)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index 90ccd4d..59c2a17 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -1081,7 +1081,6 @@ static void test_navigator(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_parentWindow(doc, &window);
ok(hres == S_OK, "parentWidnow failed: %08x\n", hres);
- test_ifaces((IUnknown*)window, window_iids);
hres = IHTMLWindow2_get_navigator(window, &navigator);
ok(hres == S_OK, "get_navigator failed: %08x\n", hres);
@@ -1187,6 +1186,25 @@ static void test_default_body(IHTMLBodyElement *body)
ok(bstr == NULL, "bstr != NULL\n");
}
+static void test_window(IHTMLDocument2 *doc)
+{
+ IHTMLWindow2 *window;
+ IHTMLDocument2 *doc2 = NULL;
+ HRESULT hres;
+
+ hres = IHTMLDocument2_get_parentWindow(doc, &window);
+ ok(hres == S_OK, "get_parentElement failed: %08x\n", hres);
+ test_ifaces((IUnknown*)window, window_iids);
+ test_disp((IUnknown*)window, &DIID_DispHTMLWindow2);
+
+ hres = IHTMLWindow2_get_document(window, &doc2);
+ ok(hres == S_OK, "get_document failed: %08x\n", hres);
+ ok(doc2 != NULL, "doc2 == NULL\n");
+
+ IHTMLDocument_Release(doc2);
+ IHTMLWindow2_Release(window);
+}
+
static void test_defaults(IHTMLDocument2 *doc)
{
IHTMLStyleSheetsCollection *stylesheetcol;
@@ -1209,6 +1227,7 @@ static void test_defaults(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_style failed: %08x\n", hres);
test_default_style(style);
+ test_window(doc);
test_compatmode(doc);
test_location(doc);
test_navigator(doc);
More information about the wine-cvs
mailing list