darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 1 | /* |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
weinig@apple.com | 53c5fa7 | 2009-07-14 04:00:01 +0000 | [diff] [blame] | 4 | * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 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 |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | * Boston, MA 02110-1301, USA. |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 20 | * |
| 21 | */ |
| 22 | |
darin | b3547a3 | 2006-09-06 04:40:44 +0000 | [diff] [blame] | 23 | #ifndef HTMLDocument_h |
| 24 | #define HTMLDocument_h |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 25 | |
darin | e775cf7 | 2006-07-09 22:48:56 +0000 | [diff] [blame] | 26 | #include "CachedResourceClient.h" |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 27 | #include "Document.h" |
weinig@apple.com | 53c5fa7 | 2009-07-14 04:00:01 +0000 | [diff] [blame] | 28 | #include <wtf/HashCountedSet.h> |
barraclough@apple.com | bbb3cd4 | 2010-08-10 17:45:41 +0000 | [diff] [blame] | 29 | #include <wtf/text/AtomicStringHash.h> |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 30 | |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 31 | namespace WebCore { |
| 32 | |
| 33 | class FrameView; |
| 34 | class HTMLElement; |
| 35 | |
darin | 8207db4 | 2007-02-20 18:18:39 +0000 | [diff] [blame] | 36 | class HTMLDocument : public Document, public CachedResourceClient { |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 37 | public: |
commit-queue@webkit.org | a0e4c97 | 2010-09-11 08:59:57 +0000 | [diff] [blame] | 38 | static PassRefPtr<HTMLDocument> create(Frame* frame, const KURL& url, const KURL& baseURL = KURL()) |
weinig@apple.com | 3feb4c3 | 2008-06-15 21:53:29 +0000 | [diff] [blame] | 39 | { |
commit-queue@webkit.org | a0e4c97 | 2010-09-11 08:59:57 +0000 | [diff] [blame] | 40 | return adoptRef(new HTMLDocument(frame, url, baseURL)); |
weinig@apple.com | 3feb4c3 | 2008-06-15 21:53:29 +0000 | [diff] [blame] | 41 | } |
darin | 8207db4 | 2007-02-20 18:18:39 +0000 | [diff] [blame] | 42 | virtual ~HTMLDocument(); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 43 | |
weinig | 2b7b7ff | 2007-09-17 00:09:27 +0000 | [diff] [blame] | 44 | int width(); |
| 45 | int height(); |
weinig | 661a37f | 2007-05-23 23:00:20 +0000 | [diff] [blame] | 46 | |
| 47 | String dir(); |
| 48 | void setDir(const String&); |
| 49 | |
| 50 | String designMode() const; |
| 51 | void setDesignMode(const String&); |
| 52 | |
hyatt@apple.com | ce8ee2a | 2010-08-27 20:29:34 +0000 | [diff] [blame] | 53 | virtual void setCompatibilityModeFromDoctype(); |
oliver | dc20d02 | 2007-10-12 15:24:07 +0000 | [diff] [blame] | 54 | |
adele@apple.com | 15717c5 | 2008-03-07 01:30:28 +0000 | [diff] [blame] | 55 | Element* activeElement(); |
| 56 | bool hasFocus(); |
| 57 | |
weinig | 661a37f | 2007-05-23 23:00:20 +0000 | [diff] [blame] | 58 | String bgColor(); |
| 59 | void setBgColor(const String&); |
| 60 | String fgColor(); |
| 61 | void setFgColor(const String&); |
| 62 | String alinkColor(); |
| 63 | void setAlinkColor(const String&); |
| 64 | String linkColor(); |
| 65 | void setLinkColor(const String&); |
| 66 | String vlinkColor(); |
| 67 | void setVlinkColor(const String&); |
| 68 | |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 69 | void clear(); |
| 70 | |
weinig | 661a37f | 2007-05-23 23:00:20 +0000 | [diff] [blame] | 71 | void captureEvents(); |
| 72 | void releaseEvents(); |
| 73 | |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 74 | void addNamedItem(const AtomicString& name); |
| 75 | void removeNamedItem(const AtomicString& name); |
| 76 | bool hasNamedItem(AtomicStringImpl* name); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 77 | |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 78 | void addExtraNamedItem(const AtomicString& name); |
| 79 | void removeExtraNamedItem(const AtomicString& name); |
| 80 | bool hasExtraNamedItem(AtomicStringImpl* name); |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 81 | |
weinig@apple.com | 3feb4c3 | 2008-06-15 21:53:29 +0000 | [diff] [blame] | 82 | protected: |
commit-queue@webkit.org | a0e4c97 | 2010-09-11 08:59:57 +0000 | [diff] [blame] | 83 | HTMLDocument(Frame* frame, const KURL& url, const KURL& baseURL = KURL()); |
hyatt@apple.com | 4258307 | 2008-02-20 22:47:57 +0000 | [diff] [blame] | 84 | |
| 85 | private: |
darin@apple.com | 7e131b6 | 2009-08-15 06:25:49 +0000 | [diff] [blame] | 86 | virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); |
| 87 | |
zecke@webkit.org | 073ea4c | 2009-02-04 13:37:52 +0000 | [diff] [blame] | 88 | virtual bool isFrameSet() const; |
eric@webkit.org | 0cea84c | 2010-08-19 19:32:02 +0000 | [diff] [blame] | 89 | virtual PassRefPtr<DocumentParser> createParser(); |
weinig@apple.com | 3feb4c3 | 2008-06-15 21:53:29 +0000 | [diff] [blame] | 90 | |
eric@webkit.org | 0df8b7e | 2010-05-27 12:01:01 +0000 | [diff] [blame] | 91 | void addItemToMap(HashCountedSet<AtomicStringImpl*>&, const AtomicString&); |
| 92 | void removeItemFromMap(HashCountedSet<AtomicStringImpl*>&, const AtomicString&); |
| 93 | |
weinig@apple.com | 53c5fa7 | 2009-07-14 04:00:01 +0000 | [diff] [blame] | 94 | HashCountedSet<AtomicStringImpl*> m_namedItemCounts; |
| 95 | HashCountedSet<AtomicStringImpl*> m_extraNamedItemCounts; |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
darin@apple.com | a3c493e | 2008-03-18 13:47:47 +0000 | [diff] [blame] | 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 | |
weinig@apple.com | 53c5fa7 | 2009-07-14 04:00:01 +0000 | [diff] [blame] | 110 | } // namespace WebCore |
darin | b9481ed | 2006-03-20 02:57:59 +0000 | [diff] [blame] | 111 | |
weinig@apple.com | 53c5fa7 | 2009-07-14 04:00:01 +0000 | [diff] [blame] | 112 | #endif // HTMLDocument_h |