CSSFontPaletteValuesRule.cpp (2381B)
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/CSSFontPaletteValuesRule.h" 8 9 #include "mozilla/ServoBindings.h" 10 #include "mozilla/dom/CSSFontPaletteValuesRuleBinding.h" 11 12 namespace mozilla::dom { 13 14 size_t CSSFontPaletteValuesRule::SizeOfIncludingThis( 15 MallocSizeOf aMallocSizeOf) const { 16 // TODO Implement this! 17 return aMallocSizeOf(this); 18 } 19 20 StyleCssRuleType CSSFontPaletteValuesRule::Type() const { 21 return StyleCssRuleType::FontPaletteValues; 22 } 23 24 #ifdef DEBUG 25 void CSSFontPaletteValuesRule::List(FILE* out, int32_t aIndent) const { 26 nsAutoCString str; 27 for (int32_t i = 0; i < aIndent; i++) { 28 str.AppendLiteral(" "); 29 } 30 Servo_FontPaletteValuesRule_Debug(mRawRule, &str); 31 fprintf_stderr(out, "%s\n", str.get()); 32 } 33 #endif 34 35 void CSSFontPaletteValuesRule::SetRawAfterClone( 36 RefPtr<StyleFontPaletteValuesRule> aRaw) { 37 mRawRule = std::move(aRaw); 38 } 39 40 /* CSSRule implementation */ 41 42 void CSSFontPaletteValuesRule::GetCssText(nsACString& aCssText) const { 43 Servo_FontPaletteValuesRule_GetCssText(mRawRule, &aCssText); 44 } 45 46 /* CSSFontPaletteValuesRule implementation */ 47 48 void CSSFontPaletteValuesRule::GetName(nsACString& aNameStr) const { 49 Servo_FontPaletteValuesRule_GetName(mRawRule, &aNameStr); 50 } 51 52 void CSSFontPaletteValuesRule::GetFontFamily(nsACString& aFamilyListStr) const { 53 Servo_FontPaletteValuesRule_GetFontFamily(mRawRule, &aFamilyListStr); 54 } 55 56 void CSSFontPaletteValuesRule::GetBasePalette(nsACString& aPaletteStr) const { 57 Servo_FontPaletteValuesRule_GetBasePalette(mRawRule, &aPaletteStr); 58 } 59 60 void CSSFontPaletteValuesRule::GetOverrideColors(nsACString& aColorsStr) const { 61 Servo_FontPaletteValuesRule_GetOverrideColors(mRawRule, &aColorsStr); 62 } 63 64 // If this ever gets its own cycle-collection bits, reevaluate our IsCCLeaf 65 // implementation. 66 67 bool CSSFontPaletteValuesRule::IsCCLeaf() const { return Rule::IsCCLeaf(); } 68 69 /* virtual */ 70 JSObject* CSSFontPaletteValuesRule::WrapObject( 71 JSContext* aCx, JS::Handle<JSObject*> aGivenProto) { 72 return CSSFontPaletteValuesRule_Binding::Wrap(aCx, this, aGivenProto); 73 } 74 75 } // namespace mozilla::dom