/src/3rdparty/webkit/Source/WebCore/css/CSSComputedStyleDeclaration.h

https://bitbucket.org/ultra_iter/qt-vtl · C Header · 96 lines · 57 code · 20 blank · 19 comment · 0 complexity · 02aeb638d4164d504c69d44ec863f7b2 MD5 · raw file

  1. /*
  2. * Copyright (C) 2004 Zack Rusin <zack@kde.org>
  3. * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
  4. *
  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.
  9. *
  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.
  14. *
  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
  18. * 02110-1301 USA
  19. */
  20. #ifndef CSSComputedStyleDeclaration_h
  21. #define CSSComputedStyleDeclaration_h
  22. #include "CSSStyleDeclaration.h"
  23. #include "RenderStyleConstants.h"
  24. #include <wtf/RefPtr.h>
  25. #include <wtf/text/WTFString.h>
  26. namespace WebCore {
  27. class Color;
  28. class CSSMutableStyleDeclaration;
  29. class CSSPrimitiveValue;
  30. class Node;
  31. class RenderStyle;
  32. class ShadowData;
  33. class SVGPaint;
  34. enum EUpdateLayout { DoNotUpdateLayout = false, UpdateLayout = true };
  35. class CSSComputedStyleDeclaration : public CSSStyleDeclaration {
  36. public:
  37. friend PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node>, bool allowVisitedStyle, const String& pseudoElementName);
  38. virtual ~CSSComputedStyleDeclaration();
  39. virtual String cssText() const;
  40. virtual unsigned virtualLength() const;
  41. virtual String item(unsigned index) const;
  42. virtual PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID) const;
  43. virtual String getPropertyValue(int propertyID) const;
  44. virtual bool getPropertyPriority(int propertyID) const;
  45. virtual int getPropertyShorthand(int /*propertyID*/) const { return -1; }
  46. virtual bool isPropertyImplicit(int /*propertyID*/) const { return false; }
  47. virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const;
  48. virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
  49. PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const;
  50. PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const;
  51. bool useFixedFontDefaultSize() const;
  52. #if ENABLE(SVG)
  53. PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const;
  54. #endif
  55. protected:
  56. virtual bool cssPropertyMatches(const CSSProperty*) const;
  57. private:
  58. CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&);
  59. virtual void setCssText(const String&, ExceptionCode&);
  60. virtual String removeProperty(int propertyID, ExceptionCode&);
  61. virtual void setProperty(int propertyId, const String& value, bool important, ExceptionCode&);
  62. PassRefPtr<CSSValue> valueForShadow(const ShadowData*, int, RenderStyle*) const;
  63. PassRefPtr<CSSPrimitiveValue> currentColorOrValidColor(RenderStyle*, const Color&) const;
  64. #if ENABLE(SVG)
  65. PassRefPtr<SVGPaint> adjustSVGPaintForCurrentColor(PassRefPtr<SVGPaint>, RenderStyle*) const;
  66. #endif
  67. RefPtr<Node> m_node;
  68. PseudoId m_pseudoElementSpecifier;
  69. bool m_allowVisitedStyle;
  70. };
  71. inline PassRefPtr<CSSComputedStyleDeclaration> computedStyle(PassRefPtr<Node> node, bool allowVisitedStyle = false, const String& pseudoElementName = String())
  72. {
  73. return adoptRef(new CSSComputedStyleDeclaration(node, allowVisitedStyle, pseudoElementName));
  74. }
  75. } // namespace WebCore
  76. #endif // CSSComputedStyleDeclaration_h