1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/src/nsTraversal.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,48 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +/* 1.11 + * Implementation of DOM Traversal's nsIDOMTreeWalker 1.12 + */ 1.13 + 1.14 +#ifndef nsTraversal_h___ 1.15 +#define nsTraversal_h___ 1.16 + 1.17 +#include "nsCOMPtr.h" 1.18 +#include "nsIDocument.h" 1.19 +#include "mozilla/dom/CallbackObject.h" 1.20 +#include "mozilla/ErrorResult.h" 1.21 +#include "mozilla/dom/NodeFilterBinding.h" 1.22 +#include "nsIDOMNodeFilter.h" 1.23 + 1.24 +class nsINode; 1.25 + 1.26 +class nsTraversal 1.27 +{ 1.28 +public: 1.29 + nsTraversal(nsINode *aRoot, 1.30 + uint32_t aWhatToShow, 1.31 + const mozilla::dom::NodeFilterHolder &aFilter); 1.32 + virtual ~nsTraversal(); 1.33 + 1.34 +protected: 1.35 + nsCOMPtr<nsINode> mRoot; 1.36 + uint32_t mWhatToShow; 1.37 + mozilla::dom::NodeFilterHolder mFilter; 1.38 + bool mInAcceptNode; 1.39 + 1.40 + /* 1.41 + * Tests if and how a node should be filtered. Uses mWhatToShow and 1.42 + * mFilter to test the node. 1.43 + * @param aNode Node to test 1.44 + * @param aResult Whether we succeeded 1.45 + * @returns Filtervalue. See nsIDOMNodeFilter.idl 1.46 + */ 1.47 + int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult); 1.48 +}; 1.49 + 1.50 +#endif 1.51 +