mshtml: Moved creating HTML element to separated function.
This commit is contained in:
parent
62c0c7b11f
commit
878b85825a
|
@ -1033,24 +1033,12 @@ static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTa
|
|||
IHTMLElement **newElem)
|
||||
{
|
||||
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
||||
HTMLDocumentNode *doc_node;
|
||||
nsIDOMHTMLElement *nselem;
|
||||
HTMLElement *elem;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
|
||||
|
||||
/* Use owner doc if called on document fragment */
|
||||
doc_node = This->doc_node;
|
||||
if(!doc_node->nsdoc)
|
||||
doc_node = doc_node->node.doc;
|
||||
|
||||
hres = create_nselem(doc_node, eTag, &nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = HTMLElement_Create(doc_node, (nsIDOMNode*)nselem, TRUE, &elem);
|
||||
nsIDOMHTMLElement_Release(nselem);
|
||||
hres = create_element(This->doc_node, eTag, &elem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
|
@ -199,6 +199,24 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **ret)
|
||||
{
|
||||
nsIDOMHTMLElement *nselem;
|
||||
HRESULT hres;
|
||||
|
||||
/* Use owner doc if called on document fragment */
|
||||
if(!doc->nsdoc)
|
||||
doc = doc->node.doc;
|
||||
|
||||
hres = create_nselem(doc, tag, &nselem);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, TRUE, ret);
|
||||
nsIDOMHTMLElement_Release(nselem);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
|
|
|
@ -838,6 +838,7 @@ HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
|
|||
HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
|
||||
HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
|
||||
|
||||
HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
|
||||
|
||||
|
|
Loading…
Reference in New Issue