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/CSSSupportsRule.h"
9 #include "mozilla/css/GroupRule.h"
10 #include "mozilla/dom/CSSSupportsRuleBinding.h"
11 #include "mozilla/ServoBindings.h"
13 using namespace mozilla::css
;
18 CSSSupportsRule::CSSSupportsRule(RefPtr
<RawServoSupportsRule
> aRawRule
,
19 StyleSheet
* aSheet
, css::Rule
* aParentRule
,
20 uint32_t aLine
, uint32_t aColumn
)
21 : css::ConditionRule(Servo_SupportsRule_GetRules(aRawRule
).Consume(),
22 aSheet
, aParentRule
, aLine
, aColumn
),
23 mRawRule(std::move(aRawRule
)) {}
25 NS_IMPL_ADDREF_INHERITED(CSSSupportsRule
, ConditionRule
)
26 NS_IMPL_RELEASE_INHERITED(CSSSupportsRule
, ConditionRule
)
28 // QueryInterface implementation for SupportsRule
29 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSSupportsRule
)
30 NS_INTERFACE_MAP_END_INHERITING(ConditionRule
)
34 void CSSSupportsRule::List(FILE* out
, int32_t aIndent
) const {
36 for (int32_t i
= 0; i
< aIndent
; i
++) {
37 str
.AppendLiteral(" ");
39 Servo_SupportsRule_Debug(mRawRule
, &str
);
40 fprintf_stderr(out
, "%s\n", str
.get());
44 void CSSSupportsRule::GetConditionText(nsACString
& aConditionText
) {
45 Servo_SupportsRule_GetConditionText(mRawRule
, &aConditionText
);
48 void CSSSupportsRule::SetConditionText(const nsACString
& aConditionText
,
54 aRv
.Throw(NS_ERROR_NOT_IMPLEMENTED
);
58 void CSSSupportsRule::GetCssText(nsACString
& aCssText
) const {
59 Servo_SupportsRule_GetCssText(mRawRule
, &aCssText
);
63 size_t CSSSupportsRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf
) const {
64 // TODO Implement this!
65 return aMallocSizeOf(this);
69 JSObject
* CSSSupportsRule::WrapObject(JSContext
* aCx
,
70 JS::Handle
<JSObject
*> aGivenProto
) {
71 return CSSSupportsRule_Binding::Wrap(aCx
, this, aGivenProto
);
75 } // namespace mozilla