summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSStyleDeclaration.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/css/CSSStyleDeclaration.h
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/css/CSSStyleDeclaration.h')
-rw-r--r--Source/WebCore/css/CSSStyleDeclaration.h65
1 files changed, 29 insertions, 36 deletions
diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h
index a54b0c60a..12910da46 100644
--- a/Source/WebCore/css/CSSStyleDeclaration.h
+++ b/Source/WebCore/css/CSSStyleDeclaration.h
@@ -21,6 +21,7 @@
#ifndef CSSStyleDeclaration_h
#define CSSStyleDeclaration_h
+#include "CSSPropertyNames.h"
#include "CSSRule.h"
#include <wtf/Forward.h>
@@ -30,6 +31,7 @@ class CSSMutableStyleDeclaration;
class CSSProperty;
class CSSStyleSheet;
class CSSValue;
+class StyledElement;
typedef int ExceptionCode;
@@ -40,70 +42,61 @@ public:
static bool isPropertyName(const String&);
- CSSRule* parentRule() const { return m_parentRule; }
- void clearParentRule() { m_parentRule = 0; }
+ CSSRule* parentRule() const { return m_isInlineStyleDeclaration ? 0 : m_parent.rule; }
+ void clearParentRule() { ASSERT(!m_isInlineStyleDeclaration); m_parent.rule = 0; }
+
+ StyledElement* parentElement() const { ASSERT(m_isInlineStyleDeclaration); return m_parent.element; }
+ void clearParentElement() { ASSERT(m_isInlineStyleDeclaration); m_parent.element = 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 unsigned length() const = 0;
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<CSSValue> getPropertyCSSValue(const String& propertyName) = 0;
+ virtual String getPropertyValue(const String& propertyName) = 0;
+ virtual String getPropertyPriority(const String& propertyName) = 0;
+ virtual String getPropertyShorthand(const String& propertyName) = 0;
+ virtual bool isPropertyImplicit(const String& propertyName) = 0;
+ virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) = 0;
+ virtual String removeProperty(const String& propertyName, ExceptionCode&) = 0;
+
+ // CSSPropertyID versions of the CSSOM functions to support bindings and editing.
+ // Use the non-virtual methods in the concrete subclasses when possible.
+ virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) = 0;
+ virtual String getPropertyValueInternal(CSSPropertyID) = 0;
+ virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, 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;
+ virtual bool cssPropertyMatches(const CSSProperty*) const = 0;
#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;
+ CSSStyleDeclaration(StyledElement* parentElement);
// 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;
+ union Parent {
+ Parent(CSSRule* rule) : rule(rule) { }
+ Parent(StyledElement* element) : element(element) { }
+ CSSRule* rule;
+ StyledElement* element;
+ } m_parent;
};
} // namespace WebCore