1 /* 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21 #ifndef StyleSheet_h 22 #define StyleSheet_h 23 24 #include "KURLHash.h" 25 #include "PlatformString.h" 26 #include "StyleList.h" 27 #include <wtf/ListHashSet.h> 28 29 namespace WebCore { 30 31 class CachedCSSStyleSheet; 32 class MediaList; 33 class Node; 34 35 class StyleSheet : public StyleList { 36 public: 37 virtual ~StyleSheet(); 38 disabled()39 bool disabled() const { return m_disabled; } setDisabled(bool disabled)40 void setDisabled(bool disabled) { m_disabled = disabled; styleSheetChanged(); } 41 ownerNode()42 Node* ownerNode() const { return m_parentNode; } 43 StyleSheet *parentStyleSheet() const; href()44 const String& href() const { return m_strHref; } setHref(const String & href)45 void setHref(const String& href) { m_strHref = href; } title()46 const String& title() const { return m_strTitle; } setTitle(const String & s)47 void setTitle(const String& s) { m_strTitle = s; } media()48 MediaList* media() const { return m_media.get(); } 49 void setMedia(PassRefPtr<MediaList>); 50 51 virtual String type() const = 0; 52 virtual bool isLoading() = 0; styleSheetChanged()53 virtual void styleSheetChanged() { } 54 55 virtual KURL completeURL(const String& url) const; addSubresourceStyleURLs(ListHashSet<KURL> &)56 virtual void addSubresourceStyleURLs(ListHashSet<KURL>&) { } 57 58 virtual bool parseString(const String&, bool strict = true) = 0; 59 60 protected: 61 StyleSheet(Node* ownerNode, const String& href); 62 StyleSheet(StyleSheet* parentSheet, const String& href); 63 StyleSheet(StyleBase* owner, const String& href); 64 65 private: isStyleSheet()66 virtual bool isStyleSheet() const { return true; } 67 68 Node* m_parentNode; 69 String m_strHref; 70 String m_strTitle; 71 RefPtr<MediaList> m_media; 72 bool m_disabled; 73 }; 74 75 } // namespace 76 77 #endif 78