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

This commit is contained in:
Jacek Caban 2010-09-10 16:55:14 +02:00 committed by Alexandre Julliard
parent e9ebd8c964
commit addefe4ce5
11 changed files with 77 additions and 44 deletions

View File

@ -301,11 +301,14 @@ static HRESULT WINAPI domattr_get_attributes(
static HRESULT WINAPI domattr_insertBefore(
IXMLDOMAttribute *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domattr_replaceChild(

View File

@ -312,11 +312,14 @@ static HRESULT WINAPI domcdata_get_attributes(
static HRESULT WINAPI domcdata_insertBefore(
IXMLDOMCDATASection *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domcdata_replaceChild(

View File

@ -305,11 +305,14 @@ static HRESULT WINAPI domcomment_get_attributes(
static HRESULT WINAPI domcomment_insertBefore(
IXMLDOMComment *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domcomment_replaceChild(

View File

@ -307,11 +307,15 @@ static HRESULT WINAPI domfrag_get_attributes(
static HRESULT WINAPI domfrag_insertBefore(
IXMLDOMDocumentFragment *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
TRACE("(%p)->(%p x%d %p)\n", This, newNode, V_VT(&refChild), outOldNode);
/* TODO: test */
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domfrag_replaceChild(

View File

@ -826,7 +826,10 @@ static HRESULT WINAPI domdoc_insertBefore(
IXMLDOMNode** outNewChild )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newChild, refChild, outNewChild );
TRACE("(%p)->(%p x%d %p)\n", This, newChild, V_VT(&refChild), outNewChild);
return node_insert_before(&This->node, newChild, &refChild, outNewChild);
}

View File

@ -317,11 +317,14 @@ static HRESULT WINAPI domelem_get_attributes(
static HRESULT WINAPI domelem_insertBefore(
IXMLDOMElement *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
TRACE("(%p)->(%p x%d %p)\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domelem_replaceChild(

View File

@ -303,11 +303,14 @@ static HRESULT WINAPI entityref_get_attributes(
static HRESULT WINAPI entityref_insertBefore(
IXMLDOMEntityReference *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI entityref_replaceChild(

View File

@ -168,6 +168,7 @@ extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**);
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 DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);

View File

@ -373,47 +373,37 @@ static HRESULT WINAPI xmlnode_get_attributes(
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_insertBefore(
IXMLDOMNode *iface,
IXMLDOMNode* newChild,
VARIANT refChild,
IXMLDOMNode** outNewChild)
HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT *ref_child,
IXMLDOMNode **ret)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlNodePtr before_node, new_child_node;
IXMLDOMNode *before = NULL;
xmlnode *node_obj;
HRESULT hr;
TRACE("(%p)->(%p var %p)\n",This,newChild,outNewChild);
if (!newChild)
if(!new_child)
return E_INVALIDARG;
switch(V_VT(&refChild))
node_obj = get_node_obj(new_child);
if(!node_obj) {
FIXME("newChild is not our node implementation\n");
return E_FAIL;
}
switch(V_VT(ref_child))
{
case VT_EMPTY:
case VT_NULL:
break;
case VT_UNKNOWN:
hr = IUnknown_QueryInterface(V_UNKNOWN(&refChild), &IID_IXMLDOMNode, (LPVOID)&before);
if(FAILED(hr)) return hr;
break;
case VT_DISPATCH:
hr = IDispatch_QueryInterface(V_DISPATCH(&refChild), &IID_IXMLDOMNode, (LPVOID)&before);
hr = IUnknown_QueryInterface(V_UNKNOWN(ref_child), &IID_IXMLDOMNode, (LPVOID)&before);
if(FAILED(hr)) return hr;
break;
default:
FIXME("refChild var type %x\n", V_VT(&refChild));
return E_FAIL;
}
node_obj = get_node_obj(newChild);
if(!node_obj) {
FIXME("newChild is not our node implementation\n");
FIXME("refChild var type %x\n", V_VT(ref_child));
return E_FAIL;
}
@ -441,14 +431,25 @@ static HRESULT WINAPI xmlnode_insertBefore(
xmlAddChild(This->node, new_child_node);
}
IXMLDOMNode_AddRef(newChild);
if(outNewChild)
*outNewChild = newChild;
if(ret) {
IXMLDOMNode_AddRef(new_child);
*ret = new_child;
}
TRACE("ret S_OK\n");
return S_OK;
}
static HRESULT WINAPI xmlnode_insertBefore(
IXMLDOMNode *iface,
IXMLDOMNode* newChild,
VARIANT refChild,
IXMLDOMNode** outNewChild)
{
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode *iface,
IXMLDOMNode* newChild,
@ -1838,11 +1839,14 @@ static HRESULT WINAPI unknode_get_attributes(
static HRESULT WINAPI unknode_insertBefore(
IXMLDOMNode *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p)\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI unknode_replaceChild(

View File

@ -319,11 +319,14 @@ static HRESULT WINAPI dom_pi_get_attributes(
static HRESULT WINAPI dom_pi_insertBefore(
IXMLDOMProcessingInstruction *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI dom_pi_replaceChild(

View File

@ -318,11 +318,14 @@ static HRESULT WINAPI domtext_get_attributes(
static HRESULT WINAPI domtext_insertBefore(
IXMLDOMText *iface,
IXMLDOMNode* newNode, VARIANT var1,
IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(&This->node), newNode, var1, outOldNode );
FIXME("(%p)->(%p x%d %p) needs test\n", This, newNode, V_VT(&refChild), outOldNode);
return node_insert_before(&This->node, newNode, &refChild, outOldNode);
}
static HRESULT WINAPI domtext_replaceChild(