summaryrefslogtreecommitdiffstats
path: root/dom/html/nsIHTMLCollection.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/html/nsIHTMLCollection.h
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/html/nsIHTMLCollection.h')
-rw-r--r--dom/html/nsIHTMLCollection.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/dom/html/nsIHTMLCollection.h b/dom/html/nsIHTMLCollection.h
new file mode 100644
index 0000000000..17d0c1fbcf
--- /dev/null
+++ b/dom/html/nsIHTMLCollection.h
@@ -0,0 +1,87 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsIHTMLCollection_h___
+#define nsIHTMLCollection_h___
+
+#include "nsISupports.h"
+#include "nsStringFwd.h"
+#include "nsTArrayForwardDeclare.h"
+#include "nsWrapperCache.h"
+#include "js/TypeDecls.h"
+
+class nsINode;
+
+namespace mozilla::dom {
+class Element;
+} // namespace mozilla::dom
+
+// IID for the nsIHTMLCollection interface
+#define NS_IHTMLCOLLECTION_IID \
+ { \
+ 0x4e169191, 0x5196, 0x4e17, { \
+ 0xa4, 0x79, 0xd5, 0x35, 0x0b, 0x5b, 0x0a, 0xcd \
+ } \
+ }
+
+/**
+ * An internal interface
+ */
+class nsIHTMLCollection : public nsISupports {
+ public:
+ NS_DECLARE_STATIC_IID_ACCESSOR(NS_IHTMLCOLLECTION_IID)
+
+ /**
+ * Get the root node for this HTML collection.
+ */
+ virtual nsINode* GetParentObject() = 0;
+
+ virtual uint32_t Length() = 0;
+ virtual mozilla::dom::Element* GetElementAt(uint32_t index) = 0;
+ mozilla::dom::Element* Item(uint32_t index) { return GetElementAt(index); }
+ mozilla::dom::Element* IndexedGetter(uint32_t index, bool& aFound) {
+ mozilla::dom::Element* item = Item(index);
+ aFound = !!item;
+ return item;
+ }
+ mozilla::dom::Element* NamedItem(const nsAString& aName) {
+ bool dummy;
+ return NamedGetter(aName, dummy);
+ }
+ mozilla::dom::Element* NamedGetter(const nsAString& aName, bool& aFound) {
+ return GetFirstNamedElement(aName, aFound);
+ }
+ virtual mozilla::dom::Element* GetFirstNamedElement(const nsAString& aName,
+ bool& aFound) = 0;
+
+ virtual void GetSupportedNames(nsTArray<nsString>& aNames) = 0;
+
+ JSObject* GetWrapperPreserveColor() {
+ return GetWrapperPreserveColorInternal();
+ }
+ JSObject* GetWrapper() {
+ JSObject* obj = GetWrapperPreserveColor();
+ if (obj) {
+ JS::ExposeObjectToActiveJS(obj);
+ }
+ return obj;
+ }
+ void PreserveWrapper(nsISupports* aScriptObjectHolder) {
+ PreserveWrapperInternal(aScriptObjectHolder);
+ }
+ virtual JSObject* WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) = 0;
+
+ protected:
+ // Hook for calling nsWrapperCache::GetWrapperPreserveColor.
+ virtual JSObject* GetWrapperPreserveColorInternal() = 0;
+ // Hook for calling nsWrapperCache::PreserveWrapper.
+ virtual void PreserveWrapperInternal(nsISupports* aScriptObjectHolder) = 0;
+};
+
+NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCollection, NS_IHTMLCOLLECTION_IID)
+
+#endif /* nsIHTMLCollection_h___ */