NameSpaceRule.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /* class for CSS @namespace rules */
  6. #ifndef mozilla_css_NameSpaceRule_h__
  7. #define mozilla_css_NameSpaceRule_h__
  8. #include "mozilla/Attributes.h"
  9. #include "mozilla/MemoryReporting.h"
  10. #include "mozilla/css/Rule.h"
  11. #include "nsIDOMCSSRule.h"
  12. class nsIAtom;
  13. // IID for the NameSpaceRule class {f0b0dbe1-5031-4a21-b06a-dc141ef2af98}
  14. #define NS_CSS_NAMESPACE_RULE_IMPL_CID \
  15. {0xf0b0dbe1, 0x5031, 0x4a21, {0xb0, 0x6a, 0xdc, 0x14, 0x1e, 0xf2, 0xaf, 0x98}}
  16. namespace mozilla {
  17. namespace css {
  18. class NameSpaceRule final : public Rule,
  19. public nsIDOMCSSRule
  20. {
  21. public:
  22. NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec,
  23. uint32_t aLineNumber, uint32_t aColumnNumber);
  24. private:
  25. // for |Clone|
  26. NameSpaceRule(const NameSpaceRule& aCopy);
  27. ~NameSpaceRule();
  28. public:
  29. NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_NAMESPACE_RULE_IMPL_CID)
  30. NS_DECL_ISUPPORTS
  31. // Rule methods
  32. DECL_STYLE_RULE_INHERIT
  33. #ifdef DEBUG
  34. virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
  35. #endif
  36. virtual int32_t GetType() const override;
  37. virtual already_AddRefed<Rule> Clone() const override;
  38. nsIAtom* GetPrefix() const { return mPrefix; }
  39. void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
  40. virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
  41. override MOZ_MUST_OVERRIDE;
  42. // nsIDOMCSSRule interface
  43. NS_DECL_NSIDOMCSSRULE
  44. private:
  45. nsCOMPtr<nsIAtom> mPrefix;
  46. nsString mURLSpec;
  47. };
  48. NS_DEFINE_STATIC_IID_ACCESSOR(NameSpaceRule, NS_CSS_NAMESPACE_RULE_IMPL_CID)
  49. } // namespace css
  50. } // namespace mozilla
  51. #endif /* mozilla_css_NameSpaceRule_h__ */