DocumentStyleRootIterator.h (1271B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef DocumentStyleRootIterator_h 8 #define DocumentStyleRootIterator_h 9 10 #include "nsTArray.h" 11 12 class nsIContent; 13 14 class nsINode; 15 16 namespace mozilla { 17 18 namespace dom { 19 class Element; 20 } // namespace dom 21 22 /** 23 * DocumentStyleRootIterator traverses the roots of the document from the 24 * perspective of the Servo-backed style system. In the general case, this 25 * will first traverse the document root, followed by any document level 26 * native anonymous content. 27 * 28 * If the caller passes an element to the constructor rather than the document, 29 * that element (and nothing else) is returned from GetNextStyleRoot. 30 */ 31 class DocumentStyleRootIterator { 32 public: 33 explicit DocumentStyleRootIterator(nsINode* aStyleRoot); 34 MOZ_COUNTED_DTOR(DocumentStyleRootIterator) 35 36 dom::Element* GetNextStyleRoot(); 37 38 private: 39 AutoTArray<nsIContent*, 8> mStyleRoots; 40 uint32_t mPosition; 41 }; 42 43 } // namespace mozilla 44 45 #endif // DocumentStyleRootIterator_h