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/. */
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2008-07-22 04:38:52 +04:00
|
|
|
/*
|
2018-02-01 22:26:12 +03:00
|
|
|
* Implementation of common traversal methods for TreeWalker and NodeIterator.
|
2008-07-22 04:38:52 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsTraversal_h___
|
|
|
|
#define nsTraversal_h___
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2013-02-27 00:10:15 +04:00
|
|
|
#include "mozilla/dom/CallbackObject.h"
|
2013-02-28 21:56:42 +04:00
|
|
|
#include "mozilla/dom/NodeFilterBinding.h"
|
2008-07-22 04:38:52 +04:00
|
|
|
|
|
|
|
class nsINode;
|
|
|
|
|
2020-11-23 19:12:02 +03:00
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
}
|
|
|
|
|
2008-07-22 04:38:52 +04:00
|
|
|
class nsTraversal {
|
|
|
|
public:
|
|
|
|
nsTraversal(nsINode* aRoot, uint32_t aWhatToShow,
|
2018-02-01 22:26:12 +03:00
|
|
|
mozilla::dom::NodeFilter* aFilter);
|
2008-07-22 04:38:52 +04:00
|
|
|
virtual ~nsTraversal();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2008-07-22 04:38:52 +04:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsINode> mRoot;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mWhatToShow;
|
2018-02-01 22:26:12 +03:00
|
|
|
RefPtr<mozilla::dom::NodeFilter> mFilter;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInAcceptNode;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
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.
|
2019-11-14 20:29:27 +03:00
|
|
|
* @param aNode Node to test
|
|
|
|
* @param aResult Whether we succeeded
|
|
|
|
* @param aUnskippedNode If non-null is passed, set to aNode if node isn't
|
|
|
|
* filtered out by mWhatToShow.
|
|
|
|
* @returns Filtervalue. See NodeFilter.webidl
|
2008-07-22 04:38:52 +04:00
|
|
|
*/
|
2019-11-14 20:29:27 +03:00
|
|
|
int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult,
|
|
|
|
nsCOMPtr<nsINode>* aUnskippedNode = nullptr);
|
2008-07-22 04:38:52 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|