OSDN Git Service

am 3c54ece0: am 5dc34a85: activeDocumentLoader() causes crash in WebCoreFrameBridge.cpp
[android-x86/external-webkit.git] / WebCore / css / StyleBase.h
1 /*
2  * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
3  * Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
4  * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmial.com)
5  * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22
23 #ifndef StyleBase_h
24 #define StyleBase_h
25
26 #include <wtf/Forward.h>
27 #include <wtf/RefCounted.h>
28
29 namespace WebCore {
30
31     class StyleSheet;
32     class KURL;
33
34     // Base class for most CSS DOM objects.
35
36     // FIXME: We don't need these to all share one base class.
37     // Refactor so they don't any more.
38
39     class StyleBase : public RefCounted<StyleBase> {
40     public:
41         virtual ~StyleBase() { }
42
43         StyleBase* parent() const { return m_parent; }
44         void setParent(StyleBase* parent) { m_parent = parent; }
45
46         // returns the url of the style sheet this object belongs to
47         KURL baseURL() const;
48
49         virtual bool isCSSStyleSheet() const { return false; }
50         virtual bool isCharsetRule() { return false; }
51         virtual bool isFontFaceRule() { return false; }
52         virtual bool isImportRule() { return false; }
53         virtual bool isKeyframeRule() { return false; }
54         virtual bool isKeyframesRule() { return false; }
55         virtual bool isMediaRule() { return false; }
56         virtual bool isVariablesRule() { return false; }
57         virtual bool isPageRule() { return false; }
58         
59         virtual bool isRule() { return false; }
60         virtual bool isStyleRule() { return false; }
61         virtual bool isStyleSheet() const { return false; }
62         virtual bool isXSLStyleSheet() const { return false; }
63
64         virtual bool isMutableStyleDeclaration() const { return false; }
65
66         virtual String cssText() const;
67
68         virtual void checkLoaded();
69
70         bool useStrictParsing() const { return !m_parent || m_parent->useStrictParsing(); }
71
72         virtual void insertedIntoParent() { }
73
74         StyleSheet* stylesheet();
75
76 #ifdef ANDROID_INSTRUMENT
77         // Overridden to prevent the normal new from being called.
78         void* operator new(size_t size);
79         void* operator new[](size_t size);
80
81         // Overridden to prevent the normal delete from being called.
82         void operator delete(void* p, size_t size);
83         void operator delete[](void* p, size_t size);
84
85         static size_t reportStyleSize();
86 #endif
87
88     protected:
89         StyleBase(StyleBase* parent)
90             : m_parent(parent)
91         {
92         }
93
94     private:
95         StyleBase* m_parent;
96     };
97 }
98
99 #endif