Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006, 2007 Rob Buis |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef StyleElement_h |
| 22 | #define StyleElement_h |
| 23 | |
| 24 | #include "core/css/CSSStyleSheet.h" |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 25 | #include "wtf/text/TextPosition.h" |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 26 | |
| 27 | namespace WebCore { |
| 28 | |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 29 | class ContainerNode; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 30 | class Document; |
| 31 | class Element; |
| 32 | |
| 33 | class StyleElement { |
| 34 | public: |
| 35 | StyleElement(Document*, bool createdByParser); |
| 36 | virtual ~StyleElement(); |
| 37 | |
| 38 | protected: |
| 39 | virtual const AtomicString& type() const = 0; |
| 40 | virtual const AtomicString& media() const = 0; |
| 41 | |
| 42 | CSSStyleSheet* sheet() const { return m_sheet.get(); } |
| 43 | |
| 44 | bool isLoading() const; |
| 45 | bool sheetLoaded(Document*); |
| 46 | void startLoadingDynamicSheet(Document*); |
| 47 | |
Torne (Richard Coles) | 5267f70 | 2013-06-11 10:57:24 +0100 | [diff] [blame] | 48 | void processStyleSheet(Document*, Element*); |
Ben Murdoch | 02772c6 | 2013-07-26 10:21:05 +0100 | [diff] [blame] | 49 | void removedFromDocument(Document*, Element*, ContainerNode* scopingNode = 0); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 50 | void clearDocumentData(Document*, Element*); |
| 51 | void childrenChanged(Element*); |
| 52 | void finishParsingChildren(Element*); |
| 53 | |
| 54 | RefPtr<CSSStyleSheet> m_sheet; |
| 55 | |
| 56 | private: |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 57 | void createSheet(Element*, const String& text = String()); |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 58 | void process(Element*); |
| 59 | void clearSheet(); |
| 60 | |
| 61 | bool m_createdByParser; |
| 62 | bool m_loading; |
Torne (Richard Coles) | 93ac45c | 2013-05-29 14:40:20 +0100 | [diff] [blame] | 63 | TextPosition m_startPosition; |
Torne (Richard Coles) | 53e740f | 2013-05-09 18:38:43 +0100 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } |
| 67 | |
| 68 | #endif |