Bug 636750 (4/4) - s/float/double/g on few methods/enums/variables. r=bz sr=sicking
authorMounir Lamouri <mounir.lamouri@gmail.com>
Fri, 25 Mar 2011 15:43:53 +0100
changeset 63879 3b1b228626529c6b7a226fefe83b81e6f7e06d5b
parent 63878 f3c80cecaf9a187972ae85130bb1d945b767602a
child 63880 66b1dae86e99e332ad80dfea0944a650b3ac6617
push idunknown
push userunknown
push dateunknown
reviewersbz, sicking
bugs636750
milestone2.2a1pre
Bug 636750 (4/4) - s/float/double/g on few methods/enums/variables. r=bz sr=sicking
content/base/src/nsAttrValue.cpp
content/base/src/nsAttrValue.h
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/content/src/nsHTMLMediaElement.cpp
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -257,19 +257,19 @@ nsAttrValue::SetTo(const nsAttrValue& aO
     }
 #ifdef MOZ_SVG
     case eSVGValue:
     {
       NS_ADDREF(cont->mSVGValue = otherCont->mSVGValue);
       break;
     }
 #endif
-    case eFloatValue:
+    case eDoubleValue:
     {
-      cont->mFloatValue = otherCont->mFloatValue;
+      cont->mDoubleValue = otherCont->mDoubleValue;
       break;
     }
     case eIntMarginValue:
     {
       if (otherCont->mIntMargin)
         cont->mIntMargin = new nsIntMargin(*otherCont->mIntMargin);
       break;
     }
@@ -438,20 +438,20 @@ nsAttrValue::ToString(nsAString& aResult
     }
 #ifdef MOZ_SVG
     case eSVGValue:
     {
       GetMiscContainer()->mSVGValue->GetValueString(aResult);
       break;
     }
 #endif
-    case eFloatValue:
+    case eDoubleValue:
     {
       aResult.Truncate();
-      aResult.AppendFloat(GetFloatValue());
+      aResult.AppendFloat(GetDoubleValue());
       break;
     }
     default:
     {
       aResult.Truncate();
       break;
     }
   }
@@ -602,20 +602,20 @@ nsAttrValue::HashValue() const
       return retval;
     }
 #ifdef MOZ_SVG
     case eSVGValue:
     {
       return NS_PTR_TO_INT32(cont->mSVGValue);
     }
 #endif
-    case eFloatValue:
+    case eDoubleValue:
     {
       // XXX this is crappy, but oh well
-      return cont->mFloatValue;
+      return cont->mDoubleValue;
     }
     case eIntMarginValue:
     {
       return NS_PTR_TO_INT32(cont->mIntMargin);
     }
     default:
     {
       NS_NOTREACHED("unknown type stored in MiscContainer");
@@ -701,19 +701,19 @@ nsAttrValue::Equals(const nsAttrValue& a
       break;
     }
 #ifdef MOZ_SVG
     case eSVGValue:
     {
       return thisCont->mSVGValue == otherCont->mSVGValue;
     }
 #endif
-    case eFloatValue:
+    case eDoubleValue:
     {
-      return thisCont->mFloatValue == otherCont->mFloatValue;
+      return thisCont->mDoubleValue == otherCont->mDoubleValue;
     }
     case eIntMarginValue:
     {
       return thisCont->mIntMargin == otherCont->mIntMargin;
     }
     default:
     {
       NS_NOTREACHED("unknown type stored in MiscContainer");
@@ -1201,29 +1201,29 @@ nsAttrValue::ParseColor(const nsAString&
   if (NS_LooseHexToRGB(colorStr, &color)) {
     SetColorValue(color, aString);
     return PR_TRUE;
   }
 
   return PR_FALSE;
 }
 
-PRBool nsAttrValue::ParseFloatValue(const nsAString& aString)
+PRBool nsAttrValue::ParseDoubleValue(const nsAString& aString)
 {
   ResetIfSet();
 
   PRInt32 ec;
   double val = PromiseFlatString(aString).ToDouble(&ec);
   if (NS_FAILED(ec)) {
     return PR_FALSE;
   }
   if (EnsureEmptyMiscContainer()) {
     MiscContainer* cont = GetMiscContainer();
-    cont->mFloatValue = val;
-    cont->mType = eFloatValue;
+    cont->mDoubleValue = val;
+    cont->mType = eDoubleValue;
     nsAutoString serializedFloat;
     serializedFloat.AppendFloat(val);
     SetMiscAtomOrString(serializedFloat.Equals(aString) ? nsnull : &aString);
     return PR_TRUE;
   }
 
   return PR_FALSE;
 }
--- a/content/base/src/nsAttrValue.h
+++ b/content/base/src/nsAttrValue.h
@@ -125,17 +125,17 @@ public:
     ePercent =      0x0F, // 1111
     // Values below here won't matter, they'll be always stored in the 'misc'
     // struct.
     eCSSStyleRule = 0x10,
     eAtomArray =    0x11 
 #ifdef MOZ_SVG
     ,eSVGValue =    0x12
 #endif
-    ,eFloatValue  = 0x13
+    ,eDoubleValue  = 0x13
     ,eIntMarginValue = 0x14
   };
 
   ValueType Type() const;
 
   void Reset();
 
   void SetTo(const nsAttrValue& aOther);
@@ -160,17 +160,17 @@ public:
   PRBool GetColorValue(nscolor& aColor) const;
   inline PRInt16 GetEnumValue() const;
   inline float GetPercentValue() const;
   inline AtomArray* GetAtomArrayValue() const;
   inline mozilla::css::StyleRule* GetCSSStyleRuleValue() const;
 #ifdef MOZ_SVG
   inline nsISVGValue* GetSVGValue() const;
 #endif
-  inline double GetFloatValue() const;
+  inline double GetDoubleValue() const;
   PRBool GetIntMarginValue(nsIntMargin& aMargin) const;
 
   /**
    * Returns the string corresponding to the stored enum value.
    *
    * @param aResult   the string representing the enum tag
    * @param aRealTag  wheter we want to have the real tag or the saved one
    */
@@ -297,17 +297,17 @@ public:
   PRBool ParseColor(const nsAString& aString);
 
   /**
    * Parse a string value into a double-precision floating point value.
    *
    * @param aString the string to parse
    * @return whether the value could be parsed
    */
-  PRBool ParseFloatValue(const nsAString& aString);
+  PRBool ParseDoubleValue(const nsAString& aString);
 
   /**
    * Parse a lazy URI.  This just sets up the storage for the URI; it
    * doesn't actually allocate it.
    */
   PRBool ParseLazyURIValue(const nsAString& aString);
 
   /**
@@ -341,17 +341,17 @@ private:
       nscolor mColor;
       PRUint32 mEnumValue;
       PRInt32 mPercent;
       mozilla::css::StyleRule* mCSSStyleRule;
       AtomArray* mAtomArray;
 #ifdef MOZ_SVG
       nsISVGValue* mSVGValue;
 #endif
-      double mFloatValue;
+      double mDoubleValue;
       nsIntMargin* mIntMargin;
     };
   };
 
   inline ValueBaseType BaseType() const;
 
   /**
    * Get the index of an EnumTable in the sEnumTableArray.
@@ -454,20 +454,20 @@ inline nsISVGValue*
 nsAttrValue::GetSVGValue() const
 {
   NS_PRECONDITION(Type() == eSVGValue, "wrong type");
   return GetMiscContainer()->mSVGValue;
 }
 #endif
 
 inline double
-nsAttrValue::GetFloatValue() const
+nsAttrValue::GetDoubleValue() const
 {
-  NS_PRECONDITION(Type() == eFloatValue, "wrong type");
-  return GetMiscContainer()->mFloatValue;
+  NS_PRECONDITION(Type() == eDoubleValue, "wrong type");
+  return GetMiscContainer()->mDoubleValue;
 }
 
 inline PRBool
 nsAttrValue::GetIntMarginValue(nsIntMargin& aMargin) const
 {
   NS_PRECONDITION(Type() == eIntMarginValue, "wrong type");
   nsIntMargin* m = GetMiscContainer()->mIntMargin;
   if (!m)
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -2172,30 +2172,30 @@ nsGenericHTMLElement::SetUnsignedIntAttr
 {
   nsAutoString value;
   value.AppendInt(aValue);
 
   return SetAttr(kNameSpaceID_None, aAttr, value, PR_TRUE);
 }
 
 nsresult
-nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, double aDefault, double* aResult)
+nsGenericHTMLElement::GetDoubleAttr(nsIAtom* aAttr, double aDefault, double* aResult)
 {
   const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
-  if (attrVal && attrVal->Type() == nsAttrValue::eFloatValue) {
-    *aResult = attrVal->GetFloatValue();
+  if (attrVal && attrVal->Type() == nsAttrValue::eDoubleValue) {
+    *aResult = attrVal->GetDoubleValue();
   }
   else {
     *aResult = aDefault;
   }
   return NS_OK;
 }
 
 nsresult
-nsGenericHTMLElement::SetFloatAttr(nsIAtom* aAttr, double aValue)
+nsGenericHTMLElement::SetDoubleAttr(nsIAtom* aAttr, double aValue)
 {
   nsAutoString value;
   value.AppendFloat(aValue);
 
   return SetAttr(kNameSpaceID_None, aAttr, value, PR_TRUE);
 }
 
 nsresult
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -681,36 +681,36 @@ protected:
    * attributes in null namespace.
    *
    * @param aAttr    name of attribute.
    * @param aValue   Integer value of attribute.
    */
   NS_HIDDEN_(nsresult) SetUnsignedIntAttr(nsIAtom* aAttr, PRUint32 aValue);
 
   /**
-   * Helper method for NS_IMPL_FLOAT_ATTR macro.
-   * Gets the float-value of an attribute, returns specified default value
-   * if the attribute isn't set or isn't set to a float. Only works for
+   * Helper method for NS_IMPL_DOUBLE_ATTR macro.
+   * Gets the double-value of an attribute, returns specified default value
+   * if the attribute isn't set or isn't set to a double. Only works for
    * attributes in null namespace.
    *
    * @param aAttr    name of attribute.
    * @param aDefault default-value to return if attribute isn't set.
    * @param aResult  result value [out]
    */
-  NS_HIDDEN_(nsresult) GetFloatAttr(nsIAtom* aAttr, double aDefault, double* aValue);
+  NS_HIDDEN_(nsresult) GetDoubleAttr(nsIAtom* aAttr, double aDefault, double* aValue);
 
   /**
-   * Helper method for NS_IMPL_FLOAT_ATTR macro.
-   * Sets value of attribute to specified float. Only works for attributes
+   * Helper method for NS_IMPL_DOUBLE_ATTR macro.
+   * Sets value of attribute to specified double. Only works for attributes
    * in null namespace.
    *
    * @param aAttr    name of attribute.
-   * @param aValue   Float value of attribute.
+   * @param aValue   Double value of attribute.
    */
-  NS_HIDDEN_(nsresult) SetFloatAttr(nsIAtom* aAttr, double aValue);
+  NS_HIDDEN_(nsresult) SetDoubleAttr(nsIAtom* aAttr, double aValue);
 
   /**
    * Helper for GetURIAttr and GetHrefURIForAnchors which returns an
    * nsIURI in the out param.
    *
    * @param aCloneIfCached if true, clone the URI before returning if
    * it's cached.
    *
@@ -1185,32 +1185,32 @@ protected:
     if (aValue == 0) {                                                    \
       return NS_ERROR_DOM_INDEX_SIZE_ERR;                                 \
     }                                                                     \
     return SetUnsignedIntAttr(nsGkAtoms::_atom, aValue);                  \
   }
 
 /**
  * A macro to implement the getter and setter for a given double-precision
- * floating point valued content property. The method uses GetFloatAttr and
- * SetFloatAttr methods.
+ * floating point valued content property. The method uses GetDoubleAttr and
+ * SetDoubleAttr methods.
  */
 #define NS_IMPL_DOUBLE_ATTR(_class, _method, _atom)                    \
   NS_IMPL_DOUBLE_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0.0)
 
 #define NS_IMPL_DOUBLE_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
   NS_IMETHODIMP                                                             \
   _class::Get##_method(double* aValue)                                      \
   {                                                                         \
-    return GetFloatAttr(nsGkAtoms::_atom, _default, aValue);                \
+    return GetDoubleAttr(nsGkAtoms::_atom, _default, aValue);               \
   }                                                                         \
   NS_IMETHODIMP                                                             \
   _class::Set##_method(double aValue)                                       \
   {                                                                         \
-    return SetFloatAttr(nsGkAtoms::_atom, aValue);                          \
+    return SetDoubleAttr(nsGkAtoms::_atom, aValue);                         \
   }
 
 /**
  * A macro to implement the getter and setter for a given content
  * property that needs to return a URI in string form.  The method
  * uses the generic GetAttr and SetAttr methods.  This macro is much
  * like the NS_IMPL_STRING_ATTR macro, except we make sure the URI is
  * absolute.
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -1421,17 +1421,17 @@ PRBool nsHTMLMediaElement::ParseAttribut
     { 0 }
   };
 
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::loopstart
        || aAttribute == nsGkAtoms::loopend
        || aAttribute == nsGkAtoms::start
        || aAttribute == nsGkAtoms::end) {
-      return aResult.ParseFloatValue(aValue);
+      return aResult.ParseDoubleValue(aValue);
     }
     else if (ParseImageAttribute(aAttribute, aValue, aResult)) {
       return PR_TRUE;
     }
     else if (aAttribute == nsGkAtoms::preload) {
       return aResult.ParseEnumValue(aValue, kPreloadTable, PR_FALSE);
     }
   }