Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / dom / StyleElement.h
blob60c49e78de901e76f4beb1005bca423e0a83885a
1 /*
2 * Copyright (C) 2006, 2007 Rob Buis
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.
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.
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.
21 #ifndef StyleElement_h
22 #define StyleElement_h
24 #include "core/css/CSSStyleSheet.h"
25 #include "wtf/text/TextPosition.h"
27 namespace blink {
29 class ContainerNode;
30 class Document;
31 class Element;
33 class StyleElement : public WillBeGarbageCollectedMixin {
34 public:
35 StyleElement(Document*, bool createdByParser);
36 virtual ~StyleElement();
37 DECLARE_VIRTUAL_TRACE();
39 protected:
40 enum ProcessingResult {
41 ProcessingSuccessful,
42 ProcessingFatalError
45 virtual const AtomicString& type() const = 0;
46 virtual const AtomicString& media() const = 0;
48 CSSStyleSheet* sheet() const { return m_sheet.get(); }
50 bool isLoading() const;
51 bool sheetLoaded(Document&);
52 void startLoadingDynamicSheet(Document&);
54 void insertedInto(Element*, ContainerNode* insertionPoint);
55 void removedFrom(Element*, ContainerNode* insertionPoint);
56 void clearDocumentData(Document&, Element*);
57 ProcessingResult processStyleSheet(Document&, Element*);
58 ProcessingResult childrenChanged(Element*);
59 ProcessingResult finishParsingChildren(Element*);
61 RefPtrWillBeMember<CSSStyleSheet> m_sheet;
63 private:
64 ProcessingResult createSheet(Element*, const String& text = String());
65 ProcessingResult process(Element*);
66 void clearSheet(Element* ownerElement = 0);
68 bool m_createdByParser : 1;
69 bool m_loading : 1;
70 bool m_registeredAsCandidate : 1;
71 TextPosition m_startPosition;
76 #endif