Jacek Caban : mshtml: Added IHTMLDocument2::get_title implementation.

Alexandre Julliard julliard at winehq.org
Thu Jul 24 06:56:48 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jul 23 13:16:57 2008 +0200

mshtml: Added IHTMLDocument2::get_title implementation.

Based on patch by Ivan Sinitsin.

---

 dlls/mshtml/htmldoc.c |   34 ++++++++++++++++++++++++++++++++--
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 40099d3..b1f063f 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -413,8 +413,38 @@ static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
 {
     HTMLDocument *This = HTMLDOC_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsIDOMHTMLDocument *nshtmldoc;
+    nsIDOMDocument *nsdoc;
+    const PRUnichar *ret;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if(!This->nscontainer)
+        return E_FAIL;
+
+    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
+    if(NS_FAILED(nsres) || !nsdoc) {
+        ERR("GetDocument failed: %08x\n", nsres);
+        return E_FAIL;
+    }
+
+    nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
+    nsIDOMDocument_Release(nsdoc);
+
+    nsAString_Init(&nsstr, NULL);
+
+    nsres = nsIDOMHTMLDocument_GetTitle(nshtmldoc, &nsstr);
+    nsIDOMHTMLDocument_Release(nshtmldoc);
+    if (NS_FAILED(nsres))
+        ERR("GetTitle failed: %08x\n", nsres);
+
+    nsAString_GetData(&nsstr, &ret);
+    *p = SysAllocString(ret);
+    nsAString_Finish(&nsstr);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)




More information about the wine-cvs mailing list