Files
sousa-gecko/dom/base/NodeList.h
T
Emilio Cobos Álvarez 1ddad57128 Bug 2034055 - Clean up NodeList / HTMLCollection set-up. r=smaug
Make them concrete classes rather than interfaces, and make the
inheritance chain simpler.

Differential Revision: https://phabricator.services.mozilla.com/D296484
2026-04-28 07:38:27 +00:00

45 lines
1.1 KiB
C++

/* 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 mozilla_dom_NodeList_h_
#define mozilla_dom_NodeList_h_
#include "nsIContent.h"
#include "nsISupports.h"
#include "nsWrapperCache.h"
class nsIContent;
class nsINode;
namespace mozilla::dom {
/**
* An internal interface for a reasonably fast indexOf.
*/
class NodeList : public nsISupports, public nsWrapperCache {
public:
/**
* Get the index of the given node in the list. Will return -1 if the node
* is not in the list.
*/
virtual int32_t IndexOf(nsIContent* aContent) = 0;
/**
* Get the root node for this nodelist.
*/
virtual nsINode* GetParentObject() = 0;
virtual uint32_t Length() = 0;
virtual nsIContent* Item(uint32_t aIndex) = 0;
nsIContent* IndexedGetter(uint32_t aIndex, bool& aFound) {
nsIContent* item = Item(aIndex);
aFound = !!item;
return item;
}
};
} // namespace mozilla::dom
#endif // mozilla_dom_NodeList_h_