HTMLAllCollection.h [plain text]
#pragma once
#include "AllDescendantsCollection.h"
namespace WebCore {
class HTMLAllCollection final : public AllDescendantsCollection {
public:
static Ref<HTMLAllCollection> create(Document&, CollectionType);
Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedOrIndexedItemOrItems(const AtomString& nameOrIndex) const;
Optional<Variant<RefPtr<HTMLCollection>, RefPtr<Element>>> namedItemOrItems(const AtomString&) const;
private:
HTMLAllCollection(Document&, CollectionType);
};
static_assert(sizeof(HTMLAllCollection) == sizeof(AllDescendantsCollection), "");
class HTMLAllNamedSubCollection final : public CachedHTMLCollection<HTMLAllNamedSubCollection, CollectionTraversalType::Descendants> {
WTF_MAKE_ISO_ALLOCATED(HTMLAllNamedSubCollection);
public:
static Ref<HTMLAllNamedSubCollection> create(Document& document, CollectionType type, const AtomString& name)
{
return adoptRef(*new HTMLAllNamedSubCollection(document, type, name));
}
virtual ~HTMLAllNamedSubCollection();
bool elementMatches(Element&) const;
private:
HTMLAllNamedSubCollection(Document& document, CollectionType type, const AtomString& name)
: CachedHTMLCollection(document, type)
, m_name(name)
{
ASSERT(type == DocumentAllNamedItems);
}
AtomString m_name;
};
}
SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(HTMLAllCollection, DocAll)
SPECIALIZE_TYPE_TRAITS_HTMLCOLLECTION(HTMLAllNamedSubCollection, DocumentAllNamedItems)