Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (111370 => 111371)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-03-20 08:24:37 UTC (rev 111370)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp 2012-03-20 08:32:11 UTC (rev 111371)
@@ -394,27 +394,27 @@
template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+ return roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
}
template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- return roundForImpreciseConversion<unsigned, UINT_MAX, 0>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+ return roundForImpreciseConversion<unsigned>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
}
template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- return Length(roundForImpreciseConversion<int, INT_MAX, INT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
+ return Length(roundForImpreciseConversion<int>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
}
template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- return roundForImpreciseConversion<short, SHRT_MAX, SHRT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+ return roundForImpreciseConversion<short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
}
template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
{
- return roundForImpreciseConversion<unsigned short, USHRT_MAX, 0>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
+ return roundForImpreciseConversion<unsigned short>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
}
template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (111370 => 111371)
--- trunk/Source/WebCore/css/CSSPrimitiveValue.h 2012-03-20 08:24:37 UTC (rev 111370)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h 2012-03-20 08:32:11 UTC (rev 111371)
@@ -42,13 +42,13 @@
struct Length;
-template<typename T, T max, T min> inline T roundForImpreciseConversion(double value)
+template<typename T> inline T roundForImpreciseConversion(double value)
{
// Dimension calculations are imprecise, often resulting in values of e.g.
// 44.99998. We need to go ahead and round if we're really close to the
// next integer value.
value += (value < 0) ? -0.01 : +0.01;
- return ((value > max) || (value < min)) ? 0 : static_cast<T>(value);
+ return ((value > std::numeric_limits<T>::max()) || (value < std::numeric_limits<T>::min())) ? 0 : static_cast<T>(value);
}
class CSSPrimitiveValue : public CSSValue {
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (111370 => 111371)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-03-20 08:24:37 UTC (rev 111370)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-03-20 08:32:11 UTC (rev 111371)
@@ -1779,7 +1779,7 @@
value++;
}
- return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
+ return roundForImpreciseConversion<int>(value / zoomFactor);
}
inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)