mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1434819 part 4. Remove all the methods from nsIDOMTreeWalker. r=qdot
MozReview-Commit-ID: BDxOLArlCYb
This commit is contained in:
parent
7946bcf30a
commit
8ee1ab7d50
@ -55,56 +55,6 @@ NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(dom::TreeWalker)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(dom::TreeWalker)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* nsIDOMTreeWalker Getters/Setters
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP TreeWalker::GetRoot(nsIDOMNode * *aRoot)
|
||||
{
|
||||
NS_ADDREF(*aRoot = Root()->AsDOMNode());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::GetWhatToShow(uint32_t *aWhatToShow)
|
||||
{
|
||||
*aWhatToShow = WhatToShow();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFilter);
|
||||
|
||||
*aFilter = mFilter.ToXPCOMCallback().take();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::GetCurrentNode(nsIDOMNode * *aCurrentNode)
|
||||
{
|
||||
if (mCurrentNode) {
|
||||
return CallQueryInterface(mCurrentNode, aCurrentNode);
|
||||
}
|
||||
|
||||
*aCurrentNode = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP TreeWalker::SetCurrentNode(nsIDOMNode * aCurrentNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCurrentNode, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
||||
NS_ENSURE_TRUE(mRoot, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aCurrentNode);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
|
||||
|
||||
ErrorResult rv;
|
||||
SetCurrentNode(*node, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
void
|
||||
TreeWalker::SetCurrentNode(nsINode& aNode, ErrorResult& aResult)
|
||||
{
|
||||
@ -116,15 +66,6 @@ TreeWalker::SetCurrentNode(nsINode& aNode, ErrorResult& aResult)
|
||||
mCurrentNode = &aNode;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsIDOMTreeWalker functions
|
||||
*/
|
||||
|
||||
NS_IMETHODIMP TreeWalker::ParentNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::ParentNode, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::ParentNode(ErrorResult& aResult)
|
||||
{
|
||||
@ -148,55 +89,30 @@ TreeWalker::ParentNode(ErrorResult& aResult)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::FirstChild(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::FirstChild, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::FirstChild(ErrorResult& aResult)
|
||||
{
|
||||
return FirstChildInternal(false, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::LastChild(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::LastChild, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::LastChild(ErrorResult& aResult)
|
||||
{
|
||||
return FirstChildInternal(true, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::PreviousSibling(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::PreviousSibling, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::PreviousSibling(ErrorResult& aResult)
|
||||
{
|
||||
return NextSiblingInternal(true, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::NextSibling(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::NextSibling, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::NextSibling(ErrorResult& aResult)
|
||||
{
|
||||
return NextSiblingInternal(false, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::PreviousNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::PreviousNode, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::PreviousNode(ErrorResult& aResult)
|
||||
{
|
||||
@ -250,11 +166,6 @@ TreeWalker::PreviousNode(ErrorResult& aResult)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP TreeWalker::NextNode(nsIDOMNode **_retval)
|
||||
{
|
||||
return ImplNodeGetter(&TreeWalker::NextNode, _retval);
|
||||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
TreeWalker::NextNode(ErrorResult& aResult)
|
||||
{
|
||||
|
@ -89,19 +89,6 @@ private:
|
||||
*/
|
||||
already_AddRefed<nsINode> NextSiblingInternal(bool aReversed,
|
||||
ErrorResult& aResult);
|
||||
|
||||
// Implementation for our various XPCOM getters
|
||||
typedef already_AddRefed<nsINode> (TreeWalker::*NodeGetter)(ErrorResult&);
|
||||
inline nsresult ImplNodeGetter(NodeGetter aGetter, nsIDOMNode** aRetval)
|
||||
{
|
||||
mozilla::ErrorResult rv;
|
||||
nsCOMPtr<nsINode> node = (this->*aGetter)(rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
*aRetval = node ? node.forget().take()->AsDOMNode() : nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -11,17 +11,4 @@ interface nsIDOMNodeFilter;
|
||||
[uuid(c4ffa159-237c-4dde-b0ba-20b9f9270cf6)]
|
||||
// Introduced in DOM Level 2:
|
||||
interface nsIDOMTreeWalker : nsISupports {
|
||||
readonly attribute nsIDOMNode root;
|
||||
readonly attribute unsigned long whatToShow;
|
||||
readonly attribute nsIDOMNodeFilter filter;
|
||||
attribute nsIDOMNode currentNode;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
nsIDOMNode parentNode();
|
||||
nsIDOMNode firstChild();
|
||||
nsIDOMNode lastChild();
|
||||
nsIDOMNode previousSibling();
|
||||
nsIDOMNode nextSibling();
|
||||
nsIDOMNode previousNode();
|
||||
nsIDOMNode nextNode();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user