CSSLayerBlockRule.cpp (2249B)
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/. */ 6 7 #include "mozilla/dom/CSSLayerBlockRule.h" 8 9 #include "mozilla/ServoBindings.h" 10 #include "mozilla/dom/CSSLayerBlockRuleBinding.h" 11 12 namespace mozilla::dom { 13 14 CSSLayerBlockRule::CSSLayerBlockRule(RefPtr<StyleLayerBlockRule> aRawRule, 15 StyleSheet* aSheet, css::Rule* aParentRule, 16 uint32_t aLine, uint32_t aColumn) 17 : css::GroupRule(aSheet, aParentRule, aLine, aColumn), 18 mRawRule(std::move(aRawRule)) {} 19 20 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(CSSLayerBlockRule, 21 css::GroupRule) 22 23 // QueryInterface implementation for SupportsRule 24 25 #ifdef DEBUG 26 void CSSLayerBlockRule::List(FILE* out, int32_t aIndent) const { 27 nsAutoCString str; 28 for (int32_t i = 0; i < aIndent; i++) { 29 str.AppendLiteral(" "); 30 } 31 Servo_LayerBlockRule_Debug(mRawRule, &str); 32 fprintf_stderr(out, "%s\n", str.get()); 33 } 34 #endif 35 36 StyleCssRuleType CSSLayerBlockRule::Type() const { 37 return StyleCssRuleType::LayerBlock; 38 } 39 40 already_AddRefed<StyleLockedCssRules> CSSLayerBlockRule::GetOrCreateRawRules() { 41 return Servo_LayerBlockRule_GetRules(mRawRule).Consume(); 42 } 43 44 void CSSLayerBlockRule::SetRawAfterClone(RefPtr<StyleLayerBlockRule> aRaw) { 45 mRawRule = std::move(aRaw); 46 css::GroupRule::DidSetRawAfterClone(); 47 } 48 49 void CSSLayerBlockRule::GetCssText(nsACString& aCssText) const { 50 Servo_LayerBlockRule_GetCssText(mRawRule.get(), &aCssText); 51 } 52 53 void CSSLayerBlockRule::GetName(nsACString& aName) const { 54 Servo_LayerBlockRule_GetName(mRawRule.get(), &aName); 55 } 56 57 size_t CSSLayerBlockRule::SizeOfIncludingThis( 58 MallocSizeOf aMallocSizeOf) const { 59 return aMallocSizeOf(this); 60 } 61 62 JSObject* CSSLayerBlockRule::WrapObject(JSContext* aCx, 63 JS::Handle<JSObject*> aGivenProto) { 64 return CSSLayerBlockRule_Binding::Wrap(aCx, this, aGivenProto); 65 } 66 67 } // namespace mozilla::dom