diff --git a/dom/interfaces/css/moz.build b/dom/interfaces/css/moz.build index 954dc725c4e0..5326a8974e1f 100644 --- a/dom/interfaces/css/moz.build +++ b/dom/interfaces/css/moz.build @@ -10,7 +10,6 @@ with Files("**"): XPIDL_SOURCES += [ 'nsIDOMCounter.idl', 'nsIDOMCSSKeyframeRule.idl', - 'nsIDOMCSSKeyframesRule.idl', 'nsIDOMCSSPageRule.idl', 'nsIDOMCSSPrimitiveValue.idl', 'nsIDOMCSSRule.idl', diff --git a/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl b/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl deleted file mode 100644 index 0e2d3bc4f2dd..000000000000 --- a/dom/interfaces/css/nsIDOMCSSKeyframesRule.idl +++ /dev/null @@ -1,20 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -interface nsIDOMCSSRuleList; -interface nsIDOMCSSKeyframeRule; - -[scriptable, uuid(400f4b70-ad0a-4047-aba4-ee8019f6b907)] -interface nsIDOMCSSKeyframesRule : nsISupports -{ - attribute DOMString name; - readonly attribute nsIDOMCSSRuleList cssRules; - - void appendRule(in DOMString rule); - void deleteRule(in DOMString key); - nsIDOMCSSKeyframeRule findRule(in DOMString key); -}; diff --git a/layout/style/CSSKeyframesRule.cpp b/layout/style/CSSKeyframesRule.cpp index 4725f5049f8d..139020c64338 100644 --- a/layout/style/CSSKeyframesRule.cpp +++ b/layout/style/CSSKeyframesRule.cpp @@ -11,29 +11,6 @@ namespace mozilla { namespace dom { -NS_IMPL_ADDREF_INHERITED(CSSKeyframesRule, css::GroupRule) -NS_IMPL_RELEASE_INHERITED(CSSKeyframesRule, css::GroupRule) - -// QueryInterface implementation for CSSKeyframesRule -NS_INTERFACE_MAP_BEGIN(CSSKeyframesRule) - NS_INTERFACE_MAP_ENTRY(nsIDOMCSSKeyframesRule) -NS_INTERFACE_MAP_END_INHERITING(GroupRule) - -NS_IMETHODIMP -CSSKeyframesRule::GetCssRules(nsIDOMCSSRuleList** aRuleList) -{ - NS_ADDREF(*aRuleList = CssRules()); - return NS_OK; -} - -NS_IMETHODIMP -CSSKeyframesRule::FindRule(const nsAString& aKey, - nsIDOMCSSKeyframeRule** aResult) -{ - NS_IF_ADDREF(*aResult = FindRule(aKey)); - return NS_OK; -} - /* virtual */ bool CSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext, nsMediaQueryResultCacheKey& aKey) diff --git a/layout/style/CSSKeyframesRule.h b/layout/style/CSSKeyframesRule.h index 45f30f0d7c44..2b9652aae4d2 100644 --- a/layout/style/CSSKeyframesRule.h +++ b/layout/style/CSSKeyframesRule.h @@ -8,7 +8,6 @@ #define mozilla_dom_CSSKeyframesRule_h #include "mozilla/css/GroupRule.h" -#include "nsIDOMCSSKeyframesRule.h" #include "mozilla/dom/CSSKeyframeRule.h" @@ -16,30 +15,22 @@ namespace mozilla { namespace dom { class CSSKeyframesRule : public css::GroupRule - , public nsIDOMCSSKeyframesRule { protected: using css::GroupRule::GroupRule; virtual ~CSSKeyframesRule() {} public: - NS_DECL_ISUPPORTS_INHERITED - int32_t GetType() const final { return Rule::KEYFRAMES_RULE; } using Rule::GetType; - // nsIDOMCSSKeyframesRule interface - NS_IMETHOD GetCssRules(nsIDOMCSSRuleList** aRuleList) final; - NS_IMETHOD FindRule(const nsAString& aKey, - nsIDOMCSSKeyframeRule** aResult) final; - // WebIDL interface uint16_t Type() const final { return nsIDOMCSSRule::KEYFRAMES_RULE; } - // The XPCOM GetName is OK - // The XPCOM SetName is OK + virtual void GetName(nsAString& aName) const = 0; + virtual void SetName(const nsAString& aName) = 0; virtual CSSRuleList* CssRules() = 0; - // The XPCOM appendRule is OK, since it never throws - using nsIDOMCSSKeyframesRule::DeleteRule; + virtual void AppendRule(const nsAString& aRule) = 0; + virtual void DeleteRule(const nsAString& aKey) = 0; virtual CSSKeyframeRule* FindRule(const nsAString& aKey) = 0; bool UseForPresentation(nsPresContext* aPresContext, diff --git a/layout/style/ServoKeyframesRule.cpp b/layout/style/ServoKeyframesRule.cpp index dfc836b0e090..d369be574cc0 100644 --- a/layout/style/ServoKeyframesRule.cpp +++ b/layout/style/ServoKeyframesRule.cpp @@ -256,36 +256,34 @@ ServoKeyframesRule::UpdateRule(Func aCallback) } } -NS_IMETHODIMP -ServoKeyframesRule::GetName(nsAString& aName) +void +ServoKeyframesRule::GetName(nsAString& aName) const { nsAtom* name = Servo_KeyframesRule_GetName(mRawRule); aName = nsDependentAtomString(name); - return NS_OK; } -NS_IMETHODIMP +void ServoKeyframesRule::SetName(const nsAString& aName) { RefPtr name = NS_Atomize(aName); nsAtom* oldName = Servo_KeyframesRule_GetName(mRawRule); if (name == oldName) { - return NS_OK; + return; } UpdateRule([this, &name]() { Servo_KeyframesRule_SetName(mRawRule, name.forget().take()); }); - return NS_OK; } -NS_IMETHODIMP +void ServoKeyframesRule::AppendRule(const nsAString& aRule) { StyleSheet* sheet = GetStyleSheet(); if (!sheet) { // We cannot parse the rule if we don't have a stylesheet. - return NS_OK; + return; } NS_ConvertUTF16toUTF8 rule(aRule); @@ -296,15 +294,14 @@ ServoKeyframesRule::AppendRule(const nsAString& aRule) mKeyframeList->AppendRule(); } }); - return NS_OK; } -NS_IMETHODIMP +void ServoKeyframesRule::DeleteRule(const nsAString& aKey) { auto index = FindRuleIndexForKey(aKey); if (index == kRuleNotFound) { - return NS_OK; + return; } UpdateRule([this, index]() { @@ -313,7 +310,6 @@ ServoKeyframesRule::DeleteRule(const nsAString& aKey) mKeyframeList->RemoveRule(index); } }); - return NS_OK; } /* virtual */ void diff --git a/layout/style/ServoKeyframesRule.h b/layout/style/ServoKeyframesRule.h index 4581e2dc6924..eda34c3a631c 100644 --- a/layout/style/ServoKeyframesRule.h +++ b/layout/style/ServoKeyframesRule.h @@ -31,16 +31,13 @@ public: #endif void SetStyleSheet(StyleSheet* aSheet) final; - // nsIDOMCSSKeyframesRule interface - NS_IMETHOD GetName(nsAString& aName) final; - NS_IMETHOD SetName(const nsAString& aName) final; - NS_IMETHOD AppendRule(const nsAString& aRule) final; - NS_IMETHOD DeleteRule(const nsAString& aKey) final; - using nsIDOMCSSKeyframesRule::FindRule; - // WebIDL interface void GetCssTextImpl(nsAString& aCssText) const final; + void GetName(nsAString& aName) const final; + void SetName(const nsAString& aName) final; dom::CSSRuleList* CssRules() final; + void AppendRule(const nsAString& aRule) final; + void DeleteRule(const nsAString& aKey) final; dom::CSSKeyframeRule* FindRule(const nsAString& aKey) final; size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const final; diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 83e37ed56134..a176213e7368 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -1109,13 +1109,6 @@ nsCSSKeyframesRule::Clone() const return clone.forget(); } -NS_IMPL_ADDREF_INHERITED(nsCSSKeyframesRule, dom::CSSKeyframesRule) -NS_IMPL_RELEASE_INHERITED(nsCSSKeyframesRule, dom::CSSKeyframesRule) - -// QueryInterface implementation for nsCSSKeyframesRule -NS_INTERFACE_MAP_BEGIN(nsCSSKeyframesRule) -NS_INTERFACE_MAP_END_INHERITING(dom::CSSKeyframesRule) - #ifdef DEBUG void nsCSSKeyframesRule::List(FILE* out, int32_t aIndent) const @@ -1149,18 +1142,17 @@ nsCSSKeyframesRule::GetCssTextImpl(nsAString& aCssText) const aCssText.Append('}'); } -NS_IMETHODIMP -nsCSSKeyframesRule::GetName(nsAString& aName) +void +nsCSSKeyframesRule::GetName(nsAString& aName) const { mName->ToString(aName); - return NS_OK; } -NS_IMETHODIMP +void nsCSSKeyframesRule::SetName(const nsAString& aName) { if (mName->Equals(aName)) { - return NS_OK; + return; } nsIDocument* doc = GetDocument(); @@ -1171,11 +1163,9 @@ nsCSSKeyframesRule::SetName(const nsAString& aName) if (StyleSheet* sheet = GetStyleSheet()) { sheet->RuleChanged(this); } - - return NS_OK; } -NS_IMETHODIMP +void nsCSSKeyframesRule::AppendRule(const nsAString& aRule) { // The spec is confusing, and I think we should just append the rule, @@ -1196,8 +1186,6 @@ nsCSSKeyframesRule::AppendRule(const nsAString& aRule) sheet->RuleChanged(this); } } - - return NS_OK; } static const uint32_t RULE_NOT_FOUND = uint32_t(-1); @@ -1226,7 +1214,7 @@ nsCSSKeyframesRule::FindRuleIndexForKey(const nsAString& aKey) return RULE_NOT_FOUND; } -NS_IMETHODIMP +void nsCSSKeyframesRule::DeleteRule(const nsAString& aKey) { uint32_t index = FindRuleIndexForKey(aKey); @@ -1240,7 +1228,6 @@ nsCSSKeyframesRule::DeleteRule(const nsAString& aKey) sheet->RuleChanged(this); } } - return NS_OK; } nsCSSKeyframeRule* diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index f70dace862ea..5891cb094e50 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -296,24 +296,19 @@ private: nsCSSKeyframesRule(const nsCSSKeyframesRule& aCopy); ~nsCSSKeyframesRule(); public: - NS_DECL_ISUPPORTS_INHERITED - // Rule methods #ifdef DEBUG virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override; #endif virtual already_AddRefed Clone() const override; - // nsIDOMCSSKeyframesRule interface - NS_IMETHOD GetName(nsAString& aName) final; - NS_IMETHOD SetName(const nsAString& aName) final; - NS_IMETHOD AppendRule(const nsAString& aRule) final; - NS_IMETHOD DeleteRule(const nsAString& aKey) final; - using nsIDOMCSSKeyframesRule::FindRule; - // WebIDL interface void GetCssTextImpl(nsAString& aCssText) const final; + void GetName(nsAString& aName) const final; + void SetName(const nsAString& aName) final; mozilla::dom::CSSRuleList* CssRules() final { return GroupRule::CssRules(); } + void AppendRule(const nsAString& aRule) final; + void DeleteRule(const nsAString& aKey) final; nsCSSKeyframeRule* FindRule(const nsAString& aKey) final; const nsAtom* GetName() const { return mName; }