diff -r 000000000000 -r 4f2f89ce4247 WebCore/css/CSSComputedStyleDeclaration.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WebCore/css/CSSComputedStyleDeclaration.h Fri Sep 17 09:02:29 2010 +0300 @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2004 Zack Rusin + * 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 Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef CSSComputedStyleDeclaration_h +#define CSSComputedStyleDeclaration_h + +#include "CSSStyleDeclaration.h" +#include "PlatformString.h" +#include "RenderStyleConstants.h" +#include + +namespace WebCore { + +class Color; +class CSSMutableStyleDeclaration; +class CSSPrimitiveValue; +class Node; +class RenderStyle; +class ShadowData; + +enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true }; + +class CSSComputedStyleDeclaration : public CSSStyleDeclaration { +public: + friend PassRefPtr computedStyle(PassRefPtr, bool allowVisitedStyle, const String& pseudoElementName); + virtual ~CSSComputedStyleDeclaration(); + + virtual String cssText() const; + + virtual unsigned virtualLength() const; + virtual String item(unsigned index) const; + + virtual PassRefPtr getPropertyCSSValue(int propertyID) const; + virtual String getPropertyValue(int propertyID) const; + virtual bool getPropertyPriority(int propertyID) const; + virtual int getPropertyShorthand(int /*propertyID*/) const { return -1; } + virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; } + + virtual PassRefPtr copy() const; + virtual PassRefPtr makeMutable(); + + PassRefPtr getPropertyCSSValue(int propertyID, EUpdateLayout) const; + PassRefPtr getFontSizeCSSValuePreferringKeyword() const; +#if ENABLE(SVG) + PassRefPtr getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const; +#endif + +protected: + virtual bool cssPropertyMatches(const CSSProperty*) const; + +private: + CSSComputedStyleDeclaration(PassRefPtr, bool allowVisitedStyle, const String&); + + virtual void setCssText(const String&, ExceptionCode&); + + virtual String removeProperty(int propertyID, ExceptionCode&); + virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&); + + PassRefPtr valueForShadow(const ShadowData*, int) const; + PassRefPtr currentColorOrValidColor(RenderStyle*, const Color&) const; + + RefPtr m_node; + PseudoId m_pseudoElementSpecifier; + bool m_allowVisitedStyle; +}; + +inline PassRefPtr computedStyle(PassRefPtr node, bool allowVisitedStyle = false, const String& pseudoElementName = String()) +{ + return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName)); +} + +} // namespace WebCore + +#endif // CSSComputedStyleDeclaration_h