mshtml: Use stored nsdoc in IHTMOptionElement::put_text.

oldstable
Jacek Caban 2008-10-09 15:25:47 -05:00 committed by Alexandre Julliard
parent 4283f5ac40
commit c3ea7272a3
1 changed files with 7 additions and 10 deletions

View File

@ -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);