| 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 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 "CachedResourceClient.h" |
|---|
| 27 | #include "Document.h" |
|---|
| 28 | |
|---|
| 29 | namespace WebCore { |
|---|
| 30 | |
|---|
| 31 | class FrameView; |
|---|
| 32 | class HTMLElement; |
|---|
| 33 | |
|---|
| 34 | class HTMLDocument : public Document, public CachedResourceClient { |
|---|
| 35 | public: |
|---|
| 36 | static PassRefPtr<HTMLDocument> create(Frame* frame) |
|---|
| 37 | { |
|---|
| 38 | return new HTMLDocument(frame); |
|---|
| 39 | } |
|---|
| 40 | virtual ~HTMLDocument(); |
|---|
| 41 | |
|---|
| 42 | int width(); |
|---|
| 43 | int height(); |
|---|
| 44 | |
|---|
| 45 | String dir(); |
|---|
| 46 | void setDir(const String&); |
|---|
| 47 | |
|---|
| 48 | String designMode() const; |
|---|
| 49 | void setDesignMode(const String&); |
|---|
| 50 | |
|---|
| 51 | String compatMode() const; |
|---|
| 52 | |
|---|
| 53 | Element* activeElement(); |
|---|
| 54 | bool hasFocus(); |
|---|
| 55 | |
|---|
| 56 | String bgColor(); |
|---|
| 57 | void setBgColor(const String&); |
|---|
| 58 | String fgColor(); |
|---|
| 59 | void setFgColor(const String&); |
|---|
| 60 | String alinkColor(); |
|---|
| 61 | void setAlinkColor(const String&); |
|---|
| 62 | String linkColor(); |
|---|
| 63 | void setLinkColor(const String&); |
|---|
| 64 | String vlinkColor(); |
|---|
| 65 | void setVlinkColor(const String&); |
|---|
| 66 | |
|---|
| 67 | void clear(); |
|---|
| 68 | |
|---|
| 69 | void captureEvents(); |
|---|
| 70 | void releaseEvents(); |
|---|
| 71 | |
|---|
| 72 | virtual bool childAllowed(Node*); |
|---|
| 73 | |
|---|
| 74 | virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); |
|---|
| 75 | |
|---|
| 76 | void addNamedItem(const AtomicString& name); |
|---|
| 77 | void removeNamedItem(const AtomicString& name); |
|---|
| 78 | bool hasNamedItem(AtomicStringImpl* name); |
|---|
| 79 | |
|---|
| 80 | void addExtraNamedItem(const AtomicString& name); |
|---|
| 81 | void removeExtraNamedItem(const AtomicString& name); |
|---|
| 82 | bool hasExtraNamedItem(AtomicStringImpl* name); |
|---|
| 83 | |
|---|
| 84 | typedef HashMap<AtomicStringImpl*, int> NameCountMap; |
|---|
| 85 | |
|---|
| 86 | protected: |
|---|
| 87 | HTMLDocument(Frame*); |
|---|
| 88 | |
|---|
| 89 | private: |
|---|
| 90 | virtual bool isHTMLDocument() const { return true; } |
|---|
| 91 | virtual Tokenizer* createTokenizer(); |
|---|
| 92 | virtual void determineParseMode(); |
|---|
| 93 | |
|---|
| 94 | NameCountMap m_namedItemCounts; |
|---|
| 95 | NameCountMap m_extraNamedItemCounts; |
|---|
| 96 | }; |
|---|
| 97 | |
|---|
| 98 | inline bool HTMLDocument::hasNamedItem(AtomicStringImpl* name) |
|---|
| 99 | { |
|---|
| 100 | ASSERT(name); |
|---|
| 101 | return m_namedItemCounts.contains(name); |
|---|
| 102 | } |
|---|
| 103 | |
|---|
| 104 | inline bool HTMLDocument::hasExtraNamedItem(AtomicStringImpl* name) |
|---|
| 105 | { |
|---|
| 106 | ASSERT(name); |
|---|
| 107 | return m_extraNamedItemCounts.contains(name); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | } // namespace |
|---|
| 111 | |
|---|
| 112 | #endif |
|---|