Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / dom / StyleElement.h
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"
25 #include "wtf/text/TextPosition.h"
26
27 namespace WebCore {
28
29 class ContainerNode;
30 class Document;
31 class Element;
32 class TreeScope;
33
34 class StyleElement : public WillBeGarbageCollectedMixin {
35 public:
36     StyleElement(Document*, bool createdByParser);
37     virtual ~StyleElement();
38     virtual void trace(Visitor*);
39
40 protected:
41     virtual const AtomicString& type() const = 0;
42     virtual const AtomicString& media() const = 0;
43
44     CSSStyleSheet* sheet() const { return m_sheet.get(); }
45
46     bool isLoading() const;
47     bool sheetLoaded(Document&);
48     void startLoadingDynamicSheet(Document&);
49
50     void processStyleSheet(Document&, Element*);
51     void removedFromDocument(Document&, Element*);
52     void removedFromDocument(Document&, Element*, ContainerNode* scopingNode, TreeScope&);
53     void clearDocumentData(Document&, Element*);
54     void childrenChanged(Element*);
55     void finishParsingChildren(Element*);
56
57     RefPtrWillBeMember<CSSStyleSheet> m_sheet;
58
59 private:
60     void createSheet(Element*, const String& text = String());
61     void process(Element*);
62     void clearSheet(Element* ownerElement = 0);
63
64     bool m_createdByParser : 1;
65     bool m_loading : 1;
66     bool m_registeredAsCandidate : 1;
67     TextPosition m_startPosition;
68 };
69
70 }
71
72 #endif