#pragma once
#include "Document.h"
namespace WebCore {
class HTMLDocument : public Document {
WTF_MAKE_ISO_ALLOCATED(HTMLDocument);
public:
static Ref<HTMLDocument> create(Frame* frame, const URL& url)
{
return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass));
}
static Ref<HTMLDocument> createSynthesizedDocument(Frame* frame, const URL& url)
{
return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass, Synthesized));
}
virtual ~HTMLDocument();
WEBCORE_EXPORT int width();
WEBCORE_EXPORT int height();
std::optional<Variant<RefPtr<WindowProxy>, RefPtr<Element>, RefPtr<HTMLCollection>>> namedItem(const AtomicString&);
Vector<AtomicString> supportedPropertyNames() const;
Element* documentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.getElementByDocumentNamedItem(name, *this); }
bool hasDocumentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.contains(name); }
bool documentNamedItemContainsMultipleElements(const AtomicStringImpl& name) const { return m_documentNamedItem.containsMultiple(name); }
void addDocumentNamedItem(const AtomicStringImpl&, Element&);
void removeDocumentNamedItem(const AtomicStringImpl&, Element&);
Element* windowNamedItem(const AtomicStringImpl& name) const { return m_windowNamedItem.getElementByWindowNamedItem(name, *this); }
bool hasWindowNamedItem(const AtomicStringImpl& name) const { return m_windowNamedItem.contains(name); }
bool windowNamedItemContainsMultipleElements(const AtomicStringImpl& name) const { return m_windowNamedItem.containsMultiple(name); }
void addWindowNamedItem(const AtomicStringImpl&, Element&);
void removeWindowNamedItem(const AtomicStringImpl&, Element&);
static bool isCaseSensitiveAttribute(const QualifiedName&);
protected:
HTMLDocument(Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);
private:
bool isFrameSet() const override;
Ref<DocumentParser> createParser() override;
Ref<Document> cloneDocumentWithoutChildren() const final;
TreeScopeOrderedMap m_documentNamedItem;
TreeScopeOrderedMap m_windowNamedItem;
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLDocument)
static bool isType(const WebCore::Document& document) { return document.isHTMLDocument(); }
static bool isType(const WebCore::Node& node) { return is<WebCore::Document>(node) && isType(downcast<WebCore::Document>(node)); }
SPECIALIZE_TYPE_TRAITS_END()