2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2008 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 "PlatformString.h"
26 #include "RenderStyleConstants.h"
27 #include <wtf/RefPtr.h>
32 class CSSMutableStyleDeclaration;
33 class CSSPrimitiveValue;
38 enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
40 class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
42 friend PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node>, bool allowVisitedStyle, const String& pseudoElementName);
43 virtual ~CSSComputedStyleDeclaration();
45 virtual String cssText() const;
47 virtual unsigned virtualLength() const;
48 virtual String item(unsigned index) const;
50 virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
51 virtual String getPropertyValue(int propertyID) const;
52 virtual bool getPropertyPriority(int propertyID) const;
53 virtual int getPropertyShorthand(int /*propertyID*/) const { return -1; }
54 virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; }
56 virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
57 virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
59 PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const;
60 PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
62 PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
66 virtual bool cssPropertyMatches(const CSSProperty*) const;
69 CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);
71 virtual void setCssText(const String&, ExceptionCode&);
73 virtual String removeProperty(int propertyID, ExceptionCode&);
74 virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
76 PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int) const;
77 PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
80 PseudoId m_pseudoElementSpecifier;
81 bool m_allowVisitedStyle;
84 inline PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String())
86 return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName));
89 } // namespace WebCore
91 #endif // CSSComputedStyleDeclaration_h