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/CSSFontFeatureValuesRule.h"
8 #include "mozilla/dom/CSSFontFeatureValuesRuleBinding.h"
9 #include "mozilla/ServoBindings.h"
10 
11 namespace mozilla {
12 namespace dom {
13 
SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const14 size_t CSSFontFeatureValuesRule::SizeOfIncludingThis(
15     MallocSizeOf aMallocSizeOf) const {
16   // TODO Implement this!
17   return aMallocSizeOf(this);
18 }
19 
20 #ifdef DEBUG
List(FILE * out,int32_t aIndent) const21 void CSSFontFeatureValuesRule::List(FILE* out, int32_t aIndent) const {
22   nsAutoCString str;
23   for (int32_t i = 0; i < aIndent; i++) {
24     str.AppendLiteral("  ");
25   }
26   Servo_FontFeatureValuesRule_Debug(mRawRule, &str);
27   fprintf_stderr(out, "%s\n", str.get());
28 }
29 #endif
30 
31 /* CSSRule implementation */
32 
GetCssText(nsAString & aCssText) const33 void CSSFontFeatureValuesRule::GetCssText(nsAString& aCssText) const {
34   Servo_FontFeatureValuesRule_GetCssText(mRawRule, &aCssText);
35 }
36 
37 /* CSSFontFeatureValuesRule implementation */
38 
GetFontFamily(nsAString & aFamilyListStr)39 void CSSFontFeatureValuesRule::GetFontFamily(nsAString& aFamilyListStr) {
40   Servo_FontFeatureValuesRule_GetFontFamily(mRawRule, &aFamilyListStr);
41 }
42 
GetValueText(nsAString & aValueText)43 void CSSFontFeatureValuesRule::GetValueText(nsAString& aValueText) {
44   Servo_FontFeatureValuesRule_GetValueText(mRawRule, &aValueText);
45 }
46 
SetFontFamily(const nsAString & aFontFamily,ErrorResult & aRv)47 void CSSFontFeatureValuesRule::SetFontFamily(const nsAString& aFontFamily,
48                                              ErrorResult& aRv) {
49   if (IsReadOnly()) {
50     return;
51   }
52 
53   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
54 }
55 
SetValueText(const nsAString & aValueText,ErrorResult & aRv)56 void CSSFontFeatureValuesRule::SetValueText(const nsAString& aValueText,
57                                             ErrorResult& aRv) {
58   if (IsReadOnly()) {
59     return;
60   }
61 
62   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
63 }
64 
65 // If this ever gets its own cycle-collection bits, reevaluate our IsCCLeaf
66 // implementation.
67 
IsCCLeaf() const68 bool CSSFontFeatureValuesRule::IsCCLeaf() const { return Rule::IsCCLeaf(); }
69 
70 /* virtual */
WrapObject(JSContext * aCx,JS::Handle<JSObject * > aGivenProto)71 JSObject* CSSFontFeatureValuesRule::WrapObject(
72     JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
73   return CSSFontFeatureValuesRule_Binding::Wrap(aCx, this, aGivenProto);
74 }
75 
76 }  // namespace dom
77 }  // namespace mozilla
78