Bug 1427512 - Part 28: Remove nsIDOMCSSValue. r=xidorn,bz draft
authorCameron McCormack <cam@mcc.id.au>
Tue, 09 Jan 2018 11:22:29 +0800
changeset 717729 a34ac261971850c655e585f0a73b8c57ff922290
parent 717728 b02838dd1c3833b8f32d5e76f0288d42b20e27c0
child 717730 6b8a3e9e6a974f247ee0a46e2527ba86b1e7473d
push id94746
push userbmo:cam@mcc.id.au
push dateTue, 09 Jan 2018 10:21:54 +0000
reviewersxidorn, bz
bugs1427512
milestone59.0a1
Bug 1427512 - Part 28: Remove nsIDOMCSSValue. r=xidorn,bz MozReview-Commit-ID: 6DasjoMa6C8
dom/interfaces/base/domstubs.idl
dom/interfaces/css/moz.build
dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl
dom/interfaces/css/nsIDOMCSSValue.idl
dom/interfaces/svg/nsIDOMSVGElement.idl
js/xpconnect/tests/mochitest/test_bug790732.html
layout/style/nsDOMCSSValueList.cpp
layout/style/nsDOMCSSValueList.h
layout/style/nsICSSDeclaration.h
layout/style/nsROCSSPrimitiveValue.cpp
layout/style/nsROCSSPrimitiveValue.h
xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -52,16 +52,15 @@ interface nsIDOMEventTarget;
 interface nsIDOMEventListener;
 
 // HTML
 interface nsIDOMHTMLElement;
 interface nsIDOMHTMLFormElement;
 interface nsIDOMHTMLHeadElement;
 
 // CSS
-interface nsIDOMCSSValue;
 interface nsIDOMCSSStyleDeclaration;
 
 // Range
 interface nsIDOMRange;
 
 // Crypto
 interface nsIDOMCrypto;
--- a/dom/interfaces/css/moz.build
+++ b/dom/interfaces/css/moz.build
@@ -4,13 +4,12 @@
 # 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 += [
     'nsIDOMCSSStyleDeclaration.idl',
-    'nsIDOMCSSValue.idl',
 ]
 
 XPIDL_MODULE = 'dom_css'
 
--- a/dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl
+++ b/dom/interfaces/css/nsIDOMCSSStyleDeclaration.idl
@@ -28,16 +28,15 @@ interface nsIDOMCSSStyleDeclaration : ns
 
   NS_IMETHOD SetProperty(const nsAString& aPropertyName,
                          const nsAString& aValue,
                          const nsAString& aPriority,
                          nsIPrincipal* aSubjectPrincipal = nullptr) = 0;
   %}
 
   DOMString          getPropertyValue(in DOMString propertyName);
-  nsIDOMCSSValue     getPropertyCSSValue(in DOMString propertyName);
   DOMString          removeProperty(in DOMString propertyName)
                                         raises(DOMException);
   DOMString          getPropertyPriority(in DOMString propertyName);
 
   readonly attribute unsigned long    length;
   DOMString          item(in unsigned long index);
 };
deleted file mode 100644
--- a/dom/interfaces/css/nsIDOMCSSValue.idl
+++ /dev/null
@@ -1,29 +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 "domstubs.idl"
-
-/**
- * The nsIDOMCSSValue interface is a datatype for a CSS value in the
- * Document Object Model.
- *
- * For more information on this interface please see
- * http://www.w3.org/TR/DOM-Level-2-Style
- */
-
-[uuid(009f7ea5-9e80-41be-b008-db62f10823f2)]
-interface nsIDOMCSSValue : nsISupports
-{
-  // UnitTypes
-  const unsigned short      CSS_INHERIT                    = 0;
-  const unsigned short      CSS_PRIMITIVE_VALUE            = 1;
-  const unsigned short      CSS_VALUE_LIST                 = 2;
-  const unsigned short      CSS_CUSTOM                     = 3;
-
-           attribute DOMString        cssText;
-                                        // raises(DOMException) on setting
-
-  readonly attribute unsigned short   cssValueType;
-};
--- a/dom/interfaces/svg/nsIDOMSVGElement.idl
+++ b/dom/interfaces/svg/nsIDOMSVGElement.idl
@@ -1,18 +1,16 @@
 /* -*- 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 "nsIDOMElement.idl"
 
 interface nsIDOMCSSStyleDeclaration;
-interface nsIDOMCSSValue;
-
 
 [uuid(c63517c5-8bab-4cd1-8694-bccafc32a195)]
 interface nsIDOMSVGElement : nsIDOMElement
 {
             // raises DOMException on setting
   readonly attribute nsIDOMSVGElement    ownerSVGElement;
   readonly attribute nsIDOMSVGElement    viewportElement;
 
--- a/js/xpconnect/tests/mochitest/test_bug790732.html
+++ b/js/xpconnect/tests/mochitest/test_bug790732.html
@@ -18,17 +18,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   // Check each interface that we shim. We start by checking specific
   // constants for a couple of interfaces, and then once it's pretty clear that
   // it's working as intended we just check that the objects themselves are the
   // same.
   is(Ci.nsIXMLHttpRequest.HEADERS_RECEIVED, XMLHttpRequest.HEADERS_RECEIVED);
   is(Ci.nsIDOMDOMException.DATA_CLONE_ERR, DOMException.DATA_CLONE_ERR);
   is(Ci.nsIDOMNode.DOCUMENT_NODE, Node.DOCUMENT_NODE);
-  is(Ci.nsIDOMCSSValue.CSS_PRIMITIVE_VALUE, CSSValue.CSS_PRIMITIVE_VALUE);
   is(Ci.nsIDOMEvent.FOCUS, Event.FOCUS);
   is(Ci.nsIDOMNSEvent.CLICK, Event.CLICK);
   is(Ci.nsIDOMKeyEvent, KeyEvent);
   is(Ci.nsIDOMMouseEvent, MouseEvent);
   is(Ci.nsIDOMMouseScrollEvent, MouseScrollEvent);
   is(Ci.nsIDOMMutationEvent, MutationEvent);
   // XXX We can't test this here because it's only exposed to chrome
   //is(Ci.nsIDOMSimpleGestureEvent, SimpleGestureEvent);
--- a/layout/style/nsDOMCSSValueList.cpp
+++ b/layout/style/nsDOMCSSValueList.cpp
@@ -2,37 +2,38 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /* DOM object representing lists of values in DOM computed style */
 
 #include "nsDOMCSSValueList.h"
+#include "mozilla/dom/CSSValueBinding.h"
 #include "mozilla/dom/CSSValueListBinding.h"
 #include "mozilla/Move.h"
 
 using namespace mozilla;
+using namespace mozilla::dom;
 
 nsDOMCSSValueList::nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly)
   : CSSValue(), mCommaDelimited(aCommaDelimited), mReadonly(aReadonly)
 {
 }
 
 nsDOMCSSValueList::~nsDOMCSSValueList()
 {
 }
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSValueList)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSValueList)
 
 // QueryInterface implementation for nsDOMCSSValueList
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMCSSValueList)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsDOMCSSValueList, mCSSValues)
 
 JSObject*
 nsDOMCSSValueList::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
 {
@@ -41,19 +42,17 @@ nsDOMCSSValueList::WrapObject(JSContext 
 
 void
 nsDOMCSSValueList::AppendCSSValue(already_AddRefed<CSSValue> aValue)
 {
   RefPtr<CSSValue> val = aValue;
   mCSSValues.AppendElement(Move(val));
 }
 
-// nsIDOMCSSValue
-
-NS_IMETHODIMP
+void
 nsDOMCSSValueList::GetCssText(nsAString& aCssText)
 {
   aCssText.Truncate();
 
   uint32_t count = mCSSValues.Length();
 
   nsAutoString separator;
   if (mCommaDelimited) {
@@ -83,48 +82,32 @@ nsDOMCSSValueList::GetCssText(nsAString&
       // If this isn't the first item in the list, then
       // it's ok to append a separator.
       if (!aCssText.IsEmpty()) {
         aCssText.Append(separator);
       }
       aCssText.Append(tmpStr);
     }
   }
-
-  return NS_OK;
 }
 
 void
-nsDOMCSSValueList::GetCssText(nsString& aText, ErrorResult& aRv)
+nsDOMCSSValueList::GetCssText(nsString& aCssText, ErrorResult& aRv)
 {
-  aRv = GetCssText(aText);
-}
-
-NS_IMETHODIMP
-nsDOMCSSValueList::SetCssText(const nsAString& aCssText)
-{
-  if (mReadonly) {
-    return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
-  }
-
-  MOZ_ASSERT_UNREACHABLE("Can't SetCssText yet: please write me!");
-  return NS_OK;
+  GetCssText(aCssText);
 }
 
 void
 nsDOMCSSValueList::SetCssText(const nsAString& aText, ErrorResult& aRv)
 {
-  aRv = SetCssText(aText);
-}
+  if (mReadonly) {
+    aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
+    return;
+  }
 
-NS_IMETHODIMP
-nsDOMCSSValueList::GetCssValueType(uint16_t* aValueType)
-{
-  NS_ENSURE_ARG_POINTER(aValueType);
-  *aValueType = nsIDOMCSSValue::CSS_VALUE_LIST;
-  return NS_OK;
+  MOZ_ASSERT_UNREACHABLE("Can't SetCssText yet: please write me!");
 }
 
 uint16_t
 nsDOMCSSValueList::CssValueType() const
 {
-  return nsIDOMCSSValue::CSS_VALUE_LIST;
+  return CSSValueBinding::CSS_VALUE_LIST;
 }
--- a/layout/style/nsDOMCSSValueList.h
+++ b/layout/style/nsDOMCSSValueList.h
@@ -8,39 +8,37 @@
 
 #ifndef nsDOMCSSValueList_h___
 #define nsDOMCSSValueList_h___
 
 #include "CSSValue.h"
 #include "nsTArray.h"
 
 class nsDOMCSSValueList final : public mozilla::dom::CSSValue
-                              , public nsIDOMCSSValue
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDOMCSSValueList, mozilla::dom::CSSValue)
-
-  // nsIDOMCSSValue
-  NS_DECL_NSIDOMCSSVALUE
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMCSSValueList)
 
   // nsDOMCSSValueList
   nsDOMCSSValueList(bool aCommaDelimited, bool aReadonly);
 
   /**
    * Adds a value to this list.
    */
   void AppendCSSValue(already_AddRefed<CSSValue> aValue);
 
   virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv)
     override final;
   virtual void SetCssText(const nsAString& aText,
                           mozilla::ErrorResult& aRv) override final;
   virtual uint16_t CssValueType() const override final;
 
+  void GetCssText(nsAString& aText);
+
   CSSValue* IndexedGetter(uint32_t aIdx, bool& aFound) const
   {
     aFound = aIdx <= Length();
     return Item(aIdx);
   }
 
   CSSValue* Item(uint32_t aIndex) const
   {
--- a/layout/style/nsICSSDeclaration.h
+++ b/layout/style/nsICSSDeclaration.h
@@ -21,17 +21,16 @@
  */
 
 #include "mozilla/Attributes.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsCSSPropertyID.h"
 #include "mozilla/dom/CSSValue.h"
 #include "nsWrapperCache.h"
 #include "nsString.h"
-#include "nsIDOMCSSValue.h"
 #include "mozilla/ErrorResult.h"
 #include "nsCOMPtr.h"
 
 class nsINode;
 class nsIPrincipal;
 namespace mozilla {
 namespace css {
 class Rule;
@@ -76,28 +75,16 @@ public:
   NS_IMETHOD GetCssText(nsAString& aCssText) override = 0;
   NS_IMETHOD SetCssText(const nsAString& aCssText,
                         nsIPrincipal* aSubjectPrincipal = nullptr) override = 0;
   NS_IMETHOD GetPropertyValue(const nsAString& aPropName,
                               nsAString& aValue) override = 0;
   virtual already_AddRefed<mozilla::dom::CSSValue>
     GetPropertyCSSValue(const nsAString& aPropertyName,
                         mozilla::ErrorResult& aRv) = 0;
-  NS_IMETHOD GetPropertyCSSValue(const nsAString& aProp, nsIDOMCSSValue** aVal) override
-  {
-    mozilla::ErrorResult error;
-    RefPtr<mozilla::dom::CSSValue> val = GetPropertyCSSValue(aProp, error);
-    if (error.Failed()) {
-      return error.StealNSResult();
-    }
-
-    nsCOMPtr<nsIDOMCSSValue> xpVal = do_QueryInterface(val);
-    xpVal.forget(aVal);
-    return NS_OK;
-  }
   NS_IMETHOD RemoveProperty(const nsAString& aPropertyName,
                             nsAString& aReturn) override = 0;
   NS_IMETHOD GetPropertyPriority(const nsAString& aPropertyName,
                                  nsAString& aReturn) override = 0;
   NS_IMETHOD SetProperty(const nsAString& aPropertyName,
                          const nsAString& aValue,
                          const nsAString& aPriority,
                          nsIPrincipal* aSubjectPrincipal = nullptr) override = 0;
--- a/layout/style/nsROCSSPrimitiveValue.cpp
+++ b/layout/style/nsROCSSPrimitiveValue.cpp
@@ -41,17 +41,16 @@ nsROCSSPrimitiveValue::~nsROCSSPrimitive
   Reset();
 }
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsROCSSPrimitiveValue)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsROCSSPrimitiveValue)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsROCSSPrimitiveValue)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsIDOMCSSValue)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, CSSValue)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsROCSSPrimitiveValue)
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(nsROCSSPrimitiveValue)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsROCSSPrimitiveValue)
@@ -70,20 +69,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 JSObject*
 nsROCSSPrimitiveValue::WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto)
 {
   return dom::CSSPrimitiveValueBinding::Wrap(cx, this, aGivenProto);
 }
 
-// nsIDOMCSSValue
-
-
-NS_IMETHODIMP
+nsresult
 nsROCSSPrimitiveValue::GetCssText(nsAString& aCssText)
 {
   nsAutoString tmpStr;
   aCssText.Truncate();
   nsresult result = NS_OK;
 
   switch (mType) {
     case CSSPrimitiveValueBinding::CSS_PX:
@@ -276,41 +272,26 @@ nsROCSSPrimitiveValue::GetCssText(nsAStr
 }
 
 void
 nsROCSSPrimitiveValue::GetCssText(nsString& aText, ErrorResult& aRv)
 {
   aRv = GetCssText(aText);
 }
 
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::SetCssText(const nsAString& aCssText)
-{
-  return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
-}
-
 void
 nsROCSSPrimitiveValue::SetCssText(const nsAString& aText, ErrorResult& aRv)
 {
-  aRv = SetCssText(aText);
-}
-
-
-NS_IMETHODIMP
-nsROCSSPrimitiveValue::GetCssValueType(uint16_t* aValueType)
-{
-  NS_ENSURE_ARG_POINTER(aValueType);
-  *aValueType = nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
-  return NS_OK;
+  aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
 }
 
 uint16_t
 nsROCSSPrimitiveValue::CssValueType() const
 {
-  return nsIDOMCSSValue::CSS_PRIMITIVE_VALUE;
+  return CSSValueBinding::CSS_PRIMITIVE_VALUE;
 }
 
 void
 nsROCSSPrimitiveValue::SetFloatValue(uint16_t aType, float aVal,
                                      ErrorResult& aRv)
 {
   aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
 }
--- a/layout/style/nsROCSSPrimitiveValue.h
+++ b/layout/style/nsROCSSPrimitiveValue.h
@@ -4,42 +4,37 @@
  * 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/. */
 
 /* DOM object representing values in DOM computed style */
 
 #ifndef nsROCSSPrimitiveValue_h___
 #define nsROCSSPrimitiveValue_h___
 
-#include "nsIDOMCSSValue.h"
 #include "mozilla/dom/CSSPrimitiveValueBinding.h"
 #include "mozilla/dom/CSSValueBinding.h"
 
 #include "nsCSSKeywords.h"
 #include "CSSValue.h"
 #include "nsCOMPtr.h"
 #include "nsCoord.h"
 
 class nsIURI;
 class nsDOMCSSRect;
 class nsDOMCSSRGBColor;
 
 /**
  * Read-only CSS primitive value - a DOM object representing values in DOM
  * computed style.
  */
-class nsROCSSPrimitiveValue final : public mozilla::dom::CSSValue,
-                                    public nsIDOMCSSValue
+class nsROCSSPrimitiveValue final : public mozilla::dom::CSSValue
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsROCSSPrimitiveValue, mozilla::dom::CSSValue)
-
-  // nsIDOMCSSValue
-  NS_DECL_NSIDOMCSSVALUE
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsROCSSPrimitiveValue)
 
   // CSSValue
   virtual void GetCssText(nsString& aText, mozilla::ErrorResult& aRv) override final;
   virtual void SetCssText(const nsAString& aText, mozilla::ErrorResult& aRv) override final;
   virtual uint16_t CssValueType() const override final;
 
   // CSSPrimitiveValue
   uint16_t PrimitiveType();
@@ -51,16 +46,17 @@ public:
                       mozilla::ErrorResult& aRv);
   void GetCounterValue(mozilla::ErrorResult& aRv);
   nsDOMCSSRect* GetRectValue(mozilla::ErrorResult& aRv);
   nsDOMCSSRGBColor *GetRGBColorValue(mozilla::ErrorResult& aRv);
 
   // nsROCSSPrimitiveValue
   nsROCSSPrimitiveValue();
 
+  nsresult GetCssText(nsAString& aText);
   void SetNumber(float aValue);
   void SetNumber(int32_t aValue);
   void SetNumber(uint32_t aValue);
   void SetPercent(float aValue);
   void SetDegree(float aValue);
   void SetGrad(float aValue);
   void SetRadian(float aValue);
   void SetTurn(float aValue);
--- a/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/ShimInterfaceInfo.cpp
@@ -15,17 +15,16 @@
 #include "nsIDOMCDATASection.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMClientRect.h"
 #include "nsIDOMClientRectList.h"
 #include "nsIDOMClipboardEvent.h"
 #include "nsIDOMCommandEvent.h"
 #include "nsIDOMComment.h"
 #include "nsIDOMCSSStyleDeclaration.h"
-#include "nsIDOMCSSValue.h"
 #include "nsIDOMCustomEvent.h"
 #ifdef MOZ_WEBRTC
 #include "nsIDOMDataChannel.h"
 #endif
 #include "nsIDOMDataTransfer.h"
 #include "nsIDOMDOMCursor.h"
 #include "nsIDOMDOMException.h"
 #include "nsIDOMDOMRequest.h"
@@ -252,17 +251,16 @@ const ComponentsInterfaceShimEntry kComp
   DEFINE_SHIM(CharacterData),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRect, DOMRectReadOnly),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMClientRectList, DOMRectList),
   DEFINE_SHIM(ClipboardEvent),
   DEFINE_SHIM(CommandEvent),
   DEFINE_SHIM(Comment),
   DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIContainerBoxObject, ContainerBoxObject),
   DEFINE_SHIM(CSSStyleDeclaration),
-  DEFINE_SHIM(CSSValue),
   DEFINE_SHIM(CustomEvent),
 #ifdef MOZ_WEBRTC
   DEFINE_SHIM(DataChannel),
 #endif
   DEFINE_SHIM(DataTransfer),
   DEFINE_SHIM(DOMCursor),
   DEFINE_SHIM(DOMException),
   DEFINE_SHIM(DOMRequest),