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