[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

simon.fraser at apple.com simon.fraser at apple.com
Mon Feb 21 00:16:48 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 991ac213915b1b9e1de96bea911245093f087d3f
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 29 05:02:31 2011 +0000

    2011-01-28  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Gavin Barraclough.
    
            Add various clampToInt() methods to MathExtras.h
            https://bugs.webkit.org/show_bug.cgi?id=52910
    
            Use clampToInteger() from MathExtras.h
    
            * css/CSSParser.cpp:
            (WebCore::CSSParser::parseCounter):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77045 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog
index d623693..03fe193 100644
--- a/Source/JavaScriptCore/ChangeLog
+++ b/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Add various clampToInt() methods to MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=52910
+        
+        Add functions for clamping doubles and floats to valid int
+        ranges, for signed and positive integers.
+
+        * wtf/MathExtras.h:
+        (clampToInteger):
+        (clampToPositiveInteger):
+
 2011-01-28  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r77006 and r77020.
diff --git a/Source/JavaScriptCore/wtf/MathExtras.h b/Source/JavaScriptCore/wtf/MathExtras.h
index 095549e..960497c 100644
--- a/Source/JavaScriptCore/wtf/MathExtras.h
+++ b/Source/JavaScriptCore/wtf/MathExtras.h
@@ -26,8 +26,10 @@
 #ifndef WTF_MathExtras_h
 #define WTF_MathExtras_h
 
+#include <algorithm>
 #include <cmath>
 #include <float.h>
+#include <limits>
 #include <stdlib.h>
 
 #if OS(SOLARIS)
@@ -205,6 +207,32 @@ inline float deg2turn(float d) { return d / 360.0f; }
 inline float rad2grad(float r) { return r * 200.0f / piFloat; }
 inline float grad2rad(float g) { return g * piFloat / 200.0f; }
 
+inline int clampToInteger(double d)
+{
+    const double minIntAsDouble = std::numeric_limits<int>::min();
+    const double maxIntAsDouble = std::numeric_limits<int>::max();
+    return static_cast<int>(std::max(std::min(d, maxIntAsDouble), minIntAsDouble));
+}
+
+inline int clampToPositiveInteger(double d)
+{
+    const double maxIntAsDouble = std::numeric_limits<int>::max();
+    return static_cast<int>(std::max<double>(std::min(d, maxIntAsDouble), 0));
+}
+
+inline int clampToInteger(float d)
+{
+    const float minIntAsFloat = std::numeric_limits<int>::min();
+    const float maxIntAsFloat = std::numeric_limits<int>::max();
+    return static_cast<int>(std::max(std::min(d, maxIntAsFloat), minIntAsFloat));
+}
+
+inline int clampToPositiveInteger(float d)
+{
+    const float maxIntAsFloat = std::numeric_limits<int>::max();
+    return static_cast<int>(std::max<float>(std::min(d, maxIntAsFloat), 0));
+}
+
 #if !COMPILER(MSVC) && !COMPILER(WINSCW) && !(COMPILER(RVCT) && (OS(SYMBIAN) || PLATFORM(BREWMP)))
 using std::isfinite;
 using std::isinf;
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 9c18e79..3ad8fab 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Add various clampToInt() methods to MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=52910
+
+        Use clampToInteger() from MathExtras.h
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseCounter):
+
 2011-01-28  Sheriff Bot  <webkit.review.bot at gmail.com>
 
         Unreviewed, rolling out r77006 and r77020.
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index 817d46c..ad05836 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -125,13 +125,6 @@ static bool hasPrefix(const char* string, unsigned length, const char* prefix)
     return false;
 }
 
-static int clampToSignedInteger(double d)
-{
-    const double minIntAsDouble = std::numeric_limits<int>::min();
-    const double maxIntAsDouble = std::numeric_limits<int>::max();
-    return static_cast<int>(max(minIntAsDouble, min(d, maxIntAsDouble)));
-}
-
 CSSParser::CSSParser(bool strictParsing)
     : m_strict(strictParsing)
     , m_important(false)
@@ -4628,7 +4621,7 @@ bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
             case VAL: {
                 int i = defaultValue;
                 if (val && val->unit == CSSPrimitiveValue::CSS_NUMBER) {
-                    i = clampToSignedInteger(val->fValue);
+                    i = clampToInteger(val->fValue);
                     m_valueList->next();
                 }
 
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 9aa18ef..03e59cb 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,14 @@
+2011-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Adam Roben.
+        
+        define NOMINMAX when building ImageDiff, as we do elsewhere.
+
+        Add various clampToInt() methods to MathExtras.h
+        https://bugs.webkit.org/show_bug.cgi?id=52910
+
+        * DumpRenderTree/win/ImageDiffCommon.vsprops:
+
 2011-01-28  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Darin Adler.
diff --git a/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops b/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops
index 1156a72..5d41bf4 100644
--- a/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops
+++ b/Tools/DumpRenderTree/win/ImageDiffCommon.vsprops
@@ -7,6 +7,7 @@
 	<Tool
 		Name="VCCLCompilerTool"
 		AdditionalIncludeDirectories="&quot;$(ConfigurationBuildDir)\include&quot;;&quot;$(ConfigurationBuildDir)\include\private&quot;;&quot;$(ConfigurationBuildDir)\include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
+		PreprocessorDefinitions="NOMINMAX"
 	/>
 	<Tool
 		Name="VCLinkerTool"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list