1 /* 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 2004, 2006, 2007 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 StyleSheetList_h 22 #define StyleSheetList_h 23 24 #include "bindings/core/v8/ScriptWrappable.h" 25 #include "core/css/CSSStyleSheet.h" 26 #include "core/dom/TreeScope.h" 27 #include "wtf/Forward.h" 28 #include "wtf/PassRefPtr.h" 29 #include "wtf/RefCounted.h" 30 #include "wtf/Vector.h" 31 32 namespace blink { 33 34 class HTMLStyleElement; 35 class StyleSheet; 36 37 class StyleSheetList : public RefCountedWillBeGarbageCollectedFinalized<StyleSheetList>, public ScriptWrappable { 38 DEFINE_WRAPPERTYPEINFO(); 39 public: create(TreeScope * treeScope)40 static PassRefPtrWillBeRawPtr<StyleSheetList> create(TreeScope* treeScope) { return adoptRefWillBeNoop(new StyleSheetList(treeScope)); } 41 ~StyleSheetList(); 42 43 unsigned length(); 44 StyleSheet* item(unsigned index); 45 46 HTMLStyleElement* getNamedItem(const AtomicString&) const; 47 document()48 Document* document() { return m_treeScope ? &m_treeScope->document() : 0; } 49 50 #if !ENABLE(OILPAN) 51 void detachFromDocument(); 52 #endif 53 54 CSSStyleSheet* anonymousNamedGetter(const AtomicString&); 55 56 void trace(Visitor*); 57 58 private: 59 StyleSheetList(TreeScope*); 60 const WillBeHeapVector<RefPtrWillBeMember<StyleSheet> >& styleSheets(); 61 62 RawPtrWillBeMember<TreeScope> m_treeScope; 63 #if !ENABLE(OILPAN) 64 Vector<RefPtr<StyleSheet> > m_detachedStyleSheets; 65 #endif 66 }; 67 68 } // namespace blink 69 70 #endif // StyleSheetList_h 71