2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-07-22 04:38:52 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Implementation of DOM Traversal's nsIDOMTreeWalker
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsTraversal_h___
|
|
|
|
#define nsTraversal_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2014-08-18 18:44:50 +04:00
|
|
|
#include "nsIDocument.h" // for NodeFilterHolder
|
2013-02-27 00:10:15 +04:00
|
|
|
#include "mozilla/dom/CallbackObject.h"
|
2013-02-28 21:56:42 +04:00
|
|
|
#include "mozilla/ErrorResult.h"
|
|
|
|
#include "mozilla/dom/NodeFilterBinding.h"
|
|
|
|
#include "nsIDOMNodeFilter.h"
|
2008-07-22 04:38:52 +04:00
|
|
|
|
|
|
|
class nsINode;
|
|
|
|
|
|
|
|
class nsTraversal
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsTraversal(nsINode *aRoot,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aWhatToShow,
|
2013-02-27 00:10:15 +04:00
|
|
|
const mozilla::dom::NodeFilterHolder &aFilter);
|
2008-07-22 04:38:52 +04:00
|
|
|
virtual ~nsTraversal();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsINode> mRoot;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mWhatToShow;
|
2013-02-27 00:10:15 +04:00
|
|
|
mozilla::dom::NodeFilterHolder mFilter;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInAcceptNode;
|
2008-07-22 04:38:52 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Tests if and how a node should be filtered. Uses mWhatToShow and
|
|
|
|
* mFilter to test the node.
|
|
|
|
* @param aNode Node to test
|
2013-02-28 21:56:42 +04:00
|
|
|
* @param aResult Whether we succeeded
|
|
|
|
* @returns Filtervalue. See nsIDOMNodeFilter.idl
|
2008-07-22 04:38:52 +04:00
|
|
|
*/
|
2013-02-28 21:56:42 +04:00
|
|
|
int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult);
|
2008-07-22 04:38:52 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|