1/* 2 * Copyright (C) 2006, 2007 Rob Buis 3 * Copyright (C) 2013 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 22#ifndef InlineStyleSheetOwner_h 23#define InlineStyleSheetOwner_h 24 25#include "CSSStyleSheet.h" 26#include <wtf/text/TextPosition.h> 27 28namespace WebCore { 29 30class Document; 31class Element; 32 33class InlineStyleSheetOwner { 34public: 35 InlineStyleSheetOwner(Document&, bool createdByParser); 36 ~InlineStyleSheetOwner(); 37 38 void setContentType(const AtomicString& contentType) { m_contentType = contentType; } 39 void setMedia(const AtomicString& media) { m_media = media; } 40 41 CSSStyleSheet* sheet() const { return m_sheet.get(); } 42 43 bool isLoading() const; 44 bool sheetLoaded(Document&); 45 void startLoadingDynamicSheet(Document&); 46 47 void insertedIntoDocument(Document&, Element&); 48 void removedFromDocument(Document&, Element&); 49 void clearDocumentData(Document&, Element&); 50 void childrenChanged(Element&); 51 void finishParsingChildren(Element&); 52 53private: 54 void createSheet(Element&, const String& text); 55 void createSheetFromTextContents(Element&); 56 void clearSheet(); 57 58 bool m_isParsingChildren; 59 bool m_loading; 60 WTF::OrdinalNumber m_startLineNumber; 61 AtomicString m_contentType; 62 AtomicString m_media; 63 RefPtr<CSSStyleSheet> m_sheet; 64}; 65 66} 67 68#endif 69