Skip to content
Permalink
Browse files
Some WebKit DOMNode API is unimplemented.
https://bugs.webkit.org/show_bug.cgi?id=35554

Reviewed by Alice Liu.

* DOMCoreClasses.cpp:
(DOMNode::nextSibling):
Create a DOMNode to wrap m_node's next sibling, and assign it to the
out param 'result'.
(DOMNode::insertBefore):
Query for the DOMNode for newChild, and return early if we fail. Query
refChild for DOMNode. Call insertBefore(), passing the newChild's
WebCore node and refChild's WebCore node (if refChild is non-null). If
we successfully insert the child, fill the result out param with
newChild, ref it, and return S_OK. Otherwise, return E_FAIL.
(DOMNode::removeChild):
Query oldChild for DOMNode. If we fail, return E_FAIL. Call
removeChild(), passing the node's WebCore node. If this fails, return
E_FAIL. Otherwise, fill the result out param with oldChild, ref it, and
return S_OK.

Canonical link: https://commits.webkit.org/46699@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55398 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Jon Honeycutt committed Mar 2, 2010
1 parent 33fbd4f commit cd9ffd8d7d0799a7e45e2a3581c27ebb5d5a3b42
Showing 2 changed files with 76 additions and 12 deletions.
@@ -1,3 +1,26 @@
2010-03-01 Jon Honeycutt <jhoneycutt@apple.com>

Some WebKit DOMNode API is unimplemented.
https://bugs.webkit.org/show_bug.cgi?id=35554

Reviewed by Alice Liu.

* DOMCoreClasses.cpp:
(DOMNode::nextSibling):
Create a DOMNode to wrap m_node's next sibling, and assign it to the
out param 'result'.
(DOMNode::insertBefore):
Query for the DOMNode for newChild, and return early if we fail. Query
refChild for DOMNode. Call insertBefore(), passing the newChild's
WebCore node and refChild's WebCore node (if refChild is non-null). If
we successfully insert the child, fill the result out param with
newChild, ref it, and return S_OK. Otherwise, return E_FAIL.
(DOMNode::removeChild):
Query oldChild for DOMNode. If we fail, return E_FAIL. Call
removeChild(), passing the node's WebCore node. If this fails, return
E_FAIL. Otherwise, fill the result out param with oldChild, ref it, and
return S_OK.

2010-03-01 Jakob Petsovits <jpetsovits@rim.com>

Reviewed by Adam Barth.
@@ -184,10 +184,15 @@ HRESULT STDMETHODCALLTYPE DOMNode::previousSibling(
}

HRESULT STDMETHODCALLTYPE DOMNode::nextSibling(
/* [retval][out] */ IDOMNode** /*result*/)
/* [retval][out] */ IDOMNode** result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;
*result = 0;
if (!m_node)
return E_FAIL;
*result = DOMNode::createInstance(m_node->nextSibling());
return *result ? S_OK : E_FAIL;
}

HRESULT STDMETHODCALLTYPE DOMNode::attributes(
@@ -210,12 +215,31 @@ HRESULT STDMETHODCALLTYPE DOMNode::ownerDocument(
}

HRESULT STDMETHODCALLTYPE DOMNode::insertBefore(
/* [in] */ IDOMNode* /*newChild*/,
/* [in] */ IDOMNode* /*refChild*/,
/* [retval][out] */ IDOMNode** /*result*/)
/* [in] */ IDOMNode* newChild,
/* [in] */ IDOMNode* refChild,
/* [retval][out] */ IDOMNode** result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;

*result = 0;

if (!m_node)
return E_FAIL;

COMPtr<DOMNode> newChildNode(Query, newChild);
if (!newChildNode)
return E_FAIL;

COMPtr<DOMNode> refChildNode(Query, refChild);

ExceptionCode ec;
if (!m_node->insertBefore(newChildNode->node(), refChildNode ? refChildNode->node() : 0, ec))
return E_FAIL;

*result = newChild;
(*result)->AddRef();
return S_OK;
}

HRESULT STDMETHODCALLTYPE DOMNode::replaceChild(
@@ -228,11 +252,28 @@ HRESULT STDMETHODCALLTYPE DOMNode::replaceChild(
}

HRESULT STDMETHODCALLTYPE DOMNode::removeChild(
/* [in] */ IDOMNode* /*oldChild*/,
/* [retval][out] */ IDOMNode** /*result*/)
/* [in] */ IDOMNode* oldChild,
/* [retval][out] */ IDOMNode** result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;

*result = 0;

if (!m_node)
return E_FAIL;

COMPtr<DOMNode> oldChildNode(Query, oldChild);
if (!oldChildNode)
return E_FAIL;

ExceptionCode ec;
if (!m_node->removeChild(oldChildNode->node(), ec))
return E_FAIL;

*result = oldChild;
(*result)->AddRef();
return S_OK;
}

HRESULT STDMETHODCALLTYPE DOMNode::appendChild(

0 comments on commit cd9ffd8

Please sign in to comment.