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