michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_HTMLAllCollection_h michael@0: #define mozilla_dom_HTMLAllCollection_h michael@0: michael@0: #include "js/RootingAPI.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsISupportsImpl.h" michael@0: #include "nsRefPtrHashtable.h" michael@0: michael@0: #include michael@0: michael@0: class nsContentList; michael@0: class nsHTMLDocument; michael@0: class nsIContent; michael@0: class nsWrapperCache; michael@0: michael@0: namespace mozilla { michael@0: class ErrorResult; michael@0: michael@0: namespace dom { michael@0: michael@0: class HTMLAllCollection michael@0: { michael@0: public: michael@0: HTMLAllCollection(nsHTMLDocument* aDocument); michael@0: ~HTMLAllCollection(); michael@0: michael@0: NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(HTMLAllCollection) michael@0: NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(HTMLAllCollection) michael@0: michael@0: uint32_t Length(); michael@0: nsIContent* Item(uint32_t aIndex); michael@0: michael@0: JSObject* GetObject(JSContext* aCx, ErrorResult& aRv); michael@0: michael@0: nsISupports* GetNamedItem(const nsAString& aID, nsWrapperCache** aCache); michael@0: michael@0: private: michael@0: nsContentList* Collection(); michael@0: michael@0: /** michael@0: * Returns the NodeList for document.all[aID], or null if there isn't one. michael@0: */ michael@0: nsContentList* GetDocumentAllList(const nsAString& aID); michael@0: michael@0: JS::Heap mObject; michael@0: nsRefPtr mDocument; michael@0: nsRefPtr mCollection; michael@0: nsRefPtrHashtable mNamedMap; michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: #endif // mozilla_dom_HTMLAllCollection_h