From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- layout/style/CSSLayerStatementRule.cpp | 68 ++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 layout/style/CSSLayerStatementRule.cpp (limited to 'layout/style/CSSLayerStatementRule.cpp') diff --git a/layout/style/CSSLayerStatementRule.cpp b/layout/style/CSSLayerStatementRule.cpp new file mode 100644 index 0000000000..55e3d6159a --- /dev/null +++ b/layout/style/CSSLayerStatementRule.cpp @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/dom/CSSLayerStatementRule.h" +#include "mozilla/dom/CSSLayerStatementRuleBinding.h" +#include "mozilla/ServoBindings.h" + +namespace mozilla::dom { + +CSSLayerStatementRule::CSSLayerStatementRule( + RefPtr aRawRule, StyleSheet* aSheet, + css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn) + : Rule(aSheet, aParentRule, aLine, aColumn), + mRawRule(std::move(aRawRule)) {} + +NS_IMPL_ADDREF_INHERITED(CSSLayerStatementRule, Rule) +NS_IMPL_RELEASE_INHERITED(CSSLayerStatementRule, Rule) + +// QueryInterface implementation for SupportsRule +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSLayerStatementRule) +NS_INTERFACE_MAP_END_INHERITING(Rule) + +#ifdef DEBUG +void CSSLayerStatementRule::List(FILE* out, int32_t aIndent) const { + nsAutoCString str; + for (int32_t i = 0; i < aIndent; i++) { + str.AppendLiteral(" "); + } + Servo_LayerStatementRule_Debug(mRawRule, &str); + fprintf_stderr(out, "%s\n", str.get()); +} +#endif + +StyleCssRuleType CSSLayerStatementRule::Type() const { + return StyleCssRuleType::LayerStatement; +} + +void CSSLayerStatementRule::SetRawAfterClone( + RefPtr aRaw) { + mRawRule = std::move(aRaw); +} + +void CSSLayerStatementRule::GetCssText(nsACString& aCssText) const { + Servo_LayerStatementRule_GetCssText(mRawRule.get(), &aCssText); +} + +void CSSLayerStatementRule::GetNameList(nsTArray& aNames) const { + size_t size = Servo_LayerStatementRule_GetNameCount(mRawRule.get()); + for (size_t i = 0; i < size; ++i) { + Servo_LayerStatementRule_GetNameAt(mRawRule.get(), i, + aNames.AppendElement()); + } +} + +size_t CSSLayerStatementRule::SizeOfIncludingThis( + MallocSizeOf aMallocSizeOf) const { + return aMallocSizeOf(this); +} + +JSObject* CSSLayerStatementRule::WrapObject(JSContext* aCx, + JS::Handle aGivenProto) { + return CSSLayerStatementRule_Binding::Wrap(aCx, this, aGivenProto); +} + +} // namespace mozilla::dom -- cgit v1.2.3