1 /* 2 * (C) 1999-2003 Lars Knoll (knoll (at) 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 39 bool disabled() const { return m_disabled; } 40 void setDisabled(bool disabled) { m_disabled = disabled; styleSheetChanged(); } 41 42 Node* ownerNode() const { return m_parentNode; } 43 StyleSheet *parentStyleSheet() const; 44 45 // Note that href is the URL that started the redirect chain that led to 46 // this style sheet. This property probably isn't useful for much except 47 // the JavaScript binding (which needs to use this value for security). 48 const String& href() const { return m_originalURL; } 49 50 void setFinalURL(const KURL& finalURL) { m_finalURL = finalURL; } 51 const KURL& finalURL() const { return m_finalURL; } 52 53 const String& title() const { return m_strTitle; } 54 void setTitle(const String& s) { m_strTitle = s; } 55 MediaList* media() const { return m_media.get(); } 56 void setMedia(PassRefPtr<MediaList>); 57 58 virtual String type() const = 0; 59 virtual bool isLoading() = 0; 60 virtual void styleSheetChanged() { } 61 62 virtual KURL completeURL(const String& url) const; 63 virtual void addSubresourceStyleURLs(ListHashSet<KURL>&) { } 64 65 virtual bool parseString(const String&, bool strict = true) = 0; 66 67 protected: 68 StyleSheet(Node* ownerNode, const String& href, const KURL& finalURL); 69 StyleSheet(StyleSheet* parentSheet, const String& href, const KURL& finalURL); 70 StyleSheet(StyleBase* owner, const String& href, const KURL& finalURL); 71 72 private: 73 virtual bool isStyleSheet() const { return true; } 74 75 Node* m_parentNode; 76 String m_originalURL; 77 KURL m_finalURL; 78 String m_strTitle; 79 RefPtr<MediaList> m_media; 80 bool m_disabled; 81 }; 82 83 } // namespace 84 85 #endif 86