2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef HTMLDocument_h
24 #define HTMLDocument_h
26 #include "CachedResourceClient.h"
28 #include <wtf/HashCountedSet.h>
32 class HTMLDocument : public Document, public CachedResourceClient {
34 static Ref<HTMLDocument> create(Frame* frame, const URL& url)
36 return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass));
39 static Ref<HTMLDocument> createSynthesizedDocument(Frame* frame, const URL& url)
41 return adoptRef(*new HTMLDocument(frame, url, HTMLDocumentClass, Synthesized));
44 virtual ~HTMLDocument();
49 const AtomicString& dir() const;
50 void setDir(const AtomicString&);
52 String designMode() const;
53 void setDesignMode(const String&);
55 const AtomicString& bgColor() const;
56 void setBgColor(const String&);
57 const AtomicString& fgColor() const;
58 void setFgColor(const String&);
59 const AtomicString& alinkColor() const;
60 void setAlinkColor(const String&);
61 const AtomicString& linkColor() const;
62 void setLinkColor(const String&);
63 const AtomicString& vlinkColor() const;
64 void setVlinkColor(const String&);
71 Element* documentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.getElementByDocumentNamedItem(name, *this); }
72 bool hasDocumentNamedItem(const AtomicStringImpl& name) const { return m_documentNamedItem.contains(name); }
73 bool documentNamedItemContainsMultipleElements(const AtomicStringImpl& name) const { return m_documentNamedItem.containsMultiple(name); }
74 void addDocumentNamedItem(const AtomicStringImpl&, Element&);
75 void removeDocumentNamedItem(const AtomicStringImpl&, Element&);
77 Element* windowNamedItem(const AtomicStringImpl& name) const { return m_windowNamedItem.getElementByWindowNamedItem(name, *this); }
78 bool hasWindowNamedItem(const AtomicStringImpl& name) const { return m_windowNamedItem.contains(name); }
79 bool windowNamedItemContainsMultipleElements(const AtomicStringImpl& name) const { return m_windowNamedItem.containsMultiple(name); }
80 void addWindowNamedItem(const AtomicStringImpl&, Element&);
81 void removeWindowNamedItem(const AtomicStringImpl&, Element&);
83 static bool isCaseSensitiveAttribute(const QualifiedName&);
86 HTMLDocument(Frame*, const URL&, DocumentClassFlags = 0, unsigned constructionFlags = 0);
89 virtual bool isFrameSet() const override;
90 virtual Ref<DocumentParser> createParser() override;
91 virtual Ref<Document> cloneDocumentWithoutChildren() const override final;
93 DocumentOrderedMap m_documentNamedItem;
94 DocumentOrderedMap m_windowNamedItem;
97 } // namespace WebCore
99 SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLDocument)
100 static bool isType(const WebCore::Document& document) { return document.isHTMLDocument(); }
101 static bool isType(const WebCore::Node& node) { return is<WebCore::Document>(node) && isType(downcast<WebCore::Document>(node)); }
102 SPECIALIZE_TYPE_TRAITS_END()
104 #endif // HTMLDocument_h