• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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.
5  *
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.
10  *
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.
15  *
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.
20  *
21  */
22 
23 #ifndef HTMLDocument_h
24 #define HTMLDocument_h
25 
26 #include "core/dom/Document.h"
27 #include "core/fetch/ResourceClient.h"
28 #include "wtf/HashCountedSet.h"
29 
30 namespace WebCore {
31 
32 class FrameView;
33 class HTMLBodyElement;
34 class HTMLElement;
35 
36 class HTMLDocument : public Document, public ResourceClient {
37 public:
38     static PassRefPtrWillBeRawPtr<HTMLDocument> create(const DocumentInit& initializer = DocumentInit())
39     {
40         return adoptRefWillBeNoop(new HTMLDocument(initializer));
41     }
42     virtual ~HTMLDocument();
43 
44     const AtomicString& bgColor() const;
45     void setBgColor(const AtomicString&);
46     const AtomicString& fgColor() const;
47     void setFgColor(const AtomicString&);
48     const AtomicString& alinkColor() const;
49     void setAlinkColor(const AtomicString&);
50     const AtomicString& linkColor() const;
51     void setLinkColor(const AtomicString&);
52     const AtomicString& vlinkColor() const;
53     void setVlinkColor(const AtomicString&);
54 
clear()55     void clear() { }
56 
captureEvents()57     void captureEvents() { }
releaseEvents()58     void releaseEvents() { }
59 
60     void addNamedItem(const AtomicString& name);
61     void removeNamedItem(const AtomicString& name);
62     bool hasNamedItem(const AtomicString& name);
63 
64     void addExtraNamedItem(const AtomicString& name);
65     void removeExtraNamedItem(const AtomicString& name);
66     bool hasExtraNamedItem(const AtomicString& name);
67 
68     using Document::write;
69     using Document::writeln;
70     void write(LocalDOMWindow*, const Vector<String>& text, ExceptionState&);
71     void writeln(LocalDOMWindow*, const Vector<String>& text, ExceptionState&);
72 
73     static bool isCaseSensitiveAttribute(const QualifiedName&);
74 
75     virtual PassRefPtrWillBeRawPtr<Document> cloneDocumentWithoutChildren() OVERRIDE FINAL;
76 
77 protected:
78     HTMLDocument(const DocumentInit&, DocumentClassFlags extendedDocumentClasses = DefaultDocumentClass);
79 
80 private:
81     HTMLBodyElement* htmlBodyElement() const;
82 
83     const AtomicString& bodyAttributeValue(const QualifiedName&) const;
84     void setBodyAttribute(const QualifiedName&, const AtomicString&);
85 
86     void addItemToMap(HashCountedSet<AtomicString>&, const AtomicString&);
87     void removeItemFromMap(HashCountedSet<AtomicString>&, const AtomicString&);
88 
89     HashCountedSet<AtomicString> m_namedItemCounts;
90     HashCountedSet<AtomicString> m_extraNamedItemCounts;
91 };
92 
hasNamedItem(const AtomicString & name)93 inline bool HTMLDocument::hasNamedItem(const AtomicString& name)
94 {
95     return m_namedItemCounts.contains(name);
96 }
97 
hasExtraNamedItem(const AtomicString & name)98 inline bool HTMLDocument::hasExtraNamedItem(const AtomicString& name)
99 {
100     return m_extraNamedItemCounts.contains(name);
101 }
102 
103 DEFINE_DOCUMENT_TYPE_CASTS(HTMLDocument);
104 
105 } // namespace WebCore
106 
107 #endif // HTMLDocument_h
108