2008-11-04 Anders Carlsson <andersca@apple.com>
[webkit/qt.git] / WebCore / html / HTMLLinkElement.h
blob2fcaaa8f34d1f3a2b1b864be564b4ec39d922628
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2008 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 HTMLLinkElement_h
24 #define HTMLLinkElement_h
26 #include "CSSStyleSheet.h"
27 #include "CachedResourceClient.h"
28 #include "CachedResourceHandle.h"
29 #include "HTMLElement.h"
31 namespace WebCore {
33 class CachedCSSStyleSheet;
34 class KURL;
36 class HTMLLinkElement : public HTMLElement, public CachedResourceClient {
37 public:
38 HTMLLinkElement(Document*);
39 ~HTMLLinkElement();
41 virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
42 virtual int tagPriority() const { return 0; }
44 bool disabled() const;
45 void setDisabled(bool);
47 String charset() const;
48 void setCharset(const String&);
50 KURL href() const;
51 void setHref(const String&);
53 String hreflang() const;
54 void setHreflang(const String&);
56 String media() const;
57 void setMedia(const String&);
59 String rel() const;
60 void setRel(const String&);
62 String rev() const;
63 void setRev(const String&);
65 virtual String target() const;
66 void setTarget(const String&);
68 String type() const;
69 void setType(const String&);
71 StyleSheet* sheet() const;
73 // overload from HTMLElement
74 virtual void parseMappedAttribute(MappedAttribute*);
76 void process();
78 virtual void insertedIntoDocument();
79 virtual void removedFromDocument();
81 // from CachedResourceClient
82 virtual void setCSSStyleSheet(const String &url, const String& charset, const CachedCSSStyleSheet* sheet);
83 bool isLoading() const;
84 virtual bool sheetLoaded();
86 bool isAlternate() const { return m_disabledState == 0 && m_alternate; }
87 bool isDisabled() const { return m_disabledState == 2; }
88 bool isEnabledViaScript() const { return m_disabledState == 1; }
89 bool isIcon() const { return m_isIcon; }
91 int disabledState() { return m_disabledState; }
92 void setDisabledState(bool _disabled);
94 virtual bool isURLAttribute(Attribute*) const;
96 static void tokenizeRelAttribute(const AtomicString& value, bool& stylesheet, bool& alternate, bool& icon, bool& dnsPrefetch);
98 virtual void getSubresourceAttributeStrings(Vector<String>&) const;
100 void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
101 virtual void finishParsingChildren();
103 protected:
104 CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet;
105 RefPtr<CSSStyleSheet> m_sheet;
106 String m_url;
107 String m_type;
108 String m_media;
109 int m_disabledState; // 0=unset(default), 1=enabled via script, 2=disabled
110 bool m_loading;
111 bool m_alternate;
112 bool m_isStyleSheet;
113 bool m_isIcon;
114 bool m_isDNSPrefetch;
115 bool m_createdByParser;
118 } //namespace
120 #endif