Bug 1874684 - Part 37: Fix unified compilation. r=allstarschh
[gecko.git] / layout / style / CSSLayerStatementRule.cpp
blob55e3d6159a6ec0196b04d62ac209bd58ca26e897
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/CSSLayerStatementRule.h"
8 #include "mozilla/dom/CSSLayerStatementRuleBinding.h"
9 #include "mozilla/ServoBindings.h"
11 namespace mozilla::dom {
13 CSSLayerStatementRule::CSSLayerStatementRule(
14 RefPtr<StyleLayerStatementRule> aRawRule, StyleSheet* aSheet,
15 css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn)
16 : Rule(aSheet, aParentRule, aLine, aColumn),
17 mRawRule(std::move(aRawRule)) {}
19 NS_IMPL_ADDREF_INHERITED(CSSLayerStatementRule, Rule)
20 NS_IMPL_RELEASE_INHERITED(CSSLayerStatementRule, Rule)
22 // QueryInterface implementation for SupportsRule
23 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSLayerStatementRule)
24 NS_INTERFACE_MAP_END_INHERITING(Rule)
26 #ifdef DEBUG
27 void CSSLayerStatementRule::List(FILE* out, int32_t aIndent) const {
28 nsAutoCString str;
29 for (int32_t i = 0; i < aIndent; i++) {
30 str.AppendLiteral(" ");
32 Servo_LayerStatementRule_Debug(mRawRule, &str);
33 fprintf_stderr(out, "%s\n", str.get());
35 #endif
37 StyleCssRuleType CSSLayerStatementRule::Type() const {
38 return StyleCssRuleType::LayerStatement;
41 void CSSLayerStatementRule::SetRawAfterClone(
42 RefPtr<StyleLayerStatementRule> aRaw) {
43 mRawRule = std::move(aRaw);
46 void CSSLayerStatementRule::GetCssText(nsACString& aCssText) const {
47 Servo_LayerStatementRule_GetCssText(mRawRule.get(), &aCssText);
50 void CSSLayerStatementRule::GetNameList(nsTArray<nsCString>& aNames) const {
51 size_t size = Servo_LayerStatementRule_GetNameCount(mRawRule.get());
52 for (size_t i = 0; i < size; ++i) {
53 Servo_LayerStatementRule_GetNameAt(mRawRule.get(), i,
54 aNames.AppendElement());
58 size_t CSSLayerStatementRule::SizeOfIncludingThis(
59 MallocSizeOf aMallocSizeOf) const {
60 return aMallocSizeOf(this);
63 JSObject* CSSLayerStatementRule::WrapObject(JSContext* aCx,
64 JS::Handle<JSObject*> aGivenProto) {
65 return CSSLayerStatementRule_Binding::Wrap(aCx, this, aGivenProto);
68 } // namespace mozilla::dom