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 #include "mozilla/dom/CSSLayerBlockRule.h"
8 #include "mozilla/dom/CSSLayerBlockRuleBinding.h"
9 #include "mozilla/ServoBindings.h"
11 namespace mozilla::dom
{
13 CSSLayerBlockRule::CSSLayerBlockRule(RefPtr
<StyleLayerBlockRule
> aRawRule
,
14 StyleSheet
* aSheet
, css::Rule
* aParentRule
,
15 uint32_t aLine
, uint32_t aColumn
)
16 : css::GroupRule(aSheet
, aParentRule
, aLine
, aColumn
),
17 mRawRule(std::move(aRawRule
)) {}
19 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(CSSLayerBlockRule
,
22 // QueryInterface implementation for SupportsRule
25 void CSSLayerBlockRule::List(FILE* out
, int32_t aIndent
) const {
27 for (int32_t i
= 0; i
< aIndent
; i
++) {
28 str
.AppendLiteral(" ");
30 Servo_LayerBlockRule_Debug(mRawRule
, &str
);
31 fprintf_stderr(out
, "%s\n", str
.get());
35 StyleCssRuleType
CSSLayerBlockRule::Type() const {
36 return StyleCssRuleType::LayerBlock
;
39 already_AddRefed
<StyleLockedCssRules
> CSSLayerBlockRule::GetOrCreateRawRules() {
40 return Servo_LayerBlockRule_GetRules(mRawRule
).Consume();
43 void CSSLayerBlockRule::SetRawAfterClone(RefPtr
<StyleLayerBlockRule
> aRaw
) {
44 mRawRule
= std::move(aRaw
);
45 css::GroupRule::DidSetRawAfterClone();
48 void CSSLayerBlockRule::GetCssText(nsACString
& aCssText
) const {
49 Servo_LayerBlockRule_GetCssText(mRawRule
.get(), &aCssText
);
52 void CSSLayerBlockRule::GetName(nsACString
& aName
) const {
53 Servo_LayerBlockRule_GetName(mRawRule
.get(), &aName
);
56 size_t CSSLayerBlockRule::SizeOfIncludingThis(
57 MallocSizeOf aMallocSizeOf
) const {
58 return aMallocSizeOf(this);
61 JSObject
* CSSLayerBlockRule::WrapObject(JSContext
* aCx
,
62 JS::Handle
<JSObject
*> aGivenProto
) {
63 return CSSLayerBlockRule_Binding::Wrap(aCx
, this, aGivenProto
);
66 } // namespace mozilla::dom