mshtml: Don't use nselem in InsertAdjacentNode implementation.
This commit is contained in:
parent
b553019dc3
commit
90d078950c
|
@ -1014,19 +1014,13 @@ static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsI
|
||||||
static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
|
static const WCHAR wszAfterEnd[] = {'a','f','t','e','r','E','n','d',0};
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
if(!This->nselem) {
|
|
||||||
FIXME("NULL nselem\n");
|
|
||||||
return E_NOTIMPL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!strcmpiW(where, wszBeforeBegin))
|
if (!strcmpiW(where, wszBeforeBegin))
|
||||||
{
|
{
|
||||||
nsIDOMNode *unused;
|
nsIDOMNode *unused;
|
||||||
nsIDOMNode *parent;
|
nsIDOMNode *parent;
|
||||||
nsres = nsIDOMNode_GetParentNode(This->nselem, &parent);
|
nsres = nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
|
||||||
if (!parent) return E_INVALIDARG;
|
if (!parent) return E_INVALIDARG;
|
||||||
nsres = nsIDOMNode_InsertBefore(parent, nsnode,
|
nsres = nsIDOMNode_InsertBefore(parent, nsnode, This->node.nsnode, &unused);
|
||||||
(nsIDOMNode *)This->nselem, &unused);
|
|
||||||
if (unused) nsIDOMNode_Release(unused);
|
if (unused) nsIDOMNode_Release(unused);
|
||||||
nsIDOMNode_Release(parent);
|
nsIDOMNode_Release(parent);
|
||||||
}
|
}
|
||||||
|
@ -1034,15 +1028,15 @@ static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsI
|
||||||
{
|
{
|
||||||
nsIDOMNode *unused;
|
nsIDOMNode *unused;
|
||||||
nsIDOMNode *first_child;
|
nsIDOMNode *first_child;
|
||||||
nsIDOMNode_GetFirstChild(This->nselem, &first_child);
|
nsIDOMNode_GetFirstChild(This->node.nsnode, &first_child);
|
||||||
nsres = nsIDOMNode_InsertBefore(This->nselem, nsnode, first_child, &unused);
|
nsres = nsIDOMNode_InsertBefore(This->node.nsnode, nsnode, first_child, &unused);
|
||||||
if (unused) nsIDOMNode_Release(unused);
|
if (unused) nsIDOMNode_Release(unused);
|
||||||
if (first_child) nsIDOMNode_Release(first_child);
|
if (first_child) nsIDOMNode_Release(first_child);
|
||||||
}
|
}
|
||||||
else if (!strcmpiW(where, wszBeforeEnd))
|
else if (!strcmpiW(where, wszBeforeEnd))
|
||||||
{
|
{
|
||||||
nsIDOMNode *unused;
|
nsIDOMNode *unused;
|
||||||
nsres = nsIDOMNode_AppendChild(This->nselem, nsnode, &unused);
|
nsres = nsIDOMNode_AppendChild(This->node.nsnode, nsnode, &unused);
|
||||||
if (unused) nsIDOMNode_Release(unused);
|
if (unused) nsIDOMNode_Release(unused);
|
||||||
}
|
}
|
||||||
else if (!strcmpiW(where, wszAfterEnd))
|
else if (!strcmpiW(where, wszAfterEnd))
|
||||||
|
@ -1050,10 +1044,10 @@ static HRESULT HTMLElement_InsertAdjacentNode(HTMLElement *This, BSTR where, nsI
|
||||||
nsIDOMNode *unused;
|
nsIDOMNode *unused;
|
||||||
nsIDOMNode *next_sibling;
|
nsIDOMNode *next_sibling;
|
||||||
nsIDOMNode *parent;
|
nsIDOMNode *parent;
|
||||||
nsIDOMNode_GetParentNode(This->nselem, &parent);
|
nsIDOMNode_GetParentNode(This->node.nsnode, &parent);
|
||||||
if (!parent) return E_INVALIDARG;
|
if (!parent) return E_INVALIDARG;
|
||||||
|
|
||||||
nsIDOMNode_GetNextSibling(This->nselem, &next_sibling);
|
nsIDOMNode_GetNextSibling(This->node.nsnode, &next_sibling);
|
||||||
if (next_sibling)
|
if (next_sibling)
|
||||||
{
|
{
|
||||||
nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
|
nsres = nsIDOMNode_InsertBefore(parent, nsnode, next_sibling, &unused);
|
||||||
|
@ -1109,7 +1103,7 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMRange_SetStartBefore(range, (nsIDOMNode *)This->nselem);
|
nsIDOMRange_SetStartBefore(range, This->node.nsnode);
|
||||||
|
|
||||||
nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
|
nsIDOMRange_QueryInterface(range, &IID_nsIDOMNSRange, (void **)&nsrange);
|
||||||
nsIDOMRange_Release(range);
|
nsIDOMRange_Release(range);
|
||||||
|
|
Loading…
Reference in New Issue