Bug 1692937 [wpt PR 27636] - new parameter --include-file for wptrunner, a=testonly
[gecko.git] / layout / style / CSSSupportsRule.cpp
blobe1266c3957ab33794ae4780f0461033dd604cc19
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;
15 namespace mozilla {
16 namespace dom {
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)
32 #ifdef DEBUG
33 /* virtual */
34 void CSSSupportsRule::List(FILE* out, int32_t aIndent) const {
35 nsAutoCString str;
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());
42 #endif
44 void CSSSupportsRule::GetConditionText(nsACString& aConditionText) {
45 Servo_SupportsRule_GetConditionText(mRawRule, &aConditionText);
48 void CSSSupportsRule::SetConditionText(const nsACString& aConditionText,
49 ErrorResult& aRv) {
50 if (IsReadOnly()) {
51 return;
54 aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
57 /* virtual */
58 void CSSSupportsRule::GetCssText(nsACString& aCssText) const {
59 Servo_SupportsRule_GetCssText(mRawRule, &aCssText);
62 /* virtual */
63 size_t CSSSupportsRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
64 // TODO Implement this!
65 return aMallocSizeOf(this);
68 /* virtual */
69 JSObject* CSSSupportsRule::WrapObject(JSContext* aCx,
70 JS::Handle<JSObject*> aGivenProto) {
71 return CSSSupportsRule_Binding::Wrap(aCx, this, aGivenProto);
74 } // namespace dom
75 } // namespace mozilla