1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_CSSNamespaceRule_h
8 #define mozilla_dom_CSSNamespaceRule_h
10 #include "mozilla/css/Rule.h"
11 #include "mozilla/dom/CSSNamespaceRuleBinding.h"
12 #include "mozilla/ServoBindingTypes.h"
19 class CSSNamespaceRule final
: public css::Rule
{
21 CSSNamespaceRule(already_AddRefed
<RawServoNamespaceRule
> aRule
,
22 StyleSheet
* aSheet
, css::Rule
* aParentRule
, uint32_t aLine
,
24 : css::Rule(aSheet
, aParentRule
, aLine
, aColumn
),
25 mRawRule(std::move(aRule
)) {}
27 bool IsCCLeaf() const final
{ return Rule::IsCCLeaf(); }
30 void List(FILE* out
= stdout
, int32_t aIndent
= 0) const final
;
33 nsAtom
* GetPrefix() const;
34 void GetURLSpec(nsString
& aURLSpec
) const;
37 void GetCssText(nsACString
& aCssText
) const final
;
40 uint16_t Type() const final
{ return CSSRule_Binding::NAMESPACE_RULE
; }
42 const RawServoNamespaceRule
* Raw() const { return mRawRule
.get(); }
44 void GetNamespaceURI(nsString
& aNamespaceURI
) { GetURLSpec(aNamespaceURI
); }
46 void GetPrefix(DOMString
& aPrefix
) {
47 aPrefix
.SetKnownLiveAtom(GetPrefix(), DOMString::eTreatNullAsEmpty
);
50 size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf
) const final
;
52 JSObject
* WrapObject(JSContext
* aCx
,
53 JS::Handle
<JSObject
*> aGivenProto
) final
{
54 return CSSNamespaceRule_Binding::Wrap(aCx
, this, aGivenProto
);
59 RefPtr
<RawServoNamespaceRule
> mRawRule
;
63 } // namespace mozilla
65 #endif // mozilla_dom_CSSNamespaceRule_h