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.
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.
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.
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.
26 #include <wtf/Forward.h>
27 #include <wtf/RefCounted.h>
34 // Base class for most CSS DOM objects.
36 // FIXME: We don't need these to all share one base class.
37 // Refactor so they don't any more.
39 class StyleBase : public RefCounted<StyleBase> {
41 virtual ~StyleBase() { }
43 StyleBase* parent() const { return m_parent; }
44 void setParent(StyleBase* parent) { m_parent = parent; }
46 // returns the url of the style sheet this object belongs to
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 isPageRule() { return false; }
58 virtual bool isRule() { return false; }
59 virtual bool isStyleRule() { return false; }
60 virtual bool isStyleSheet() const { return false; }
61 virtual bool isXSLStyleSheet() const { return false; }
63 virtual bool isMutableStyleDeclaration() const { return false; }
65 virtual String cssText() const;
67 virtual void checkLoaded();
69 bool useStrictParsing() const { return !m_parent || m_parent->useStrictParsing(); }
71 virtual void insertedIntoParent() { }
73 StyleSheet* stylesheet();
75 #ifdef ANDROID_INSTRUMENT
76 // Overridden to prevent the normal new from being called.
77 void* operator new(size_t size);
78 void* operator new[](size_t size);
80 // Overridden to prevent the normal delete from being called.
81 void operator delete(void* p, size_t size);
82 void operator delete[](void* p, size_t size);
84 static size_t reportStyleSize();
88 StyleBase(StyleBase* parent)