Line data Source code
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 : /* representation of CSSSupportsRule for stylo */
8 :
9 : #include "mozilla/ServoSupportsRule.h"
10 :
11 : #include "mozilla/ServoBindings.h"
12 :
13 : using namespace mozilla::dom;
14 :
15 : namespace mozilla {
16 :
17 0 : ServoSupportsRule::ServoSupportsRule(RefPtr<RawServoSupportsRule> aRawRule,
18 0 : uint32_t aLine, uint32_t aColumn)
19 0 : : CSSSupportsRule(Servo_SupportsRule_GetRules(aRawRule).Consume())
20 0 : , mRawRule(Move(aRawRule))
21 : {
22 0 : }
23 :
24 0 : ServoSupportsRule::~ServoSupportsRule()
25 : {
26 0 : }
27 :
28 0 : NS_IMPL_ADDREF_INHERITED(ServoSupportsRule, CSSSupportsRule)
29 0 : NS_IMPL_RELEASE_INHERITED(ServoSupportsRule, CSSSupportsRule)
30 :
31 : // QueryInterface implementation for SupportsRule
32 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ServoSupportsRule)
33 0 : NS_INTERFACE_MAP_END_INHERITING(CSSSupportsRule)
34 :
35 : /* virtual */ already_AddRefed<css::Rule>
36 0 : ServoSupportsRule::Clone() const
37 : {
38 : // Rule::Clone is only used when CSSStyleSheetInner is cloned in
39 : // preparation of being mutated. However, ServoStyleSheet never clones
40 : // anything, so this method should never be called.
41 0 : MOZ_ASSERT_UNREACHABLE("Shouldn't be cloning ServoSupportsRule");
42 : return nullptr;
43 : }
44 :
45 : /* virtual */ bool
46 0 : ServoSupportsRule::UseForPresentation(nsPresContext* aPresContext,
47 : nsMediaQueryResultCacheKey& aKey)
48 : {
49 : // GroupRule::UseForPresentation is only used in nsCSSRuleProcessor,
50 : // so this should never be called.
51 0 : MOZ_ASSERT_UNREACHABLE("Shouldn't be calling UseForPresentation");
52 : return false;
53 : }
54 :
55 : #ifdef DEBUG
56 : /* virtual */ void
57 0 : ServoSupportsRule::List(FILE* out, int32_t aIndent) const
58 : {
59 0 : nsAutoCString str;
60 0 : for (int32_t i = 0; i < aIndent; i++) {
61 0 : str.AppendLiteral(" ");
62 : }
63 0 : Servo_SupportsRule_Debug(mRawRule, &str);
64 0 : fprintf_stderr(out, "%s\n", str.get());
65 0 : }
66 : #endif
67 :
68 : // nsIDOMCSSConditionRule methods
69 :
70 : NS_IMETHODIMP
71 0 : ServoSupportsRule::GetConditionText(nsAString& aConditionText)
72 : {
73 0 : Servo_SupportsRule_GetConditionText(mRawRule, &aConditionText);
74 0 : return NS_OK;
75 : }
76 :
77 : NS_IMETHODIMP
78 0 : ServoSupportsRule::SetConditionText(const nsAString& aConditionText)
79 : {
80 0 : return NS_ERROR_NOT_IMPLEMENTED;
81 : }
82 :
83 : /* virtual */ void
84 0 : ServoSupportsRule::GetCssTextImpl(nsAString& aCssText) const
85 : {
86 0 : Servo_SupportsRule_GetCssText(mRawRule, &aCssText);
87 0 : }
88 :
89 : /* virtual */ size_t
90 0 : ServoSupportsRule::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
91 : const
92 : {
93 : // TODO Implement this!
94 0 : return aMallocSizeOf(this);
95 : }
96 :
97 : } // namespace mozilla
|