Bug 1427512 - Part 11: Remove nsIDOMCSSKeyframeRule. r=xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Wed, 03 Jan 2018 14:26:13 +1100
changeset 717712 d6a16421092dec14aafbf412ddcc3a49d7ef04aa
parent 717711 1ee6a3d4c2441e36be2e94ad285af32f2b391120
child 717713 17d33ed1b4099d4dce636457367dac698a46493b
push id94746
push userbmo:cam@mcc.id.au
push dateTue, 09 Jan 2018 10:21:54 +0000
reviewersxidorn
bugs1427512
milestone59.0a1
Bug 1427512 - Part 11: Remove nsIDOMCSSKeyframeRule. r=xidorn MozReview-Commit-ID: 2px3iFBcUsg
dom/interfaces/base/domstubs.idl
dom/interfaces/css/moz.build
dom/interfaces/css/nsIDOMCSSKeyframeRule.idl
layout/style/CSSKeyframeRule.cpp
layout/style/CSSKeyframeRule.h
layout/style/ServoKeyframeRule.cpp
layout/style/ServoKeyframeRule.h
layout/style/nsCSSRules.cpp
layout/style/nsCSSRules.h
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -61,17 +61,16 @@ interface nsIDOMHTMLElement;
 interface nsIDOMHTMLFormElement;
 interface nsIDOMHTMLHeadElement;
 
 // CSS
 interface nsIDOMCSSValue;
 interface nsIDOMCSSPrimitiveValue;
 interface nsIDOMCSSRule;
 interface nsIDOMCSSRuleList;
-interface nsIDOMCSSKeyframeRule;
 interface nsIDOMCSSStyleSheet;
 interface nsIDOMCSSStyleDeclaration;
 interface nsIDOMCounter;
 interface nsIDOMRect;
 interface nsIDOMCSSStyleRule;
 interface nsIDOMCSSStyleRuleCollection;
 
 // Range
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -4,17 +4,16 @@
 # 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/.
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "DOM: CSS Object Model")
 
 XPIDL_SOURCES += [
     'nsIDOMCounter.idl',
-    'nsIDOMCSSKeyframeRule.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/nsIDOMCSSKeyframeRule.idl
+++ /dev/null
@@ -1,15 +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 nsIDOMCSSStyleDeclaration;
-
-[scriptable, uuid(a281a8b4-eaa2-49a8-8b97-acc2814a57c9)]
-interface nsIDOMCSSKeyframeRule : nsISupports
-{
-           attribute DOMString                 keyText;
-  readonly attribute nsIDOMCSSStyleDeclaration style;
-};
--- a/layout/style/CSSKeyframeRule.cpp
+++ b/layout/style/CSSKeyframeRule.cpp
@@ -7,31 +7,16 @@
 #include "mozilla/dom/CSSKeyframeRule.h"
 
 #include "mozilla/dom/CSSKeyframeRuleBinding.h"
 #include "nsICSSDeclaration.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ADDREF_INHERITED(CSSKeyframeRule, mozilla::css::Rule)
-NS_IMPL_RELEASE_INHERITED(CSSKeyframeRule, mozilla::css::Rule)
-
-// QueryInterface implementation for CSSKeyframeRule
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CSSKeyframeRule)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMCSSKeyframeRule)
-NS_INTERFACE_MAP_END_INHERITING(mozilla::css::Rule)
-
-NS_IMETHODIMP
-CSSKeyframeRule::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
-{
-  NS_ADDREF(*aStyle = Style());
-  return NS_OK;
-}
-
 /* virtual */ JSObject*
 CSSKeyframeRule::WrapObject(JSContext* aCx,
                             JS::Handle<JSObject*> aGivenProto)
 {
   return CSSKeyframeRuleBinding::Wrap(aCx, this, aGivenProto);
 }
 
 } // namespace dom
--- a/layout/style/CSSKeyframeRule.h
+++ b/layout/style/CSSKeyframeRule.h
@@ -3,42 +3,35 @@
 /* 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_CSSKeyframeRule_h
 #define mozilla_dom_CSSKeyframeRule_h
 
 #include "mozilla/css/Rule.h"
-#include "nsIDOMCSSKeyframeRule.h"
 
 namespace mozilla {
 namespace dom {
 
 class CSSKeyframeRule : public css::Rule
-                      , public nsIDOMCSSKeyframeRule
 {
 protected:
   using css::Rule::Rule;
   virtual ~CSSKeyframeRule() {}
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
-
   int32_t GetType() const final { return Rule::KEYFRAME_RULE; }
   using Rule::GetType;
   bool IsCCLeaf() const override { return Rule::IsCCLeaf(); }
 
-  // nsIDOMCSSKeyframeRule
-  NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) final;
-
   // WebIDL interface
   uint16_t Type() const final { return nsIDOMCSSRule::KEYFRAME_RULE; }
-  // The XPCOM GetKeyText is fine.
-  // The XPCOM SetKeyText is fine.
+  virtual void GetKeyText(nsAString& aKey) = 0;
+  virtual void SetKeyText(const nsAString& aKey) = 0;
   virtual nsICSSDeclaration* Style() = 0;
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override = 0;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 };
 
 } // namespace dom
--- a/layout/style/ServoKeyframeRule.cpp
+++ b/layout/style/ServoKeyframeRule.cpp
@@ -183,31 +183,29 @@ ServoKeyframeRule::UpdateRule(Func aCall
 
   aCallback();
 
   if (StyleSheet* sheet = GetStyleSheet()) {
     sheet->RuleChanged(this);
   }
 }
 
-NS_IMETHODIMP
+void
 ServoKeyframeRule::GetKeyText(nsAString& aKeyText)
 {
   Servo_Keyframe_GetKeyText(mRaw, &aKeyText);
-  return NS_OK;
 }
 
-NS_IMETHODIMP
+void
 ServoKeyframeRule::SetKeyText(const nsAString& aKeyText)
 {
   NS_ConvertUTF16toUTF8 keyText(aKeyText);
   UpdateRule([this, &keyText]() {
     Servo_Keyframe_SetKeyText(mRaw, &keyText);
   });
-  return NS_OK;
 }
 
 void
 ServoKeyframeRule::GetCssTextImpl(nsAString& aCssText) const
 {
   Servo_Keyframe_GetCssText(mRaw, &aCssText);
 }
 
--- a/layout/style/ServoKeyframeRule.h
+++ b/layout/style/ServoKeyframeRule.h
@@ -30,22 +30,20 @@ public:
   bool IsCCLeaf() const final;
 #ifdef DEBUG
   void List(FILE* out = stdout, int32_t aIndent = 0) const final;
 #endif
   already_AddRefed<mozilla::css::Rule> Clone() const final;
 
   RawServoKeyframe* Raw() const { return mRaw; }
 
-  // nsIDOMCSSKeyframeRule interface
-  NS_IMETHOD GetKeyText(nsAString& aKeyText) final;
-  NS_IMETHOD SetKeyText(const nsAString& aKeyText) final;
-
   // WebIDL interface
   void GetCssTextImpl(nsAString& aCssText) const final;
+  void GetKeyText(nsAString& aKeyText) final;
+  void SetKeyText(const nsAString& aKeyText) final;
   nsICSSDeclaration* Style() final;
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const final;
 
 private:
   virtual ~ServoKeyframeRule();
 
   friend class ServoKeyframeDeclaration;
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -992,21 +992,20 @@ nsCSSKeyframeRule::GetCssTextImpl(nsAStr
   DoGetKeyText(aCssText);
   aCssText.AppendLiteral(" { ");
   nsAutoString tmp;
   mDeclaration->ToString(tmp);
   aCssText.Append(tmp);
   aCssText.AppendLiteral(" }");
 }
 
-NS_IMETHODIMP
+void
 nsCSSKeyframeRule::GetKeyText(nsAString& aKeyText)
 {
   DoGetKeyText(aKeyText);
-  return NS_OK;
 }
 
 void
 nsCSSKeyframeRule::DoGetKeyText(nsAString& aKeyText) const
 {
   aKeyText.Truncate();
   uint32_t i = 0, i_end = mKeys.Length();
   MOZ_ASSERT(i_end != 0, "must have some keys");
@@ -1015,38 +1014,36 @@ nsCSSKeyframeRule::DoGetKeyText(nsAStrin
     aKeyText.Append(char16_t('%'));
     if (++i == i_end) {
       break;
     }
     aKeyText.AppendLiteral(", ");
   }
 }
 
-NS_IMETHODIMP
+void
 nsCSSKeyframeRule::SetKeyText(const nsAString& aKeyText)
 {
   nsCSSParser parser;
 
   InfallibleTArray<float> newSelectors;
   // FIXME: pass filename and line number
   if (!parser.ParseKeyframeSelectorString(aKeyText, nullptr, 0, newSelectors)) {
     // for now, we don't do anything if the parse fails
-    return NS_OK;
+    return;
   }
 
   nsIDocument* doc = GetDocument();
   MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true);
 
   newSelectors.SwapElements(mKeys);
 
   if (StyleSheet* sheet = GetStyleSheet()) {
     sheet->RuleChanged(this);
   }
-
-  return NS_OK;
 }
 
 nsICSSDeclaration*
 nsCSSKeyframeRule::Style()
 {
   if (!mDOMDeclaration) {
     mDOMDeclaration = new nsCSSKeyframeStyleDeclaration(this);
   }
--- a/layout/style/nsCSSRules.h
+++ b/layout/style/nsCSSRules.h
@@ -254,22 +254,20 @@ public:
                                            mozilla::dom::CSSKeyframeRule)
   virtual bool IsCCLeaf() const override;
 
 #ifdef DEBUG
   virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
 #endif
   virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
 
-  // nsIDOMCSSKeyframeRule interface
-  NS_IMETHOD GetKeyText(nsAString& aKeyText) final;
-  NS_IMETHOD SetKeyText(const nsAString& aKeyText) final;
-
   // WebIDL interface
   void GetCssTextImpl(nsAString& aCssText) const final;
+  void GetKeyText(nsAString& aKeyText) final;
+  void SetKeyText(const nsAString& aKeyText) final;
   nsICSSDeclaration* Style() final;
 
   const nsTArray<float>& GetKeys() const     { return mKeys; }
   mozilla::css::Declaration* Declaration()   { return mDeclaration; }
 
   void ChangeDeclaration(mozilla::css::Declaration* aDeclaration);
 
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;