From 9489183971a36721c531810373d940f85bbde627 Mon Sep 17 00:00:00 2001 From: Mounir Lamouri Date: Fri, 25 Mar 2011 15:43:40 +0100 Subject: [PATCH] Bug 636750 (3/4) - Use a double value instead of a float in nsAttrValue::MiscContainer. r=bz --- content/base/src/nsAttrValue.cpp | 2 +- content/base/src/nsAttrValue.h | 8 ++++---- .../html/content/src/nsGenericHTMLElement.cpp | 4 ++-- .../html/content/src/nsGenericHTMLElement.h | 20 +++++++++---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/content/base/src/nsAttrValue.cpp b/content/base/src/nsAttrValue.cpp index 76cb3405815b..579480b32b1f 100644 --- a/content/base/src/nsAttrValue.cpp +++ b/content/base/src/nsAttrValue.cpp @@ -1211,7 +1211,7 @@ PRBool nsAttrValue::ParseFloatValue(const nsAString& aString) ResetIfSet(); PRInt32 ec; - float val = PromiseFlatString(aString).ToFloat(&ec); + double val = PromiseFlatString(aString).ToDouble(&ec); if (NS_FAILED(ec)) { return PR_FALSE; } diff --git a/content/base/src/nsAttrValue.h b/content/base/src/nsAttrValue.h index 47c2513e6d40..a3c95056c471 100644 --- a/content/base/src/nsAttrValue.h +++ b/content/base/src/nsAttrValue.h @@ -165,7 +165,7 @@ public: #ifdef MOZ_SVG inline nsISVGValue* GetSVGValue() const; #endif - inline float GetFloatValue() const; + inline double GetFloatValue() const; PRBool GetIntMarginValue(nsIntMargin& aMargin) const; /** @@ -297,7 +297,7 @@ public: 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 * @return whether the value could be parsed @@ -346,7 +346,7 @@ private: #ifdef MOZ_SVG nsISVGValue* mSVGValue; #endif - float mFloatValue; + double mFloatValue; nsIntMargin* mIntMargin; }; }; @@ -458,7 +458,7 @@ nsAttrValue::GetSVGValue() const } #endif -inline float +inline double nsAttrValue::GetFloatValue() const { NS_PRECONDITION(Type() == eFloatValue, "wrong type"); diff --git a/content/html/content/src/nsGenericHTMLElement.cpp b/content/html/content/src/nsGenericHTMLElement.cpp index 99b1ff9857d2..aac237a75c70 100644 --- a/content/html/content/src/nsGenericHTMLElement.cpp +++ b/content/html/content/src/nsGenericHTMLElement.cpp @@ -2177,7 +2177,7 @@ nsGenericHTMLElement::SetUnsignedIntAttr(nsIAtom* aAttr, PRUint32 aValue) } nsresult -nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, float aDefault, float* aResult) +nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, double aDefault, double* aResult) { const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(aAttr); if (attrVal && attrVal->Type() == nsAttrValue::eFloatValue) { @@ -2190,7 +2190,7 @@ nsGenericHTMLElement::GetFloatAttr(nsIAtom* aAttr, float aDefault, float* aResul } nsresult -nsGenericHTMLElement::SetFloatAttr(nsIAtom* aAttr, float aValue) +nsGenericHTMLElement::SetFloatAttr(nsIAtom* aAttr, double aValue) { nsAutoString value; value.AppendFloat(aValue); diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 1d8c67052215..ae5fb21c3915 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -695,7 +695,7 @@ protected: * @param aDefault default-value to return if attribute isn't set. * @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. @@ -705,7 +705,7 @@ protected: * @param aAttr name 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 @@ -1189,21 +1189,21 @@ protected: } /** - * A macro to implement the getter and setter for a given float - * valued content property. The method uses the generic GetAttr and - * SetAttr methods. + * 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. */ -#define NS_IMPL_FLOAT_ATTR(_class, _method, _atom) \ - NS_IMPL_FLOAT_ATTR_DEFAULT_VALUE(_class, _method, _atom, 0.0) +#define NS_IMPL_DOUBLE_ATTR(_class, _method, _atom) \ + 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 \ - _class::Get##_method(float* aValue) \ + _class::Get##_method(double* aValue) \ { \ return GetFloatAttr(nsGkAtoms::_atom, _default, aValue); \ } \ NS_IMETHODIMP \ - _class::Set##_method(float aValue) \ + _class::Set##_method(double aValue) \ { \ return SetFloatAttr(nsGkAtoms::_atom, aValue); \ }