content/html/document/src/HTMLAllCollection.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/html/document/src/HTMLAllCollection.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef mozilla_dom_HTMLAllCollection_h
    1.11 +#define mozilla_dom_HTMLAllCollection_h
    1.12 +
    1.13 +#include "js/RootingAPI.h"
    1.14 +#include "nsAutoPtr.h"
    1.15 +#include "nsCycleCollectionParticipant.h"
    1.16 +#include "nsISupportsImpl.h"
    1.17 +#include "nsRefPtrHashtable.h"
    1.18 +
    1.19 +#include <stdint.h>
    1.20 +
    1.21 +class nsContentList;
    1.22 +class nsHTMLDocument;
    1.23 +class nsIContent;
    1.24 +class nsWrapperCache;
    1.25 +
    1.26 +namespace mozilla {
    1.27 +class ErrorResult;
    1.28 +
    1.29 +namespace dom {
    1.30 +
    1.31 +class HTMLAllCollection
    1.32 +{
    1.33 +public:
    1.34 +  HTMLAllCollection(nsHTMLDocument* aDocument);
    1.35 +  ~HTMLAllCollection();
    1.36 +
    1.37 +  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(HTMLAllCollection)
    1.38 +  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(HTMLAllCollection)
    1.39 +
    1.40 +  uint32_t Length();
    1.41 +  nsIContent* Item(uint32_t aIndex);
    1.42 +
    1.43 +  JSObject* GetObject(JSContext* aCx, ErrorResult& aRv);
    1.44 +
    1.45 +  nsISupports* GetNamedItem(const nsAString& aID, nsWrapperCache** aCache);
    1.46 +
    1.47 +private:
    1.48 +  nsContentList* Collection();
    1.49 +
    1.50 +  /**
    1.51 +   * Returns the NodeList for document.all[aID], or null if there isn't one.
    1.52 +   */
    1.53 +  nsContentList* GetDocumentAllList(const nsAString& aID);
    1.54 +
    1.55 +  JS::Heap<JSObject*> mObject;
    1.56 +  nsRefPtr<nsHTMLDocument> mDocument;
    1.57 +  nsRefPtr<nsContentList> mCollection;
    1.58 +  nsRefPtrHashtable<nsStringHashKey, nsContentList> mNamedMap;
    1.59 +};
    1.60 +
    1.61 +} // namespace dom
    1.62 +} // namespace mozilla
    1.63 +
    1.64 +#endif // mozilla_dom_HTMLAllCollection_h

mercurial