layout/style/NameSpaceRule.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/style/NameSpaceRule.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,72 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +/* class for CSS @namespace rules */
    1.10 +
    1.11 +#ifndef mozilla_css_NameSpaceRule_h__
    1.12 +#define mozilla_css_NameSpaceRule_h__
    1.13 +
    1.14 +#include "mozilla/Attributes.h"
    1.15 +#include "mozilla/MemoryReporting.h"
    1.16 +#include "mozilla/css/Rule.h"
    1.17 +
    1.18 +#include "nsIDOMCSSRule.h"
    1.19 +
    1.20 +class nsIAtom;
    1.21 +
    1.22 +// IID for the NameSpaceRule class {f0b0dbe1-5031-4a21-b06a-dc141ef2af98}
    1.23 +#define NS_CSS_NAMESPACE_RULE_IMPL_CID     \
    1.24 +{0xf0b0dbe1, 0x5031, 0x4a21, {0xb0, 0x6a, 0xdc, 0x14, 0x1e, 0xf2, 0xaf, 0x98}}
    1.25 +
    1.26 +
    1.27 +namespace mozilla {
    1.28 +namespace css {
    1.29 +
    1.30 +class NameSpaceRule MOZ_FINAL : public Rule,
    1.31 +                                public nsIDOMCSSRule
    1.32 +{
    1.33 +public:
    1.34 +  NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec);
    1.35 +private:
    1.36 +  // for |Clone|
    1.37 +  NameSpaceRule(const NameSpaceRule& aCopy);
    1.38 +  ~NameSpaceRule();
    1.39 +public:
    1.40 +  NS_DECLARE_STATIC_IID_ACCESSOR(NS_CSS_NAMESPACE_RULE_IMPL_CID)
    1.41 +
    1.42 +  NS_DECL_ISUPPORTS
    1.43 +
    1.44 +  DECL_STYLE_RULE_INHERIT
    1.45 +
    1.46 +  // nsIStyleRule methods
    1.47 +#ifdef DEBUG
    1.48 +  virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
    1.49 +#endif
    1.50 +
    1.51 +  // Rule methods
    1.52 +  virtual int32_t GetType() const;
    1.53 +  virtual already_AddRefed<Rule> Clone() const;
    1.54 +
    1.55 +  nsIAtom* GetPrefix() const { return mPrefix; }
    1.56 +
    1.57 +  void GetURLSpec(nsString& aURLSpec) const { aURLSpec = mURLSpec; }
    1.58 +
    1.59 +  virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
    1.60 +    MOZ_MUST_OVERRIDE;
    1.61 +
    1.62 +  // nsIDOMCSSRule interface
    1.63 +  NS_DECL_NSIDOMCSSRULE
    1.64 +
    1.65 +private:
    1.66 +  nsCOMPtr<nsIAtom> mPrefix;
    1.67 +  nsString          mURLSpec;
    1.68 +};
    1.69 +
    1.70 +NS_DEFINE_STATIC_IID_ACCESSOR(NameSpaceRule, NS_CSS_NAMESPACE_RULE_IMPL_CID)
    1.71 +
    1.72 +} // namespace css
    1.73 +} // namespace mozilla
    1.74 +
    1.75 +#endif /* mozilla_css_NameSpaceRule_h__ */

mercurial