msxml3: Don't use xmlnode's IXMLDOMNode iface in replaceChild implementations.

This commit is contained in:
Jacek Caban 2010-10-13 15:11:32 +02:00 committed by Alexandre Julliard
parent 91acf625fb
commit 6d20b3f96a
11 changed files with 59 additions and 23 deletions

View File

@ -318,7 +318,10 @@ static HRESULT WINAPI domattr_replaceChild(
IXMLDOMNode** outOldNode)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs tests\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domattr_removeChild(

View File

@ -329,7 +329,10 @@ static HRESULT WINAPI domcdata_replaceChild(
IXMLDOMNode** outOldNode)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs tests\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domcdata_removeChild(

View File

@ -322,7 +322,10 @@ static HRESULT WINAPI domcomment_replaceChild(
IXMLDOMNode** outOldNode)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs tests\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domcomment_removeChild(

View File

@ -325,7 +325,11 @@ static HRESULT WINAPI domfrag_replaceChild(
IXMLDOMNode** outOldNode)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
TRACE("(%p)->(%p %p %p)\n", This, newNode, oldNode, outOldNode);
/* TODO: test */
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domfrag_removeChild(

View File

@ -1029,7 +1029,10 @@ static HRESULT WINAPI domdoc_replaceChild(
IXMLDOMNode** outOldChild)
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newChild, oldChild, outOldChild );
TRACE("(%p)->(%p %p %p)\n", This, newChild, oldChild, outOldChild);
return node_replace_child(&This->node, newChild, oldChild, outOldChild);
}

View File

@ -334,7 +334,10 @@ static HRESULT WINAPI domelem_replaceChild(
IXMLDOMNode** outOldNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
TRACE("(%p)->(%p %p %p)\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domelem_removeChild(

View File

@ -320,7 +320,10 @@ static HRESULT WINAPI entityref_replaceChild(
IXMLDOMNode** outOldNode)
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI entityref_removeChild(

View File

@ -169,6 +169,7 @@ extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**);
extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**);
extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);

View File

@ -450,26 +450,20 @@ static HRESULT WINAPI xmlnode_insertBefore(
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode *iface,
IXMLDOMNode* newChild,
IXMLDOMNode* oldChild,
IXMLDOMNode** outOldChild)
HRESULT node_replace_child(xmlnode *This, IXMLDOMNode *newChild, IXMLDOMNode *oldChild,
IXMLDOMNode **ret)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlnode *old_child, *new_child;
xmlDocPtr leaving_doc;
xmlNode *my_ancestor;
TRACE("(%p)->(%p %p %p)\n", This, newChild, oldChild, outOldChild);
/* Do not believe any documentation telling that newChild == NULL
means removal. It does certainly *not* apply to msxml3! */
if(!newChild || !oldChild)
return E_INVALIDARG;
if(outOldChild)
*outOldChild = NULL;
if(ret)
*ret = NULL;
old_child = get_node_obj(oldChild);
if(!old_child) {
@ -479,7 +473,7 @@ static HRESULT WINAPI xmlnode_replaceChild(
if(old_child->node->parent != This->node)
{
WARN("childNode %p is not a child of %p\n", oldChild, iface);
WARN("childNode %p is not a child of %p\n", oldChild, This);
return E_INVALIDARG;
}
@ -511,15 +505,25 @@ static HRESULT WINAPI xmlnode_replaceChild(
xmldoc_add_orphan(old_child->node->doc, old_child->node);
if(outOldChild)
if(ret)
{
IXMLDOMNode_AddRef(oldChild);
*outOldChild = oldChild;
*ret = oldChild;
}
return S_OK;
}
static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode *iface,
IXMLDOMNode* newChild,
IXMLDOMNode* oldChild,
IXMLDOMNode** outOldChild)
{
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_removeChild(
IXMLDOMNode *iface,
IXMLDOMNode* childNode,
@ -1852,7 +1856,10 @@ static HRESULT WINAPI unknode_replaceChild(
IXMLDOMNode** outOldNode)
{
unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p)\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI unknode_removeChild(

View File

@ -336,7 +336,10 @@ static HRESULT WINAPI dom_pi_replaceChild(
IXMLDOMNode** outOldNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI dom_pi_removeChild(

View File

@ -335,7 +335,10 @@ static HRESULT WINAPI domtext_replaceChild(
IXMLDOMNode** outOldNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(&This->node), newNode, oldNode, outOldNode );
FIXME("(%p)->(%p %p %p) needs test\n", This, newNode, oldNode, outOldNode);
return node_replace_child(&This->node, newNode, oldNode, outOldNode);
}
static HRESULT WINAPI domtext_removeChild(