mshtml.dll:Add implementation of HTMLDocument_(Get|Set)Title

Ivan Sinitsin ivan at etersoft.ru
Fri Jul 4 02:17:53 CDT 2008


Changelog:
    mshtml.dll:Add implementation of HTMLDocument_(Get|Set)Title


-- 
Sinitsin Ivan
-------------- next part --------------
From 99676383eb6497c0961bd78734cbce91abb5e7ed Mon Sep 17 00:00:00 2001
From: Sinitsin Ivan <ivan at etersoft.ru>
Date: Fri, 4 Jul 2008 10:54:58 +0400
Subject: [PATCH] mshtml.dll:Add implementation HTMLDocument_(Get|Set)Title

---
 dlls/mshtml/htmldoc.c |   71 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index b77d69e..56bc97f 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -381,15 +381,78 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
 {
     HTMLDocument *This = HTMLDOC_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsIDOMDocument *nsdoc;
+    nsIDOMHTMLDocument *nshtmldoc;
+    nsAString nsstr;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    if(!This->nscontainer)
+        return E_POINTER;
+
+    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
+    if(NS_FAILED(nsres)) {
+        ERR("GetDocument failed: %08x\n", nsres);
+        return nsres;
+    }
+
+    if(NS_FAILED(nsres) || !nsdoc).
+        return E_FAIL;
+
+    nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
+    nsIDOMDocument_Release(nsdoc);
+
+    nsAString_Init(&nsstr, NULL);
+    nsAString_SetData(&nsstr, v);
+
+    nsres = nsIDOMHTMLDocument_SetTitle(nshtmldoc, &nsstr);
+    nsIDOMHTMLDocument_Release(nshtmldoc);
+
+    return nsres;
 }
 
 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
 {
     HTMLDocument *This = HTMLDOC_THIS(iface);
-    FIXME("(%p)->(%p)\n", This, p);
-    return E_NOTIMPL;
+    nsIDOMDocument *nsdoc;
+    nsIDOMHTMLDocument *nshtmldoc;
+    nsAString nsstr;
+    const PRUnichar *ret;
+    nsresult nsres;
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    if (!p).
+        return E_POINTER;
+
+    if(!This->nscontainer)
+        return E_POINTER;
+
+    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
+    if(NS_FAILED(nsres)) {
+        ERR("GetDocument failed: %08x\n", nsres);
+        return nsres;
+    }
+
+    if(NS_FAILED(nsres) || !nsdoc).
+        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))
+        return nsres;
+
+    nsAString_GetData(&nsstr, &ret);
+    *p = SysAllocString(ret);
+
+    return nsres;
 }
 
 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
-- 
1.5.4.5.GIT



More information about the wine-patches mailing list