Jacek Caban : mshtml: Added IHTMLTxtRange::put_text implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 17 06:30:45 CDT 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug 17 02:38:00 2007 +0200

mshtml: Added IHTMLTxtRange::put_text implementation.

---

 dlls/mshtml/mshtml_private.h |    2 ++
 dlls/mshtml/txtrange.c       |   34 ++++++++++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 63e2027..347a61c 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -50,6 +50,8 @@
 #define NS_ELEMENT_NODE   1
 #define NS_DOCUMENT_NODE  9
 
+#define MSHTML_E_NODOC    0x800a025c
+
 typedef struct HTMLDOMNode HTMLDOMNode;
 typedef struct ConnectionPoint ConnectionPoint;
 typedef struct BSCallback BSCallback;
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 70791a3..ee5cbe7 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -180,8 +180,38 @@ static HRESULT WINAPI HTMLTxtRange_get_htmlText(IHTMLTxtRange *iface, BSTR *p)
 static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
 {
     HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsIDOMDocument *nsdoc;
+    nsIDOMText *text_node;
+    nsAString text_str;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    if(!This->doc)
+        return MSHTML_E_NODOC;
+
+    nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc);
+    if(NS_FAILED(nsres)) {
+        ERR("GetDocument failed: %08x\n", nsres);
+        return S_OK;
+    }
+
+    nsAString_Init(&text_str, v);
+    nsres = nsIDOMDocument_CreateTextNode(nsdoc, &text_str, &text_node);
+    nsAString_Finish(&text_str);
+    if(NS_FAILED(nsres)) {
+        ERR("CreateTextNode failed: %08x\n", nsres);
+        return S_OK;
+    }
+    nsres = nsIDOMRange_DeleteContents(This->nsrange);
+    if(NS_FAILED(nsres))
+        ERR("DeleteContents failed: %08x\n", nsres);
+
+    nsres = nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)text_node);
+    if(NS_FAILED(nsres))
+        ERR("InsertNode failed: %08x\n", nsres);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLTxtRange_get_text(IHTMLTxtRange *iface, BSTR *p)




More information about the wine-cvs mailing list