Bug 1700051: part 35) Reduce accessibility of `mSoftText.mDOMMapping` to `private...
[gecko.git] / layout / style / CSSCounterStyleRule.cpp
blob531988aa725bed4a8198d3c9de3db7df967d8776
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/CSSCounterStyleRule.h"
9 #include "mozAutoDocUpdate.h"
10 #include "mozilla/dom/CSSCounterStyleRuleBinding.h"
11 #include "mozilla/ServoBindings.h"
12 #include "nsStyleUtil.h"
14 namespace mozilla {
15 namespace dom {
17 bool CSSCounterStyleRule::IsCCLeaf() const { return Rule::IsCCLeaf(); }
19 #ifdef DEBUG
20 void CSSCounterStyleRule::List(FILE* out, int32_t aIndent) const {
21 nsAutoCString str;
22 for (int32_t i = 0; i < aIndent; i++) {
23 str.AppendLiteral(" ");
25 Servo_CounterStyleRule_Debug(mRawRule, &str);
26 fprintf_stderr(out, "%s\n", str.get());
28 #endif
30 uint16_t CSSCounterStyleRule::Type() const {
31 return CSSRule_Binding::COUNTER_STYLE_RULE;
34 void CSSCounterStyleRule::GetCssText(nsACString& aCssText) const {
35 Servo_CounterStyleRule_GetCssText(mRawRule, &aCssText);
38 void CSSCounterStyleRule::GetName(nsAString& aName) {
39 aName.Truncate();
40 nsAtom* name = Servo_CounterStyleRule_GetName(mRawRule);
41 nsDependentAtomString nameStr(name);
42 nsStyleUtil::AppendEscapedCSSIdent(nameStr, aName);
45 void CSSCounterStyleRule::SetName(const nsAString& aName) {
46 if (IsReadOnly()) {
47 return;
49 NS_ConvertUTF16toUTF8 name(aName);
50 if (Servo_CounterStyleRule_SetName(mRawRule, &name)) {
51 if (StyleSheet* sheet = GetStyleSheet()) {
52 sheet->RuleChanged(this, StyleRuleChangeKind::Generic);
57 #define CSS_COUNTER_DESC(name_, method_) \
58 void CSSCounterStyleRule::Get##method_(nsACString& aValue) { \
59 MOZ_ASSERT(aValue.IsEmpty()); \
60 Servo_CounterStyleRule_GetDescriptorCssText( \
61 mRawRule, eCSSCounterDesc_##method_, &aValue); \
62 } \
63 void CSSCounterStyleRule::Set##method_(const nsACString& aValue) { \
64 if (IsReadOnly()) { \
65 return; \
66 } \
67 if (Servo_CounterStyleRule_SetDescriptor( \
68 mRawRule, eCSSCounterDesc_##method_, &aValue)) { \
69 if (StyleSheet* sheet = GetStyleSheet()) { \
70 sheet->RuleChanged(this, StyleRuleChangeKind::Generic); \
71 } \
72 } \
74 #include "nsCSSCounterDescList.h"
75 #undef CSS_COUNTER_DESC
77 /* virtual */
78 size_t CSSCounterStyleRule::SizeOfIncludingThis(
79 MallocSizeOf aMallocSizeOf) const {
80 return aMallocSizeOf(this);
83 /* virtual */
84 JSObject* CSSCounterStyleRule::WrapObject(JSContext* aCx,
85 JS::Handle<JSObject*> aGivenProto) {
86 return CSSCounterStyleRule_Binding::Wrap(aCx, this, aGivenProto);
89 } // namespace dom
90 } // namespace mozilla