CSSStyleDeclaration.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * (C) 1999-2003 Lars Knoll (knoll@kde.org)
  3. * Copyright (C) 2004, 2005, 2006, 2008, 2012 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 Library 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. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public License
  16. * along with this library; see the file COPYING.LIB. If not, write to
  17. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. #ifndef CSSStyleDeclaration_h
  21. #define CSSStyleDeclaration_h
  22. #include "CSSPropertyNames.h"
  23. #include "ScriptWrappable.h"
  24. #include <wtf/Forward.h>
  25. namespace WebCore {
  26. class CSSProperty;
  27. class CSSRule;
  28. class CSSStyleSheet;
  29. class CSSValue;
  30. class MutableStylePropertySet;
  31. class StylePropertySet;
  32. class StyledElement;
  33. typedef int ExceptionCode;
  34. class CSSStyleDeclaration : public ScriptWrappable {
  35. WTF_MAKE_NONCOPYABLE(CSSStyleDeclaration); WTF_MAKE_FAST_ALLOCATED;
  36. public:
  37. virtual ~CSSStyleDeclaration() { }
  38. virtual void ref() = 0;
  39. virtual void deref() = 0;
  40. virtual CSSRule* parentRule() const = 0;
  41. virtual String cssText() const = 0;
  42. virtual void setCssText(const String&, ExceptionCode&) = 0;
  43. virtual unsigned length() const = 0;
  44. virtual String item(unsigned index) const = 0;
  45. virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) = 0;
  46. virtual String getPropertyValue(const String& propertyName) = 0;
  47. virtual String getPropertyPriority(const String& propertyName) = 0;
  48. virtual String getPropertyShorthand(const String& propertyName) = 0;
  49. virtual bool isPropertyImplicit(const String& propertyName) = 0;
  50. virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) = 0;
  51. virtual String removeProperty(const String& propertyName, ExceptionCode&) = 0;
  52. // CSSPropertyID versions of the CSSOM functions to support bindings and editing.
  53. // Use the non-virtual methods in the concrete subclasses when possible.
  54. // The CSSValue returned by this function should not be exposed to the web as it may be used by multiple documents at the same time.
  55. virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) = 0;
  56. virtual String getPropertyValueInternal(CSSPropertyID) = 0;
  57. virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0;
  58. virtual PassRefPtr<MutableStylePropertySet> copyProperties() const = 0;
  59. virtual CSSStyleSheet* parentStyleSheet() const { return 0; }
  60. protected:
  61. CSSStyleDeclaration() { }
  62. };
  63. } // namespace WebCore
  64. #endif // CSSStyleDeclaration_h