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

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

parent e9ebd8c9
...@@ -301,11 +301,14 @@ static HRESULT WINAPI domattr_get_attributes( ...@@ -301,11 +301,14 @@ static HRESULT WINAPI domattr_get_attributes(
static HRESULT WINAPI domattr_insertBefore( static HRESULT WINAPI domattr_insertBefore(
IXMLDOMAttribute *iface, IXMLDOMAttribute *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domattr *This = impl_from_IXMLDOMAttribute( iface ); 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( static HRESULT WINAPI domattr_replaceChild(
......
...@@ -312,11 +312,14 @@ static HRESULT WINAPI domcdata_get_attributes( ...@@ -312,11 +312,14 @@ static HRESULT WINAPI domcdata_get_attributes(
static HRESULT WINAPI domcdata_insertBefore( static HRESULT WINAPI domcdata_insertBefore(
IXMLDOMCDATASection *iface, IXMLDOMCDATASection *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domcdata *This = impl_from_IXMLDOMCDATASection( iface ); 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( static HRESULT WINAPI domcdata_replaceChild(
......
...@@ -305,11 +305,14 @@ static HRESULT WINAPI domcomment_get_attributes( ...@@ -305,11 +305,14 @@ static HRESULT WINAPI domcomment_get_attributes(
static HRESULT WINAPI domcomment_insertBefore( static HRESULT WINAPI domcomment_insertBefore(
IXMLDOMComment *iface, IXMLDOMComment *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domcomment *This = impl_from_IXMLDOMComment( iface ); 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( static HRESULT WINAPI domcomment_replaceChild(
......
...@@ -307,11 +307,15 @@ static HRESULT WINAPI domfrag_get_attributes( ...@@ -307,11 +307,15 @@ static HRESULT WINAPI domfrag_get_attributes(
static HRESULT WINAPI domfrag_insertBefore( static HRESULT WINAPI domfrag_insertBefore(
IXMLDOMDocumentFragment *iface, IXMLDOMDocumentFragment *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); 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( static HRESULT WINAPI domfrag_replaceChild(
......
...@@ -826,7 +826,10 @@ static HRESULT WINAPI domdoc_insertBefore( ...@@ -826,7 +826,10 @@ static HRESULT WINAPI domdoc_insertBefore(
IXMLDOMNode** outNewChild ) IXMLDOMNode** outNewChild )
{ {
domdoc *This = impl_from_IXMLDOMDocument3( iface ); 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);
} }
......
...@@ -317,11 +317,14 @@ static HRESULT WINAPI domelem_get_attributes( ...@@ -317,11 +317,14 @@ static HRESULT WINAPI domelem_get_attributes(
static HRESULT WINAPI domelem_insertBefore( static HRESULT WINAPI domelem_insertBefore(
IXMLDOMElement *iface, IXMLDOMElement *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domelem *This = impl_from_IXMLDOMElement( iface ); 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( static HRESULT WINAPI domelem_replaceChild(
......
...@@ -303,11 +303,14 @@ static HRESULT WINAPI entityref_get_attributes( ...@@ -303,11 +303,14 @@ static HRESULT WINAPI entityref_get_attributes(
static HRESULT WINAPI entityref_insertBefore( static HRESULT WINAPI entityref_insertBefore(
IXMLDOMEntityReference *iface, IXMLDOMEntityReference *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
entityref *This = impl_from_IXMLDOMEntityReference( iface ); 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( static HRESULT WINAPI entityref_replaceChild(
......
...@@ -168,6 +168,7 @@ extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**); ...@@ -168,6 +168,7 @@ extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**); extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**); extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_next_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); extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);
......
...@@ -373,47 +373,37 @@ static HRESULT WINAPI xmlnode_get_attributes( ...@@ -373,47 +373,37 @@ static HRESULT WINAPI xmlnode_get_attributes(
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI xmlnode_insertBefore( HRESULT node_insert_before(xmlnode *This, IXMLDOMNode *new_child, const VARIANT *ref_child,
IXMLDOMNode *iface, IXMLDOMNode **ret)
IXMLDOMNode* newChild,
VARIANT refChild,
IXMLDOMNode** outNewChild)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlNodePtr before_node, new_child_node; xmlNodePtr before_node, new_child_node;
IXMLDOMNode *before = NULL; IXMLDOMNode *before = NULL;
xmlnode *node_obj; xmlnode *node_obj;
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%p var %p)\n",This,newChild,outNewChild); if(!new_child)
if (!newChild)
return E_INVALIDARG; 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_EMPTY:
case VT_NULL: case VT_NULL:
break; break;
case VT_UNKNOWN: case VT_UNKNOWN:
hr = IUnknown_QueryInterface(V_UNKNOWN(&refChild), &IID_IXMLDOMNode, (LPVOID)&before);
if(FAILED(hr)) return hr;
break;
case VT_DISPATCH: 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; if(FAILED(hr)) return hr;
break; break;
default: default:
FIXME("refChild var type %x\n", V_VT(&refChild)); FIXME("refChild var type %x\n", V_VT(ref_child));
return E_FAIL;
}
node_obj = get_node_obj(newChild);
if(!node_obj) {
FIXME("newChild is not our node implementation\n");
return E_FAIL; return E_FAIL;
} }
...@@ -441,14 +431,25 @@ static HRESULT WINAPI xmlnode_insertBefore( ...@@ -441,14 +431,25 @@ static HRESULT WINAPI xmlnode_insertBefore(
xmlAddChild(This->node, new_child_node); xmlAddChild(This->node, new_child_node);
} }
IXMLDOMNode_AddRef(newChild); if(ret) {
if(outNewChild) IXMLDOMNode_AddRef(new_child);
*outNewChild = newChild; *ret = new_child;
}
TRACE("ret S_OK\n"); TRACE("ret S_OK\n");
return S_OK; 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( static HRESULT WINAPI xmlnode_replaceChild(
IXMLDOMNode *iface, IXMLDOMNode *iface,
IXMLDOMNode* newChild, IXMLDOMNode* newChild,
...@@ -1838,11 +1839,14 @@ static HRESULT WINAPI unknode_get_attributes( ...@@ -1838,11 +1839,14 @@ static HRESULT WINAPI unknode_get_attributes(
static HRESULT WINAPI unknode_insertBefore( static HRESULT WINAPI unknode_insertBefore(
IXMLDOMNode *iface, IXMLDOMNode *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
unknode *This = impl_from_unkIXMLDOMNode( iface ); 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( static HRESULT WINAPI unknode_replaceChild(
......
...@@ -319,11 +319,14 @@ static HRESULT WINAPI dom_pi_get_attributes( ...@@ -319,11 +319,14 @@ static HRESULT WINAPI dom_pi_get_attributes(
static HRESULT WINAPI dom_pi_insertBefore( static HRESULT WINAPI dom_pi_insertBefore(
IXMLDOMProcessingInstruction *iface, IXMLDOMProcessingInstruction *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); 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( static HRESULT WINAPI dom_pi_replaceChild(
......
...@@ -318,11 +318,14 @@ static HRESULT WINAPI domtext_get_attributes( ...@@ -318,11 +318,14 @@ static HRESULT WINAPI domtext_get_attributes(
static HRESULT WINAPI domtext_insertBefore( static HRESULT WINAPI domtext_insertBefore(
IXMLDOMText *iface, IXMLDOMText *iface,
IXMLDOMNode* newNode, VARIANT var1, IXMLDOMNode* newNode, VARIANT refChild,
IXMLDOMNode** outOldNode) IXMLDOMNode** outOldNode)
{ {
domtext *This = impl_from_IXMLDOMText( iface ); 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( static HRESULT WINAPI domtext_replaceChild(
......
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