Commit dd04cbc5 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use create_nselem in IHTMLOptionFactory::create.

parent 9ce3e6b7
...@@ -448,9 +448,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory ...@@ -448,9 +448,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
IHTMLOptionElement **optelem) IHTMLOptionElement **optelem)
{ {
HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
nsIDOMElement *nselem; nsIDOMHTMLElement *nselem;
nsAString option_str;
nsresult nsres;
HRESULT hres; HRESULT hres;
static const PRUnichar optionW[] = {'O','P','T','I','O','N',0}; static const PRUnichar optionW[] = {'O','P','T','I','O','N',0};
...@@ -458,24 +456,20 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory ...@@ -458,24 +456,20 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value), TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value),
debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem); debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem);
if(!This->window || !This->window->doc || !This->window->doc->basedoc.nsdoc) { if(!This->window || !This->window->doc) {
WARN("NULL nsdoc\n"); WARN("NULL doc\n");
return E_UNEXPECTED; return E_UNEXPECTED;
} }
*optelem = NULL; *optelem = NULL;
nsAString_Init(&option_str, optionW); hres = create_nselem(This->window->doc, optionW, &nselem);
nsres = nsIDOMHTMLDocument_CreateElement(This->window->doc->basedoc.nsdoc, &option_str, &nselem); if(FAILED(hres))
nsAString_Finish(&option_str); return hres;
if(NS_FAILED(nsres)) {
ERR("CreateElement failed: %08x\n", nsres);
return E_FAIL;
}
hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE)), hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE)),
&IID_IHTMLOptionElement, (void**)optelem); &IID_IHTMLOptionElement, (void**)optelem);
nsIDOMElement_Release(nselem); nsIDOMHTMLElement_Release(nselem);
if(V_VT(&text) == VT_BSTR) if(V_VT(&text) == VT_BSTR)
IHTMLOptionElement_put_text(*optelem, V_BSTR(&text)); IHTMLOptionElement_put_text(*optelem, V_BSTR(&text));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment