Title: [111371] trunk/Source/WebCore
Revision
111371
Author
[email protected]
Date
2012-03-20 01:32:11 -0700 (Tue, 20 Mar 2012)

Log Message

Remove min and max parameters from CSSPrimitiveValue's roundForImpreciseConversion function.
https://bugs.webkit.org/show_bug.cgi?id=81629

Reviewed by Andreas Kling.

No new tests / refactoring only.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
* css/CSSPrimitiveValue.h:
(WebCore::roundForImpreciseConversion):
* rendering/style/RenderStyle.h:
(WebCore::adjustForAbsoluteZoom):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (111370 => 111371)


--- trunk/Source/WebCore/ChangeLog	2012-03-20 08:24:37 UTC (rev 111370)
+++ trunk/Source/WebCore/ChangeLog	2012-03-20 08:32:11 UTC (rev 111371)
@@ -1,3 +1,19 @@
+2012-03-20  Luke Macpherson  <[email protected]>
+
+        Remove min and max parameters from CSSPrimitiveValue's roundForImpreciseConversion function.
+        https://bugs.webkit.org/show_bug.cgi?id=81629
+
+        Reviewed by Andreas Kling.
+
+        No new tests / refactoring only.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeLength):
+        * css/CSSPrimitiveValue.h:
+        (WebCore::roundForImpreciseConversion):
+        * rendering/style/RenderStyle.h:
+        (WebCore::adjustForAbsoluteZoom):
+
 2012-03-20  Jason Liu  <[email protected]>
 
         [BlackBerry]Cookies shouldn't be set into each of webcore's request and platform's request. And this makes a regression.

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)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to