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

Alexandre Julliard julliard at winehq.org
Mon Oct 15 11:27:57 CDT 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Oct 14 00:10:43 2007 +0200

mshtml: Added IHTMLOptionElement::put_text implementation.

---

 dlls/mshtml/htmloption.c |   49 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index c21a4bb..5c48c23 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -189,8 +189,53 @@ static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LON
 static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
 {
     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
-    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
-    return E_NOTIMPL;
+    nsIDOMDocument *nsdoc;
+    nsIDOMText *text_node;
+    nsAString text_str;
+    nsIDOMNode *tmp;
+    nsresult nsres;
+
+    TRACE("(%p)->(%s)\n", This, debugstr_w(v));
+
+    while(1) {
+        nsIDOMNode *child;
+
+        nsres = nsIDOMHTMLOptionElement_GetFirstChild(This->nsoption, &child);
+        if(NS_FAILED(nsres) || !child)
+            break;
+
+        nsres = nsIDOMHTMLOptionElement_RemoveChild(This->nsoption, child, &tmp);
+        nsIDOMNode_Release(child);
+        if(NS_SUCCEEDED(nsres)) {
+            nsIDOMNode_Release(tmp);
+        }else {
+            ERR("RemoveChild failed: %08x\n", nsres);
+            break;
+        }
+    }
+
+    nsres = nsIWebNavigation_GetDocument(This->element.node.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);
+    nsIDOMDocument_Release(nsdoc);
+    nsAString_Finish(&text_str);
+    if(NS_FAILED(nsres)) {
+        ERR("CreateTextNode failed: %08x\n", nsres);
+        return S_OK;
+    }
+
+    nsres = nsIDOMHTMLOptionElement_AppendChild(This->nsoption, (nsIDOMNode*)text_node, &tmp);
+    if(NS_SUCCEEDED(nsres))
+        nsIDOMNode_Release(tmp);
+    else
+        ERR("AppendChild failed: %08x\n", nsres);
+
+    return S_OK;
 }
 
 static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p)




More information about the wine-cvs mailing list