Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef mozilla_dom_HTMLAllCollection_h |
michael@0 | 8 | #define mozilla_dom_HTMLAllCollection_h |
michael@0 | 9 | |
michael@0 | 10 | #include "js/RootingAPI.h" |
michael@0 | 11 | #include "nsAutoPtr.h" |
michael@0 | 12 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 13 | #include "nsISupportsImpl.h" |
michael@0 | 14 | #include "nsRefPtrHashtable.h" |
michael@0 | 15 | |
michael@0 | 16 | #include <stdint.h> |
michael@0 | 17 | |
michael@0 | 18 | class nsContentList; |
michael@0 | 19 | class nsHTMLDocument; |
michael@0 | 20 | class nsIContent; |
michael@0 | 21 | class nsWrapperCache; |
michael@0 | 22 | |
michael@0 | 23 | namespace mozilla { |
michael@0 | 24 | class ErrorResult; |
michael@0 | 25 | |
michael@0 | 26 | namespace dom { |
michael@0 | 27 | |
michael@0 | 28 | class HTMLAllCollection |
michael@0 | 29 | { |
michael@0 | 30 | public: |
michael@0 | 31 | HTMLAllCollection(nsHTMLDocument* aDocument); |
michael@0 | 32 | ~HTMLAllCollection(); |
michael@0 | 33 | |
michael@0 | 34 | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(HTMLAllCollection) |
michael@0 | 35 | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(HTMLAllCollection) |
michael@0 | 36 | |
michael@0 | 37 | uint32_t Length(); |
michael@0 | 38 | nsIContent* Item(uint32_t aIndex); |
michael@0 | 39 | |
michael@0 | 40 | JSObject* GetObject(JSContext* aCx, ErrorResult& aRv); |
michael@0 | 41 | |
michael@0 | 42 | nsISupports* GetNamedItem(const nsAString& aID, nsWrapperCache** aCache); |
michael@0 | 43 | |
michael@0 | 44 | private: |
michael@0 | 45 | nsContentList* Collection(); |
michael@0 | 46 | |
michael@0 | 47 | /** |
michael@0 | 48 | * Returns the NodeList for document.all[aID], or null if there isn't one. |
michael@0 | 49 | */ |
michael@0 | 50 | nsContentList* GetDocumentAllList(const nsAString& aID); |
michael@0 | 51 | |
michael@0 | 52 | JS::Heap<JSObject*> mObject; |
michael@0 | 53 | nsRefPtr<nsHTMLDocument> mDocument; |
michael@0 | 54 | nsRefPtr<nsContentList> mCollection; |
michael@0 | 55 | nsRefPtrHashtable<nsStringHashKey, nsContentList> mNamedMap; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | } // namespace dom |
michael@0 | 59 | } // namespace mozilla |
michael@0 | 60 | |
michael@0 | 61 | #endif // mozilla_dom_HTMLAllCollection_h |