Bug 636750 (3/4) - Use a double value instead of a float in nsAttrValue::MiscContainer. r=bz

This commit is contained in:
Mounir Lamouri 2011-03-25 15:43:40 +01:00
Родитель 6f29076965
Коммит 9489183971
4 изменённых файлов: 17 добавлений и 17 удалений

Просмотреть файл

@ -1211,7 +1211,7 @@ PRBool nsAttrValue::ParseFloatValue(const nsAString& aString)
ResetIfSet(); ResetIfSet();
PRInt32 ec; PRInt32 ec;
float val = PromiseFlatString(aString).ToFloat(&ec); double val = PromiseFlatString(aString).ToDouble(&ec);
if (NS_FAILED(ec)) { if (NS_FAILED(ec)) {
return PR_FALSE; return PR_FALSE;
} }

Просмотреть файл

@ -165,7 +165,7 @@ public:
#ifdef MOZ_SVG #ifdef MOZ_SVG
inline nsISVGValue* GetSVGValue() const; inline nsISVGValue* GetSVGValue() const;
#endif #endif
inline float GetFloatValue() const; inline double GetFloatValue() const;
PRBool GetIntMarginValue(nsIntMargin& aMargin) const; PRBool GetIntMarginValue(nsIntMargin& aMargin) const;
/** /**
@ -297,7 +297,7 @@ public:
PRBool ParseColor(const nsAString& aString); PRBool ParseColor(const nsAString& aString);
/** /**
* Parse a string value into a float. * Parse a string value into a double-precision floating point value.
* *
* @param aString the string to parse * @param aString the string to parse
* @return whether the value could be parsed * @return whether the value could be parsed
@ -346,7 +346,7 @@ private:
#ifdef MOZ_SVG #ifdef MOZ_SVG
nsISVGValue* mSVGValue; nsISVGValue* mSVGValue;
#endif #endif
float mFloatValue; double mFloatValue;
nsIntMargin* mIntMargin; nsIntMargin* mIntMargin;
}; };
}; };
@ -458,7 +458,7 @@ nsAttrValue::GetSVGValue() const
} }
#endif #endif
inline float inline double
nsAttrValue::GetFloatValue() const nsAttrValue::GetFloatValue() const
{ {
NS_PRECONDITION(Type() == eFloatValue, "wrong type"); NS_PRECONDITION(Type() == eFloatValue, "wrong type");

Просмотреть файл

@ -2177,7 +2177,7 @@ nsGenericHTMLElement::SetUnsignedIntAttr(nsIAtom* aAttr, PRUint32 aValue)
} }
nsresult nsresult
nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, float aDefault, float* aResult) nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, double aDefault, double* aResult)
{ {
const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr); const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr);
if (attrVal && attrVal->Type() == nsAttrValue::eFloatValue) { if (attrVal && attrVal->Type() == nsAttrValue::eFloatValue) {
@ -2190,7 +2190,7 @@ nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, float aDefault, float* aResul
} }
nsresult nsresult
nsGenericHTMLElement::SetFloatAttr(nsIAtom* aAttr, float aValue) nsGenericHTMLElement::SetFloatAttr(nsIAtom* aAttr, double aValue)
{ {
nsAutoString value; nsAutoString value;
value.AppendFloat(aValue); value.AppendFloat(aValue);

Просмотреть файл

@ -695,7 +695,7 @@ protected:
* @param aDefault default-value to return if attribute isn't set. * @param aDefault default-value to return if attribute isn't set.
* @param aResult result value [out] * @param aResult result value [out]
*/ */
NS_HIDDEN_(nsresult) GetFloatAttr(nsIAtom* aAttr, float aDefault, float* aValue); NS_HIDDEN_(nsresult) GetFloatAttr(nsIAtom* aAttr, double aDefault, double* aValue);
/** /**
* Helper method for NS_IMPL_FLOAT_ATTR macro. * Helper method for NS_IMPL_FLOAT_ATTR macro.
@ -705,7 +705,7 @@ protected:
* @param aAttr name of attribute. * @param aAttr name of attribute.
* @param aValue Float value of attribute. * @param aValue Float value of attribute.
*/ */
NS_HIDDEN_(nsresult) SetFloatAttr(nsIAtom* aAttr, float aValue); NS_HIDDEN_(nsresult) SetFloatAttr(nsIAtom* aAttr, double aValue);
/** /**
* Helper for GetURIAttr and GetHrefURIForAnchors which returns an * Helper for GetURIAttr and GetHrefURIForAnchors which returns an
@ -1189,21 +1189,21 @@ protected:
} }
/** /**
* A macro to implement the getter and setter for a given float * A macro to implement the getter and setter for a given double-precision
* valued content property. The method uses the generic GetAttr and * floating point valued content property. The method uses GetFloatAttr and
* SetAttr methods. * SetFloatAttr methods.
*/ */
#define NS_IMPL_FLOAT_ATTR(_class, _method, _atom) \ #define NS_IMPL_DOUBLE_ATTR(_class, _method, _atom) \
NS_IMPL_FLOAT_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0.0) NS_IMPL_DOUBLE_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0.0)
#define NS_IMPL_FLOAT_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \ #define NS_IMPL_DOUBLE_ATTR_DEFAULT_VALUE(_class, _method, _atom, _default) \
NS_IMETHODIMP \ NS_IMETHODIMP \
_class::Get##_method(float* aValue) \ _class::Get##_method(double* aValue) \
{ \ { \
return GetFloatAttr(nsGkAtoms::_atom, _default, aValue); \ return GetFloatAttr(nsGkAtoms::_atom, _default, aValue); \
} \ } \
NS_IMETHODIMP \ NS_IMETHODIMP \
_class::Set##_method(float aValue) \ _class::Set##_method(double aValue) \
{ \ { \
return SetFloatAttr(nsGkAtoms::_atom, aValue); \ return SetFloatAttr(nsGkAtoms::_atom, aValue); \
} }