Jacek Caban : mshtml: Use stored nsdoc in IHTMOptionElement::put_text.

Alexandre Julliard julliard at winehq.org
Fri Oct 10 08:06:36 CDT 2008


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Oct  9 15:25:47 2008 -0500

mshtml: Use stored nsdoc in IHTMOptionElement::put_text.

---

 dlls/mshtml/htmloption.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index accae83..4c93088 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -180,7 +180,6 @@ static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LON
 static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
 {
     HTMLOptionElement *This = HTMLOPTION_THIS(iface);
-    nsIDOMDocument *nsdoc;
     nsIDOMText *text_node;
     nsAString text_str;
     nsIDOMNode *tmp;
@@ -188,6 +187,11 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
 
+    if(!This->element.node.doc->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
     while(1) {
         nsIDOMNode *child;
 
@@ -205,19 +209,12 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
         }
     }
 
-    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);
+    nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
     nsAString_Finish(&text_str);
     if(NS_FAILED(nsres)) {
         ERR("CreateTextNode failed: %08x\n", nsres);
-        return S_OK;
+        return E_FAIL;
     }
 
     nsres = nsIDOMHTMLOptionElement_AppendChild(This->nsoption, (nsIDOMNode*)text_node, &tmp);




More information about the wine-cvs mailing list