tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsTraversal.h (1454B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 /*
      8 * Implementation of common traversal methods for TreeWalker and NodeIterator.
      9 */
     10 
     11 #ifndef nsTraversal_h___
     12 #define nsTraversal_h___
     13 
     14 #include "mozilla/dom/CallbackObject.h"
     15 #include "mozilla/dom/NodeFilterBinding.h"
     16 #include "nsCOMPtr.h"
     17 
     18 class nsINode;
     19 
     20 namespace mozilla {
     21 class ErrorResult;
     22 }
     23 
     24 class nsTraversal {
     25 public:
     26  nsTraversal(nsINode* aRoot, uint32_t aWhatToShow,
     27              mozilla::dom::NodeFilter* aFilter);
     28  virtual ~nsTraversal();
     29 
     30 protected:
     31  nsCOMPtr<nsINode> mRoot;
     32  uint32_t mWhatToShow;
     33  RefPtr<mozilla::dom::NodeFilter> mFilter;
     34  bool mInAcceptNode;
     35 
     36  /*
     37   * Tests if and how a node should be filtered. Uses mWhatToShow and
     38   * mFilter to test the node.
     39   * @param aNode          Node to test
     40   * @param aResult        Whether we succeeded
     41   * @param aUnskippedNode If non-null is passed, set to aNode if node isn't
     42   *                       filtered out by mWhatToShow.
     43   * @returns              Filtervalue. See NodeFilter.webidl
     44   */
     45  int16_t TestNode(nsINode* aNode, mozilla::ErrorResult& aResult,
     46                   nsCOMPtr<nsINode>* aUnskippedNode = nullptr);
     47 };
     48 
     49 #endif