diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
commit | 40736c5763bf61337c8c14e16d8587db021a87d4 (patch) | |
tree | b17a9c00042ad89cb1308e2484491799aa14e9f8 /Source/WebCore/css/CSSStyleDeclaration.h | |
download | qtwebkit-40736c5763bf61337c8c14e16d8587db021a87d4.tar.gz |
Imported WebKit commit 2ea9d364d0f6efa8fa64acf19f451504c59be0e4 (http://svn.webkit.org/repository/webkit/trunk@104285)
Diffstat (limited to 'Source/WebCore/css/CSSStyleDeclaration.h')
-rw-r--r-- | Source/WebCore/css/CSSStyleDeclaration.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h new file mode 100644 index 000000000..a54b0c60a --- /dev/null +++ b/Source/WebCore/css/CSSStyleDeclaration.h @@ -0,0 +1,111 @@ +/* + * (C) 1999-2003 Lars Knoll (knoll@kde.org) + * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef CSSStyleDeclaration_h +#define CSSStyleDeclaration_h + +#include "CSSRule.h" +#include <wtf/Forward.h> + +namespace WebCore { + +class CSSMutableStyleDeclaration; +class CSSProperty; +class CSSStyleSheet; +class CSSValue; + +typedef int ExceptionCode; + +class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> { + WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); +public: + virtual ~CSSStyleDeclaration() { } + + static bool isPropertyName(const String&); + + CSSRule* parentRule() const { return m_parentRule; } + void clearParentRule() { m_parentRule = 0; } + + CSSStyleSheet* parentStyleSheet() const; + + virtual String cssText() const = 0; + virtual void setCssText(const String&, ExceptionCode&) = 0; + + unsigned length() const { return virtualLength(); } + virtual unsigned virtualLength() const = 0; + bool isEmpty() const { return !length(); } + virtual String item(unsigned index) const = 0; + + PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName); + String getPropertyValue(const String& propertyName); + String getPropertyPriority(const String& propertyName); + String getPropertyShorthand(const String& propertyName); + bool isPropertyImplicit(const String& propertyName); + + virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const = 0; + virtual String getPropertyValue(int propertyID) const = 0; + virtual bool getPropertyPriority(int propertyID) const = 0; + virtual int getPropertyShorthand(int propertyID) const = 0; + virtual bool isPropertyImplicit(int propertyID) const = 0; + + void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&); + String removeProperty(const String& propertyName, ExceptionCode&); + virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&) = 0; + virtual String removeProperty(int propertyID, ExceptionCode&) = 0; + + virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const = 0; + virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable() = 0; + + void diff(CSSMutableStyleDeclaration*) const; + + PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const; + +#ifndef NDEBUG + void showStyle(); +#endif + + bool isElementStyleDeclaration() const { return m_isElementStyleDeclaration; } + bool isInlineStyleDeclaration() const { return m_isInlineStyleDeclaration; } + +protected: + CSSStyleDeclaration(CSSRule* parentRule = 0); + + virtual bool cssPropertyMatches(const CSSProperty*) const; + + // The bits in this section are only used by specific subclasses but kept here + // to maximize struct packing. + + // CSSMutableStyleDeclaration bits: + bool m_strictParsing : 1; +#ifndef NDEBUG + unsigned m_iteratorCount : 4; +#endif + + // CSSElementStyleDeclaration bits: + bool m_isElementStyleDeclaration : 1; + bool m_isInlineStyleDeclaration : 1; + +private: + CSSRule* m_parentRule; +}; + +} // namespace WebCore + +#endif // CSSStyleDeclaration_h |