summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2011-05-23 22:33:39 +0000
committerSergio Ahumada <sergio.ahumada@nokia.com>2011-06-29 21:37:38 +0200
commit5fdbf7170f9b2dcac3088461ef75fae39d6c364b (patch)
treec42ca06252d99635f33e67ea159e7757dc154ebd
parent223eab4b5bfcc625c526a2e754a54b6250f5f6ec (diff)
2011-05-23 Matthew Delaney <mdelaney@apple.com>
Reviewed by Simon Fraser. Remove safeFloatToInt() in FloatRect.cpp and replace with working version of clampToInteger() https://bugs.webkit.org/show_bug.cgi?id=58216 * wtf/MathExtras.h: (clampToInteger): (clampToPositiveInteger): 2011-05-23 Matthew Delaney <mdelaney@apple.com> Reviewed by Simon Fraser. Remove safeFloatToInt() in FloatRect.cpp and replace with working version of clampToInteger() https://bugs.webkit.org/show_bug.cgi?id=58216 No new tests. The SVG tests mask-excessive-malloc.svg and pattern-excessive-malloc.svg exercise this code path. * platform/graphics/FloatRect.cpp: (WebCore::enclosingIntRect): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87103 268f45cc-cd09-0410-ab3c-d52691b4dbfc Signed-off-by: Alexis Menard <alexis.menard@nokia.com>
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog11
-rw-r--r--src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h24
-rw-r--r--src/3rdparty/webkit/Source/WebCore/ChangeLog12
-rw-r--r--src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp16
4 files changed, 42 insertions, 21 deletions
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog
index 4ad4131b19..ae7ef60dc4 100644
--- a/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
+2011-05-23 Matthew Delaney <mdelaney@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Remove safeFloatToInt() in FloatRect.cpp and replace with working version of clampToInteger()
+ https://bugs.webkit.org/show_bug.cgi?id=58216
+
+ * wtf/MathExtras.h:
+ (clampToInteger):
+ (clampToPositiveInteger):
+
2011-06-20 Oliver Hunt <oliver@apple.com>
Reviewed by Darin Adler.
diff --git a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h
index fac187c0a5..f1b13a5f16 100644
--- a/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h
+++ b/src/3rdparty/webkit/Source/JavaScriptCore/wtf/MathExtras.h
@@ -220,17 +220,27 @@ inline int clampToPositiveInteger(double d)
return static_cast<int>(std::max<double>(std::min(d, maxIntAsDouble), 0));
}
-inline int clampToInteger(float d)
+inline int clampToInteger(float x)
{
- const float minIntAsFloat = static_cast<float>(std::numeric_limits<int>::min());
- const float maxIntAsFloat = static_cast<float>(std::numeric_limits<int>::max());
- return static_cast<int>(std::max(std::min(d, maxIntAsFloat), minIntAsFloat));
+ static const int s_intMax = std::numeric_limits<int>::max();
+ static const int s_intMin = std::numeric_limits<int>::min();
+
+ if (x >= static_cast<float>(s_intMax))
+ return s_intMax;
+ if (x < static_cast<float>(s_intMin))
+ return s_intMin;
+ return static_cast<int>(x);
}
-inline int clampToPositiveInteger(float d)
+inline int clampToPositiveInteger(float x)
{
- const float maxIntAsFloat = static_cast<float>(std::numeric_limits<int>::max());
- return static_cast<int>(std::max<float>(std::min(d, maxIntAsFloat), 0));
+ static const int s_intMax = std::numeric_limits<int>::max();
+
+ if (x >= static_cast<float>(s_intMax))
+ return s_intMax;
+ if (x < 0)
+ return 0;
+ return static_cast<int>(x);
}
inline int clampToInteger(unsigned value)
diff --git a/src/3rdparty/webkit/Source/WebCore/ChangeLog b/src/3rdparty/webkit/Source/WebCore/ChangeLog
index 86a1d8cce1..ea77d39453 100644
--- a/src/3rdparty/webkit/Source/WebCore/ChangeLog
+++ b/src/3rdparty/webkit/Source/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2011-05-23 Matthew Delaney <mdelaney@apple.com>
+
+ Reviewed by Simon Fraser.
+
+ Remove safeFloatToInt() in FloatRect.cpp and replace with working version of clampToInteger()
+ https://bugs.webkit.org/show_bug.cgi?id=58216
+
+ No new tests. The SVG tests mask-excessive-malloc.svg and pattern-excessive-malloc.svg exercise this code path.
+
+ * platform/graphics/FloatRect.cpp:
+ (WebCore::enclosingIntRect):
+
2011-06-27 Joe Wild <joseph.wild@nokia.com>
Reviewed by Simon Fraser.
diff --git a/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp b/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp
index 165ef76e40..7afc92baa9 100644
--- a/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp
+++ b/src/3rdparty/webkit/Source/WebCore/platform/graphics/FloatRect.cpp
@@ -182,18 +182,6 @@ void FloatRect::fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const Fl
setLocationAndSizeFromEdges(left, top, right, bottom);
}
-static inline int safeFloatToInt(float x)
-{
- static const int s_intMax = std::numeric_limits<int>::max();
- static const int s_intMin = std::numeric_limits<int>::min();
-
- if (x >= static_cast<float>(s_intMax))
- return s_intMax;
- if (x < static_cast<float>(s_intMin))
- return s_intMin;
- return static_cast<int>(x);
-}
-
IntRect enclosingIntRect(const FloatRect& rect)
{
float left = floorf(rect.x());
@@ -201,8 +189,8 @@ IntRect enclosingIntRect(const FloatRect& rect)
float width = ceilf(rect.maxX()) - left;
float height = ceilf(rect.maxY()) - top;
- return IntRect(safeFloatToInt(left), safeFloatToInt(top),
- safeFloatToInt(width), safeFloatToInt(height));
+ return IntRect(clampToInteger(left), clampToInteger(top),
+ clampToInteger(width), clampToInteger(height));
}
FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect)