Bug 876725. Make use of IDL default string values in CSSStyleDeclaration to simplify the code. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 29 May 2013 16:15:50 -0400
changeset 144817 387e67f2b745b0fc444463d60d2ae1f8dc494118
parent 144816 2d34ab368ffadc88496892b845ffe34b355834c9
child 144818 f327a0802164f5607702511bb8890fc633acac8e
push idunknown
push userunknown
push dateunknown
reviewerssmaug
bugs876725
milestone24.0a1
Bug 876725. Make use of IDL default string values in CSSStyleDeclaration to simplify the code. r=smaug
dom/webidl/CSSStyleDeclaration.webidl
layout/style/nsICSSDeclaration.h
--- a/dom/webidl/CSSStyleDeclaration.webidl
+++ b/dom/webidl/CSSStyleDeclaration.webidl
@@ -17,17 +17,15 @@ interface CSSStyleDeclaration {
   getter DOMString item(unsigned long index);
 
   [Throws]
   DOMString getPropertyValue(DOMString property);
   // Mozilla extension, sort of
   [Throws]
   CSSValue? getPropertyCSSValue(DOMString property);
   DOMString getPropertyPriority(DOMString property);
-  // This would be nicer if it used a string default value of "".
-  // See bug 759622.
   [Throws]
-  void setProperty(DOMString property, DOMString value, [TreatNullAs=EmptyString] optional DOMString priority);
+  void setProperty(DOMString property, DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");
   [Throws]
   DOMString removeProperty(DOMString property);
 
   readonly attribute CSSRule? parentRule;
 };
--- a/layout/style/nsICSSDeclaration.h
+++ b/layout/style/nsICSSDeclaration.h
@@ -123,25 +123,19 @@ public:
 
   void GetPropertyValue(const nsAString& aPropName, nsString& aValue,
                         mozilla::ErrorResult& rv) {
     rv = GetPropertyValue(aPropName, aValue);
   }
   void GetPropertyPriority(const nsAString& aPropName, nsString& aPriority) {
     GetPropertyPriority(aPropName, static_cast<nsAString&>(aPriority));
   }
-  // XXXbz we should nix the Optional thing once bug 759622 is fixed.
   void SetProperty(const nsAString& aPropName, const nsAString& aValue,
-                   const mozilla::dom::Optional<nsAString>& aPriority,
-                   mozilla::ErrorResult& rv) {
-    if (aPriority.WasPassed()) {
-      rv = SetProperty(aPropName, aValue, aPriority.Value());
-    } else {
-      rv = SetProperty(aPropName, aValue, EmptyString());
-    }
+                   const nsAString& aPriority, mozilla::ErrorResult& rv) {
+    rv = SetProperty(aPropName, aValue, aPriority);
   }
   void RemoveProperty(const nsAString& aPropName, nsString& aRetval,
                       mozilla::ErrorResult& rv) {
     rv = RemoveProperty(aPropName, aRetval);
   }
   already_AddRefed<nsIDOMCSSRule> GetParentRule() {
     nsCOMPtr<nsIDOMCSSRule> rule;
     GetParentRule(getter_AddRefs(rule));