Bug 1427512 - Part 10: Remove nsIDOMCSSKeyframesRule. r=xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 01 Jan 2018 19:54:45 +1100
changeset 717711 1ee6a3d4c2441e36be2e94ad285af32f2b391120
parent 717710 58f100100fcb1b61a10a2c5400ef8ea284e378c5
child 717712 d6a16421092dec14aafbf412ddcc3a49d7ef04aa
push id94746
push userbmo:cam@mcc.id.au
push dateTue, 09 Jan 2018 10:21:54 +0000
reviewersxidorn
bugs1427512
milestone59.0a1
Bug 1427512 - Part 10: Remove nsIDOMCSSKeyframesRule. r=xidorn MozReview-Commit-ID: 1U6Jd0Y6AlR
dom/interfaces/css/moz.build
dom/interfaces/css/nsIDOMCSSKeyframesRule.idl
layout/style/CSSKeyframesRule.cpp
layout/style/CSSKeyframesRule.h
layout/style/ServoKeyframesRule.cpp
layout/style/ServoKeyframesRule.h
layout/style/nsCSSRules.cpp
layout/style/nsCSSRules.h
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -5,17 +5,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
 
 XPIDL_SOURCES += [
     'nsIDOMCounter.idl',
     'nsIDOMCSSKeyframeRule.idl',
-    'nsIDOMCSSKeyframesRule.idl',
     'nsIDOMCSSPageRule.idl',
     'nsIDOMCSSPrimitiveValue.idl',
     'nsIDOMCSSRule.idl',
     'nsIDOMCSSRuleList.idl',
     'nsIDOMCSSStyleDeclaration.idl',
     'nsIDOMCSSStyleRule.idl',
     'nsIDOMCSSStyleSheet.idl',
     'nsIDOMCSSUnknownRule.idl',
deleted file mode 100644
--- 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);
-};
--- a/layout/style/CSSKeyframesRule.cpp
+++ b/layout/style/CSSKeyframesRule.cpp
@@ -6,39 +6,16 @@
 
 #include "mozilla/dom/CSSKeyframesRule.h"
 
 #include "mozilla/dom/CSSKeyframesRuleBinding.h"
 
 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)
 {
   MOZ_ASSERT_UNREACHABLE("should not be called");
   return false;
 }
 
--- a/layout/style/CSSKeyframesRule.h
+++ b/layout/style/CSSKeyframesRule.h
@@ -3,48 +3,39 @@
 /* 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/. */
 
 #ifndef mozilla_dom_CSSKeyframesRule_h
 #define mozilla_dom_CSSKeyframesRule_h
 
 #include "mozilla/css/GroupRule.h"
-#include "nsIDOMCSSKeyframesRule.h"
 
 #include "mozilla/dom/CSSKeyframeRule.h"
 
 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,
                           nsMediaQueryResultCacheKey& aKey) final;
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
--- a/layout/style/ServoKeyframesRule.cpp
+++ b/layout/style/ServoKeyframesRule.cpp
@@ -251,74 +251,70 @@ ServoKeyframesRule::UpdateRule(Func aCal
 
   aCallback();
 
   if (StyleSheet* sheet = GetStyleSheet()) {
     sheet->RuleChanged(this);
   }
 }
 
-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<nsAtom> 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);
   UpdateRule([this, sheet, &rule]() {
     bool parsedOk = Servo_KeyframesRule_AppendRule(
       mRawRule, sheet->AsServo()->RawContents(), &rule);
     if (parsedOk && mKeyframeList) {
       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]() {
     Servo_KeyframesRule_DeleteRule(mRawRule, index);
     if (mKeyframeList) {
       mKeyframeList->RemoveRule(index);
     }
   });
-  return NS_OK;
 }
 
 /* virtual */ void
 ServoKeyframesRule::GetCssTextImpl(nsAString& aCssText) const
 {
   Servo_KeyframesRule_GetCssText(mRawRule, &aCssText);
 }
 
--- a/layout/style/ServoKeyframesRule.h
+++ b/layout/style/ServoKeyframesRule.h
@@ -26,26 +26,23 @@ public:
   bool IsCCLeaf() const final;
 
   already_AddRefed<css::Rule> Clone() const final;
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final;
 #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;
 
 private:
   uint32_t FindRuleIndexForKey(const nsAString& aKey);
 
   template<typename Func>
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -1104,23 +1104,16 @@ nsCSSKeyframesRule::~nsCSSKeyframesRule(
 
 /* virtual */ already_AddRefed<css::Rule>
 nsCSSKeyframesRule::Clone() const
 {
   RefPtr<css::Rule> clone = new nsCSSKeyframesRule(*this);
   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
 {
   nsAutoCString indentStr;
   for (int32_t indent = aIndent; --indent >= 0; ) {
     indentStr.AppendLiteral("  ");
   }
@@ -1144,43 +1137,40 @@ nsCSSKeyframesRule::GetCssTextImpl(nsASt
   for (const Rule* rule : GeckoRules()) {
     static_cast<const nsCSSKeyframeRule*>(rule)->GetCssText(tmp);
     aCssText.Append(tmp);
     aCssText.Append('\n');
   }
   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();
   MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
 
   mName = NS_Atomize(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,
   // which also turns out to match WebKit:
   // http://lists.w3.org/Archives/Public/www-style/2011Apr/0034.html
   nsCSSParser parser;
 
   // FIXME: pass filename and line number
@@ -1191,18 +1181,16 @@ nsCSSKeyframesRule::AppendRule(const nsA
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
 
     AppendStyleRule(rule);
 
     if (StyleSheet* sheet = GetStyleSheet()) {
       sheet->RuleChanged(this);
     }
   }
-
-  return NS_OK;
 }
 
 static const uint32_t RULE_NOT_FOUND = uint32_t(-1);
 
 uint32_t
 nsCSSKeyframesRule::FindRuleIndexForKey(const nsAString& aKey)
 {
   nsCSSParser parser;
@@ -1221,31 +1209,30 @@ nsCSSKeyframesRule::FindRuleIndexForKey(
         return i;
       }
     }
   }
 
   return RULE_NOT_FOUND;
 }
 
-NS_IMETHODIMP
+void
 nsCSSKeyframesRule::DeleteRule(const nsAString& aKey)
 {
   uint32_t index = FindRuleIndexForKey(aKey);
   if (index != RULE_NOT_FOUND) {
     nsIDocument* doc = GetDocument();
     MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
 
     DeleteStyleRuleAt(index);
 
     if (StyleSheet* sheet = GetStyleSheet()) {
       sheet->RuleChanged(this);
     }
   }
-  return NS_OK;
 }
 
 nsCSSKeyframeRule*
 nsCSSKeyframesRule::FindRule(const nsAString& aKey)
 {
   uint32_t index = FindRuleIndexForKey(aKey);
   if (index == RULE_NOT_FOUND) {
     return nullptr;
--- a/layout/style/nsCSSRules.h
+++ b/layout/style/nsCSSRules.h
@@ -291,34 +291,29 @@ public:
     : mozilla::dom::CSSKeyframesRule(aLineNumber, aColumnNumber)
     , mName(aName)
   {
   }
 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<mozilla::css::Rule> 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; }
 
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
 
 private:
   uint32_t FindRuleIndexForKey(const nsAString& aKey);