msxml3: Don't use xmlnode's IXMLDOMNode iface in get_[first|last]Node implementations.

This commit is contained in:
Jacek Caban 2010-09-08 15:12:14 +02:00 committed by Alexandre Julliard
parent c8b15e90bd
commit 4f210e21a5
11 changed files with 104 additions and 42 deletions

View File

@ -249,7 +249,10 @@ static HRESULT WINAPI domattr_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domattr *This = impl_from_IXMLDOMAttribute( iface ); domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domattr_get_lastChild( static HRESULT WINAPI domattr_get_lastChild(
@ -257,7 +260,10 @@ static HRESULT WINAPI domattr_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domattr *This = impl_from_IXMLDOMAttribute( iface ); domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domattr_get_previousSibling( static HRESULT WINAPI domattr_get_previousSibling(

View File

@ -260,7 +260,10 @@ static HRESULT WINAPI domcdata_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domcdata *This = impl_from_IXMLDOMCDATASection( iface ); domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domcdata_get_lastChild( static HRESULT WINAPI domcdata_get_lastChild(
@ -268,7 +271,10 @@ static HRESULT WINAPI domcdata_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domcdata *This = impl_from_IXMLDOMCDATASection( iface ); domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domcdata_get_previousSibling( static HRESULT WINAPI domcdata_get_previousSibling(

View File

@ -253,7 +253,10 @@ static HRESULT WINAPI domcomment_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domcomment *This = impl_from_IXMLDOMComment( iface ); domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domcomment_get_lastChild( static HRESULT WINAPI domcomment_get_lastChild(
@ -261,7 +264,10 @@ static HRESULT WINAPI domcomment_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domcomment *This = impl_from_IXMLDOMComment( iface ); domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domcomment_get_previousSibling( static HRESULT WINAPI domcomment_get_previousSibling(

View File

@ -255,7 +255,10 @@ static HRESULT WINAPI domfrag_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domfrag_get_lastChild( static HRESULT WINAPI domfrag_get_lastChild(
@ -263,7 +266,10 @@ static HRESULT WINAPI domfrag_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domfrag_get_previousSibling( static HRESULT WINAPI domfrag_get_previousSibling(

View File

@ -764,7 +764,10 @@ static HRESULT WINAPI domdoc_get_firstChild(
IXMLDOMNode** firstChild ) IXMLDOMNode** firstChild )
{ {
domdoc *This = impl_from_IXMLDOMDocument3( iface ); domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), firstChild );
TRACE("(%p)->(%p)\n", This, firstChild);
return node_get_first_child(&This->node, firstChild);
} }
@ -773,7 +776,10 @@ static HRESULT WINAPI domdoc_get_lastChild(
IXMLDOMNode** lastChild ) IXMLDOMNode** lastChild )
{ {
domdoc *This = impl_from_IXMLDOMDocument3( iface ); domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), lastChild );
TRACE("(%p)->(%p)\n", This, lastChild);
return node_get_first_child(&This->node, lastChild);
} }

View File

@ -264,7 +264,10 @@ static HRESULT WINAPI domelem_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domelem *This = impl_from_IXMLDOMElement( iface ); domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domelem_get_lastChild( static HRESULT WINAPI domelem_get_lastChild(
@ -272,7 +275,10 @@ static HRESULT WINAPI domelem_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domelem *This = impl_from_IXMLDOMElement( iface ); domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI domelem_get_previousSibling( static HRESULT WINAPI domelem_get_previousSibling(

View File

@ -251,7 +251,10 @@ static HRESULT WINAPI entityref_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
entityref *This = impl_from_IXMLDOMEntityReference( iface ); entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI entityref_get_lastChild( static HRESULT WINAPI entityref_get_lastChild(
@ -259,7 +262,10 @@ static HRESULT WINAPI entityref_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
entityref *This = impl_from_IXMLDOMEntityReference( iface ); entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI entityref_get_previousSibling( static HRESULT WINAPI entityref_get_previousSibling(

View File

@ -164,6 +164,8 @@ extern HRESULT node_get_content(xmlnode*,VARIANT*);
extern HRESULT node_put_value(xmlnode*,VARIANT*); extern HRESULT node_put_value(xmlnode*,VARIANT*);
extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**); extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**); extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**);
extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**);
extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document); extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);
@ -200,6 +202,14 @@ static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
return S_OK; return S_OK;
} }
static inline HRESULT return_null_node(IXMLDOMNode **p)
{
if(!p)
return E_INVALIDARG;
*p = NULL;
return S_FALSE;
}
#endif #endif
void* libxslt_handle; void* libxslt_handle;

View File

@ -313,38 +313,30 @@ static HRESULT WINAPI xmlnode_get_childNodes(
return E_NOTIMPL; return E_NOTIMPL;
} }
HRESULT node_get_first_child(xmlnode *This, IXMLDOMNode **ret)
{
return get_node(This, "firstChild", This->node->children, ret);
}
static HRESULT WINAPI xmlnode_get_firstChild( static HRESULT WINAPI xmlnode_get_firstChild(
IXMLDOMNode *iface, IXMLDOMNode *iface,
IXMLDOMNode** firstChild) IXMLDOMNode** firstChild)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface ); ERR("Should not be called\n");
TRACE("(%p)->(%p)\n", This, firstChild); return E_NOTIMPL;
return get_node( This, "firstChild", This->node->children, firstChild ); }
HRESULT node_get_last_child(xmlnode *This, IXMLDOMNode **ret)
{
return get_node(This, "lastChild", This->node->last, ret);
} }
static HRESULT WINAPI xmlnode_get_lastChild( static HRESULT WINAPI xmlnode_get_lastChild(
IXMLDOMNode *iface, IXMLDOMNode *iface,
IXMLDOMNode** lastChild) IXMLDOMNode** lastChild)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface ); ERR("Should not be called\n");
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, lastChild );
if (!lastChild)
return E_INVALIDARG;
switch( This->node->type )
{
/* CDATASection, Comment, PI and Text Nodes do not support lastChild */
case XML_TEXT_NODE:
case XML_CDATA_SECTION_NODE:
case XML_PI_NODE:
case XML_COMMENT_NODE:
*lastChild = NULL;
return S_FALSE;
default:
return get_node( This, "lastChild", This->node->last, lastChild );
}
} }
static HRESULT WINAPI xmlnode_get_previousSibling( static HRESULT WINAPI xmlnode_get_previousSibling(
@ -1838,7 +1830,10 @@ static HRESULT WINAPI unknode_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
unknode *This = impl_from_unkIXMLDOMNode( iface ); unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI unknode_get_lastChild( static HRESULT WINAPI unknode_get_lastChild(
@ -1846,7 +1841,10 @@ static HRESULT WINAPI unknode_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
unknode *This = impl_from_unkIXMLDOMNode( iface ); unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return node_get_first_child(&This->node, domNode);
} }
static HRESULT WINAPI unknode_get_previousSibling( static HRESULT WINAPI unknode_get_previousSibling(

View File

@ -266,7 +266,10 @@ static HRESULT WINAPI dom_pi_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI dom_pi_get_lastChild( static HRESULT WINAPI dom_pi_get_lastChild(
@ -274,7 +277,10 @@ static HRESULT WINAPI dom_pi_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI dom_pi_get_previousSibling( static HRESULT WINAPI dom_pi_get_previousSibling(

View File

@ -266,7 +266,10 @@ static HRESULT WINAPI domtext_get_firstChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domtext *This = impl_from_IXMLDOMText( iface ); domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domtext_get_lastChild( static HRESULT WINAPI domtext_get_lastChild(
@ -274,7 +277,10 @@ static HRESULT WINAPI domtext_get_lastChild(
IXMLDOMNode** domNode) IXMLDOMNode** domNode)
{ {
domtext *This = impl_from_IXMLDOMText( iface ); domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(&This->node), domNode );
TRACE("(%p)->(%p)\n", This, domNode);
return return_null_node(domNode);
} }
static HRESULT WINAPI domtext_get_previousSibling( static HRESULT WINAPI domtext_get_previousSibling(