2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef CSSComputedStyleDeclaration_h
22 #define CSSComputedStyleDeclaration_h
24 #include "CSSStyleDeclaration.h"
25 #include "RenderStyleConstants.h"
26 #include <wtf/RefPtr.h>
27 #include <wtf/text/WTFString.h>
31 class CSSPrimitiveValue;
38 class StylePropertySet;
39 class StylePropertyShorthand;
41 #if ENABLE(CSS_SHADERS)
42 class CustomFilterNumberParameter;
43 class CustomFilterParameter;
46 enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
48 class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
50 static PassRefPtr<CSSComputedStyleDeclaration> create(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String())
52 return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName));
54 virtual ~CSSComputedStyleDeclaration();
56 virtual void ref() OVERRIDE;
57 virtual void deref() OVERRIDE;
59 PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID) const;
60 String getPropertyValue(CSSPropertyID) const;
61 bool getPropertyPriority(CSSPropertyID) const;
63 virtual PassRefPtr<StylePropertySet> copy() const;
64 virtual PassRefPtr<StylePropertySet> makeMutable();
66 PassRefPtr<CSSValue> getPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
67 PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
68 bool useFixedFontDefaultSize() const;
70 PassRefPtr<CSSValue> getSVGPropertyCSSValue(CSSPropertyID, EUpdateLayout) const;
73 PassRefPtr<StylePropertySet> copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const;
76 CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);
78 // CSSOM functions. Don't make these public.
79 virtual CSSRule* parentRule() const;
80 virtual unsigned length() const;
81 virtual String item(unsigned index) const;
82 virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName);
83 virtual String getPropertyValue(const String& propertyName);
84 virtual String getPropertyPriority(const String& propertyName);
85 virtual String getPropertyShorthand(const String& propertyName);
86 virtual bool isPropertyImplicit(const String& propertyName);
87 virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&);
88 virtual String removeProperty(const String& propertyName, ExceptionCode&);
89 virtual String cssText() const;
90 virtual void setCssText(const String&, ExceptionCode&);
91 virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID);
92 virtual String getPropertyValueInternal(CSSPropertyID);
93 virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&);
95 virtual bool cssPropertyMatches(const CSSProperty*) const;
97 PassRefPtr<CSSValue> valueForShadow(const ShadowData*, CSSPropertyID, RenderStyle*) const;
98 PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
100 PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
103 #if ENABLE(CSS_SHADERS)
104 PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter*) const;
105 PassRefPtr<CSSValue> valueForCustomFilterParameter(const CustomFilterParameter*) const;
108 #if ENABLE(CSS_FILTERS)
109 PassRefPtr<CSSValue> valueForFilter(RenderStyle*) const;
112 PassRefPtr<CSSValueList> getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand&) const;
113 PassRefPtr<CSSValueList> getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand&) const;
114 PassRefPtr<CSSValueList> getBackgroundShorthandValue() const;
117 PseudoId m_pseudoElementSpecifier;
118 bool m_allowVisitedStyle;
122 } // namespace WebCore
124 #endif // CSSComputedStyleDeclaration_h