Bug 1408301: Remove getPropertyCSSValue. r?bz draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 08 May 2018 06:31:12 +0200
changeset 792385 e0c128ef685065befbe4bd0094b9783ce771235f
parent 792270 59005ba3cd3e7b3f9e8804bea881bf4c3a755d7c
push id109103
push userbmo:emilio@crisal.io
push dateTue, 08 May 2018 10:24:20 +0000
reviewersbz
bugs1408301
milestone62.0a1
Bug 1408301: Remove getPropertyCSSValue. r?bz It's been removed for a while on Nightly without any known regressions. This gives us a full beta cycle of telemetry and two nightly cycles without the API before shipping. This only removes the API, followup work will replace serialization by Servo's, and remove the remaining DOM interfaces. MozReview-Commit-ID: 2m1taYg5xEr
dom/base/nsDeprecatedOperationList.h
dom/locales/en-US/chrome/dom/dom.properties
dom/webidl/CSSStyleDeclaration.webidl
editor/libeditor/CSSEditUtils.cpp
editor/libeditor/CSSEditUtils.h
editor/libeditor/ChangeStyleTransaction.cpp
layout/style/ServoFontFaceRule.cpp
layout/style/ServoFontFaceRule.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsComputedDOMStyle.h
layout/style/nsDOMCSSDeclaration.cpp
layout/style/nsDOMCSSDeclaration.h
layout/style/nsICSSDeclaration.h
layout/style/test/mochitest.ini
modules/libpref/init/all.js
--- a/dom/base/nsDeprecatedOperationList.h
+++ b/dom/base/nsDeprecatedOperationList.h
@@ -41,9 +41,8 @@ DEPRECATED_OPERATION(XMLBaseAttribute)
 DEPRECATED_OPERATION(WindowContentUntrusted)
 DEPRECATED_OPERATION(RegisterProtocolHandlerInsecure)
 DEPRECATED_OPERATION(MixedDisplayObjectSubrequest)
 DEPRECATED_OPERATION(MotionEvent)
 DEPRECATED_OPERATION(OrientationEvent)
 DEPRECATED_OPERATION(ProximityEvent)
 DEPRECATED_OPERATION(AmbientLightEvent)
 DEPRECATED_OPERATION(IDBOpenDBOptions_StorageType)
-DEPRECATED_OPERATION(GetPropertyCSSValue)
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -351,10 +351,8 @@ ReadableStreamReadingFailed=Failed to read data from the ReadableStream: “%S”.
 RegisterProtocolHandlerInsecureWarning=Use of the registerProtocolHandler for insecure connections will be removed in version 62.
 MixedDisplayObjectSubrequestWarning=Loading insecure content within a plugin embedded in a secure connection is going to be removed.
 MotionEventWarning=Use of the motion sensor is deprecated.
 OrientationEventWarning=Use of the orientation sensor is deprecated.
 ProximityEventWarning=Use of the proximity sensor is deprecated.
 AmbientLightEventWarning=Use of the ambient light sensor is deprecated.
 # LOCALIZATION NOTE: Do not translate "storage", "indexedDB.open" and "navigator.storage.persist()".
 IDBOpenDBOptions_StorageTypeWarning=The ‘storage’ attribute in options passed to indexedDB.open is deprecated and will soon be removed. To get persistent storage, please use navigator.storage.persist() instead.
-# LOCALIZATION NOTE: Do not translate "getPropertyCSSValue" and "getPropertyValue".
-GetPropertyCSSValueWarning=Use of getPropertyCSSValue is deprecated, use getPropertyValue instead.
--- a/dom/webidl/CSSStyleDeclaration.webidl
+++ b/dom/webidl/CSSStyleDeclaration.webidl
@@ -14,19 +14,16 @@ interface CSSStyleDeclaration {
   readonly attribute unsigned long length;
   getter DOMString item(unsigned long index);
 
   [Throws, ChromeOnly]
   sequence<DOMString> getCSSImageURLs(DOMString property);
 
   [Throws]
   DOMString getPropertyValue(DOMString property);
-  // Mozilla extension, sort of
-  [Throws, Pref="layout.css.getPropertyCSSValue.enabled"]
-  CSSValue? getPropertyCSSValue(DOMString property);
   DOMString getPropertyPriority(DOMString property);
   [CEReactions, NeedsSubjectPrincipal=NonSystem, Throws]
   void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
   [CEReactions, Throws]
   DOMString removeProperty(DOMString property);
 
   readonly attribute CSSRule? parentRule;
 };
--- a/editor/libeditor/CSSEditUtils.cpp
+++ b/editor/libeditor/CSSEditUtils.cpp
@@ -636,20 +636,16 @@ CSSEditUtils::GetDefaultLengthUnit(nsASt
   nsresult rv =
     Preferences::GetString("editor.css.default_length_unit", aLengthUnit);
   // XXX Why don't you validate the pref value?
   if (NS_FAILED(rv)) {
     aLengthUnit.AssignLiteral("px");
   }
 }
 
-// Unfortunately, CSSStyleDeclaration::GetPropertyCSSValue is not yet
-// implemented... We need then a way to determine the number part and the unit
-// from aString, aString being the result of a GetPropertyValue query...
-
 // static
 void
 CSSEditUtils::ParseLength(const nsAString& aString,
                           float* aValue,
                           nsAtom** aUnit)
 {
   if (aString.IsEmpty()) {
     *aValue = 0;
--- a/editor/libeditor/CSSEditUtils.h
+++ b/editor/libeditor/CSSEditUtils.h
@@ -268,19 +268,17 @@ public:
    */
   nsresult RemoveCSSEquivalentToHTMLStyle(dom::Element* aElement,
                                           nsAtom* aHTMLProperty,
                                           nsAtom* aAttribute,
                                           const nsAString* aValue,
                                           bool aSuppressTransaction);
 
   /**
-   * Parses a "xxxx.xxxxxuuu" string where x is a digit and u an alpha char
-   * we need such a parser because
-   * nsIDOMCSSStyleDeclaration::GetPropertyCSSValue() is not implemented.
+   * Parses a "xxxx.xxxxxuuu" string where x is a digit and u an alpha char.
    *
    * @param aString        [IN] Input string to parse.
    * @param aValue         [OUT] Numeric part.
    * @param aUnit          [OUT] Unit part.
    */
   static void ParseLength(const nsAString& aString, float* aValue,
                           nsAtom** aUnit);
 
--- a/editor/libeditor/ChangeStyleTransaction.cpp
+++ b/editor/libeditor/ChangeStyleTransaction.cpp
@@ -178,20 +178,16 @@ ChangeStyleTransaction::DoTransaction()
 
   // Does this property accept more than one value? (bug 62682)
   bool multiple = AcceptsMoreThanOneValue(*mProperty);
 
   if (mRemoveProperty) {
     nsAutoString returnString;
     if (multiple) {
       // Let's remove only the value we have to remove and not the others
-
-      // The two lines below are a workaround because
-      // nsDOMCSSDeclaration::GetPropertyCSSValue is not yet implemented (bug
-      // 62682)
       RemoveValueFromListOfValues(values, NS_LITERAL_STRING("none"));
       RemoveValueFromListOfValues(values, mValue);
       if (values.IsEmpty()) {
         rv = cssDecl->RemoveProperty(propertyNameString, returnString);
         NS_ENSURE_SUCCESS(rv, rv);
       } else {
         nsAutoString priority;
         cssDecl->GetPropertyPriority(propertyNameString, priority);
@@ -202,20 +198,16 @@ ChangeStyleTransaction::DoTransaction()
       rv = cssDecl->RemoveProperty(propertyNameString, returnString);
       NS_ENSURE_SUCCESS(rv, rv);
     }
   } else {
     nsAutoString priority;
     cssDecl->GetPropertyPriority(propertyNameString, priority);
     if (multiple) {
       // Let's add the value we have to add to the others
-
-      // The line below is a workaround because
-      // nsDOMCSSDeclaration::GetPropertyCSSValue is not yet implemented (bug
-      // 62682)
       AddValueToMultivalueProperty(values, mValue);
     } else {
       values.Assign(mValue);
     }
     rv = cssDecl->SetProperty(propertyNameString, values, priority);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
--- a/layout/style/ServoFontFaceRule.cpp
+++ b/layout/style/ServoFontFaceRule.cpp
@@ -61,25 +61,16 @@ NS_IMETHODIMP
 ServoFontFaceRuleDecl::GetPropertyValue(const nsAString& aPropName,
                                         nsAString& aResult)
 {
   aResult.Truncate();
   GetPropertyValue(nsCSSProps::LookupFontDesc(aPropName), aResult);
   return NS_OK;
 }
 
-already_AddRefed<dom::CSSValue>
-ServoFontFaceRuleDecl::GetPropertyCSSValue(const nsAString& aPropName,
-                                           ErrorResult& aRv)
-{
-  // ??? nsDOMCSSDeclaration returns null/NS_OK, but that seems wrong.
-  aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
-  return nullptr;
-}
-
 NS_IMETHODIMP
 ServoFontFaceRuleDecl::RemoveProperty(const nsAString& aPropName,
                                       nsAString& aResult)
 {
   nsCSSFontDesc descID = nsCSSProps::LookupFontDesc(aPropName);
   NS_ASSERTION(descID >= eCSSFontDesc_UNKNOWN &&
                descID < eCSSFontDesc_COUNT,
                "LookupFontDesc returned value out of range");
--- a/layout/style/ServoFontFaceRule.h
+++ b/layout/style/ServoFontFaceRule.h
@@ -16,20 +16,16 @@ namespace mozilla {
 // A ServoFontFaceRuleDecl is always embeded in a ServoFontFaceRule.
 class ServoFontFaceRule;
 class ServoFontFaceRuleDecl final : public nsICSSDeclaration
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
 
-  already_AddRefed<dom::CSSValue>
-  GetPropertyCSSValue(const nsAString& aProp, ErrorResult& aRv) final;
-  using nsICSSDeclaration::GetPropertyCSSValue;
-
   nsINode* GetParentObject() final;
   void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final;
 
   void GetPropertyValue(nsCSSFontDesc aFontDescID, nsAString& aResult) const;
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
 protected:
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -983,26 +983,16 @@ nsComputedDOMStyle::ClearCurrentStyleSou
   }
 
   mOuterFrame = nullptr;
   mInnerFrame = nullptr;
   mPresShell = nullptr;
 }
 
 already_AddRefed<CSSValue>
-nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
-                                        ErrorResult& aRv)
-{
-  if (nsCOMPtr<nsIDocument> document = do_QueryReferent(mDocumentWeak)) {
-    document->WarnOnceAbout(nsIDocument::eGetPropertyCSSValue);
-  }
-  return GetPropertyCSSValueWithoutWarning(aPropertyName, aRv);
-}
-
-already_AddRefed<CSSValue>
 nsComputedDOMStyle::GetPropertyCSSValueWithoutWarning(
   const nsAString& aPropertyName,
   ErrorResult& aRv)
 {
   nsCSSPropertyID prop =
     nsCSSProps::LookupProperty(aPropertyName, CSSEnabledState::eForAllContent);
 
   bool needsLayoutFlush;
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -69,21 +69,16 @@ public:
 
   NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
   nsresult GetPropertyValue(const nsCSSPropertyID aPropID,
                             nsAString& aValue) override;
   nsresult SetPropertyValue(const nsCSSPropertyID aPropID,
                             const nsAString& aValue,
                             nsIPrincipal* aSubjectPrincipal) override;
 
-  // Do NOT use this, it is deprecated, see bug 474655.
-  already_AddRefed<CSSValue>
-  GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv) final;
-  using nsICSSDeclaration::GetPropertyCSSValue;
-
   void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) final;
 
   enum StyleType {
     eDefaultOnly, // Only includes UA and user sheets
     eAll // Includes all stylesheets
   };
 
   nsComputedDOMStyle(mozilla::dom::Element* aElement,
--- a/layout/style/nsDOMCSSDeclaration.cpp
+++ b/layout/style/nsDOMCSSDeclaration.cpp
@@ -139,24 +139,16 @@ nsDOMCSSDeclaration::Length()
 
   if (decl) {
     return decl->Count();
   }
 
   return 0;
 }
 
-already_AddRefed<dom::CSSValue>
-nsDOMCSSDeclaration::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
-{
-  // We don't support CSSValue yet so we'll just return null...
-
-  return nullptr;
-}
-
 void
 nsDOMCSSDeclaration::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName)
 {
   DeclarationBlock* decl = GetCSSDeclaration(eOperation_Read);
   aFound = decl && decl->GetNthProperty(aIndex, aPropName);
 }
 
 NS_IMETHODIMP
--- a/layout/style/nsDOMCSSDeclaration.h
+++ b/layout/style/nsDOMCSSDeclaration.h
@@ -62,20 +62,16 @@ public:
   // Require subclasses to implement |GetParentRule|.
   //NS_DECL_NSIDOMCSSSTYLEDECLARATION
   void GetCssText(nsAString & aCssText) override;
   void SetCssText(const nsAString & aCssText,
                   nsIPrincipal* aSubjectPrincipal,
                   mozilla::ErrorResult& aRv) override;
   NS_IMETHOD GetPropertyValue(const nsAString & propertyName,
                               nsAString & _retval) override;
-  virtual already_AddRefed<mozilla::dom::CSSValue>
-    GetPropertyCSSValue(const nsAString & propertyName,
-                        mozilla::ErrorResult& aRv) override;
-  using nsICSSDeclaration::GetPropertyCSSValue;
   NS_IMETHOD RemoveProperty(const nsAString & propertyName,
                             nsAString & _retval) override;
   void GetPropertyPriority(const nsAString & propertyName,
                            nsAString & aPriority) override;
   NS_IMETHOD SetProperty(const nsAString& propertyName,
                          const nsAString& value,
                          const nsAString& priority,
                          nsIPrincipal* aSubjectPrincipal) override;
--- a/layout/style/nsICSSDeclaration.h
+++ b/layout/style/nsICSSDeclaration.h
@@ -48,19 +48,16 @@ class nsICSSDeclaration : public nsISupp
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSSDECLARATION_IID)
 
   virtual nsINode *GetParentObject() = 0;
   mozilla::dom::DocGroup* GetDocGroup();
 
   NS_IMETHOD GetPropertyValue(const nsAString& aPropName,
                               nsAString& aValue) = 0;
-  virtual already_AddRefed<mozilla::dom::CSSValue>
-    GetPropertyCSSValue(const nsAString& aPropertyName,
-                        mozilla::ErrorResult& aRv) = 0;
   NS_IMETHOD RemoveProperty(const nsAString& aPropertyName,
                             nsAString& aReturn) = 0;
   NS_IMETHOD SetProperty(const nsAString& aPropertyName,
                          const nsAString& aValue,
                          const nsAString& aPriority,
                          nsIPrincipal* aSubjectPrincipal = nullptr) = 0;
   void Item(uint32_t aIndex, nsAString& aReturn)
   {
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -1,12 +1,11 @@
 [DEFAULT]
 prefs =
   dom.animations-api.core.enabled=true
-  layout.css.getPropertyCSSValue.enabled=true
 support-files =
   animation_utils.js
   ccd-quirks.html
   ccd.sjs
   ccd-standards.html
   chrome/bug418986-2.js
   chrome/match.png
   chrome/mismatch.png
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -2817,22 +2817,16 @@ pref("layout.word_select.stop_at_undersc
 // 3 = caret moves and blinks as when there is no selection; word delete
 //     deletes the selection
 // Windows default is 1 for word delete behavior, the rest as for 2.
 pref("layout.selection.caret_style", 0);
 
 // pref to report CSS errors to the error console
 pref("layout.css.report_errors", true);
 
-#ifdef NIGHTLY_BUILD
-pref("layout.css.getPropertyCSSValue.enabled", false);
-#else
-pref("layout.css.getPropertyCSSValue.enabled", true);
-#endif
-
 // Override DPI. A value of -1 means use the maximum of 96 and the system DPI.
 // A value of 0 means use the system DPI. A positive value is used as the DPI.
 // This sets the physical size of a device pixel and thus controls the
 // interpretation of physical units such as "pt".
 pref("layout.css.dpi", -1);
 
 // Set the number of device pixels per CSS pixel. A value <= 0 means choose
 // automatically based on user settings for the platform (e.g., "UI scale factor"