tor-browser

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

inDeepTreeWalker.h (1704B)


      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 #ifndef __inDeepTreeWalker_h___
      8 #define __inDeepTreeWalker_h___
      9 
     10 #include "inIDeepTreeWalker.h"
     11 #include "nsCOMPtr.h"
     12 #include "nsINode.h"
     13 #include "nsTArray.h"
     14 
     15 class nsINodeList;
     16 
     17 class inDeepTreeWalker final : public inIDeepTreeWalker {
     18 public:
     19  NS_DECL_ISUPPORTS
     20  NS_DECL_INIDEEPTREEWALKER
     21 
     22  inDeepTreeWalker();
     23 
     24  using ChildList = AutoTArray<RefPtr<nsINode>, 8>;
     25  void GetChildren(nsINode& aParent, ChildList&);
     26 
     27 protected:
     28  virtual ~inDeepTreeWalker();
     29 
     30  already_AddRefed<nsINode> GetParent();
     31  nsresult EdgeChild(nsINode** _retval, bool aReverse);
     32 
     33  bool mShowAnonymousContent = false;
     34  bool mShowSubDocuments = false;
     35  bool mShowDocumentsAsNodes = false;
     36 
     37  // The root node. previousNode and parentNode will return
     38  // null from here.
     39  nsCOMPtr<nsINode> mRoot;
     40  nsCOMPtr<nsINode> mCurrentNode;
     41 
     42  // We cache the siblings of mCurrentNode as a list of nodes.
     43  // Notes: normally siblings are all the children of the parent
     44  // of mCurrentNode (that are interesting for use for the walk)
     45  // and mCurrentIndex is the index of mCurrentNode in that list
     46  ChildList mSiblings;
     47 
     48  // Index of mCurrentNode in the mSiblings list.
     49  int32_t mCurrentIndex = -1;
     50 };
     51 
     52 // {BFCB82C2-5611-4318-90D6-BAF4A7864252}
     53 #define IN_DEEPTREEWALKER_CID \
     54  {0xbfcb82c2, 0x5611, 0x4318, {0x90, 0xd6, 0xba, 0xf4, 0xa7, 0x86, 0x42, 0x52}}
     55 
     56 #endif  // __inDeepTreeWalker_h___