Title: [105678] trunk/Source/WebCore
Revision
105678
Author
macpher...@chromium.org
Date
2012-01-23 18:36:19 -0800 (Mon, 23 Jan 2012)

Log Message

Make zoom multiplier float instead of double to match RenderStyle::effectiveZoom etc. and thus avoid unnecessary precision conversions.
https://bugs.webkit.org/show_bug.cgi?id=69490

Reviewed by Andreas Kling.

Covered by existing tests.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::computeLength):
Use float multiplier instead of double.
(WebCore::CSSPrimitiveValue::computeLengthDouble):
Use float multiplier instead of double.
* css/CSSPrimitiveValue.h:
Change type signatures of computeLength template prototype.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (105677 => 105678)


--- trunk/Source/WebCore/ChangeLog	2012-01-24 02:33:10 UTC (rev 105677)
+++ trunk/Source/WebCore/ChangeLog	2012-01-24 02:36:19 UTC (rev 105678)
@@ -1,3 +1,20 @@
+2012-01-23  Luke Macpherson   <macpher...@chromium.org>
+
+        Make zoom multiplier float instead of double to match RenderStyle::effectiveZoom etc. and thus avoid unnecessary precision conversions.
+        https://bugs.webkit.org/show_bug.cgi?id=69490
+
+        Reviewed by Andreas Kling.
+
+        Covered by existing tests.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::computeLength):
+        Use float multiplier instead of double.
+        (WebCore::CSSPrimitiveValue::computeLengthDouble):
+        Use float multiplier instead of double.
+        * css/CSSPrimitiveValue.h:
+        Change type signatures of computeLength template prototype.
+
 2012-01-23  Priit Laes  <pl...@plaes.org>
 
         [GTK][PATCH] More build silencing with (AM_V_...)

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (105677 => 105678)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-01-24 02:33:10 UTC (rev 105677)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2012-01-24 02:36:19 UTC (rev 105678)
@@ -355,43 +355,43 @@
     }
 }
 
-template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> int CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
 }
 
-template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> unsigned CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     return roundForImpreciseConversion<unsigned, UINT_MAX, 0>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
 }
 
-template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> Length CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     // FIXME: Length.h no longer expects 28 bit integers, so these bounds should be INT_MAX and INT_MIN
     return Length(roundForImpreciseConversion<int, intMaxForLength, intMinForLength>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize)), Fixed);
 }
 
-template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     return roundForImpreciseConversion<short, SHRT_MAX, SHRT_MIN>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
 }
 
-template<> unsigned short CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool 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));
 }
 
-template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> float CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     return static_cast<float>(computeLengthDouble(style, rootStyle, multiplier, computingFontSize));
 }
 
-template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+template<> double CSSPrimitiveValue::computeLength(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     return computeLengthDouble(style, rootStyle, multiplier, computingFontSize);
 }
 
-double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, double multiplier, bool computingFontSize)
+double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* rootStyle, float multiplier, bool computingFontSize)
 {
     unsigned short type = primitiveType();
 
@@ -442,7 +442,7 @@
     }
 
     double result = getDoubleValue() * factor;
-    if (!applyZoomMultiplier || multiplier == 1.0)
+    if (!applyZoomMultiplier || multiplier == 1.0f)
         return result;
 
     // Any original result that was >= 1 should not be allowed to fall below 1.  This keeps border lines from

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.h (105677 => 105678)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.h	2012-01-24 02:33:10 UTC (rev 105677)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.h	2012-01-24 02:36:19 UTC (rev 105678)
@@ -201,7 +201,7 @@
      * this is screen/printer dependent, so we probably need a config option for this,
      * and some tool to calibrate.
      */
-    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, double multiplier = 1.0, bool computingFontSize = false);
+    template<typename T> T computeLength(RenderStyle* currStyle, RenderStyle* rootStyle, float multiplier = 1.0f, bool computingFontSize = false);
 
     // use with care!!!
     void setPrimitiveType(unsigned short type) { m_primitiveUnitType = type; }
@@ -301,7 +301,7 @@
 
     bool getDoubleValueInternal(UnitTypes targetUnitType, double* result) const;
 
-    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, double multiplier, bool computingFontSize);
+    double computeLengthDouble(RenderStyle* currentStyle, RenderStyle* rootStyle, float multiplier, bool computingFontSize);
 
     union {
         int ident;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to