Title: [108006] trunk/Source/WebCore
- Revision
- 108006
- Author
- e...@chromium.org
- Date
- 2012-02-16 17:16:15 -0800 (Thu, 16 Feb 2012)
Log Message
Fix use of long long in FractionalLayoutUnit::setRawValue
https://bugs.webkit.org/show_bug.cgi?id=78835
Reviewed by Eric Seidel.
Change setRawValue(long long) to compare against int min and max instead
of using abs as not all platforms we support implement a long long
version of abs or llabs.
No new tests.
* platform/FractionalLayoutUnit.h:
(WebCore::FractionalLayoutUnit::setRawValue):
Compare against int min/max instead of just max with abs.
(WebCore::FractionalLayoutUnit::isInBounds):
Fix type mismatch warning.
(WebCore::operator==):
Fix typo.
(WebCore::operator*):
Use long long version of setRawValue.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (108005 => 108006)
--- trunk/Source/WebCore/ChangeLog 2012-02-17 01:11:25 UTC (rev 108005)
+++ trunk/Source/WebCore/ChangeLog 2012-02-17 01:16:15 UTC (rev 108006)
@@ -1,3 +1,29 @@
+2012-02-16 Emil A Eklund <e...@chromium.org>
+
+ Fix use of long long in FractionalLayoutUnit::setRawValue
+ https://bugs.webkit.org/show_bug.cgi?id=78835
+
+ Reviewed by Eric Seidel.
+
+ Change setRawValue(long long) to compare against int min and max instead
+ of using abs as not all platforms we support implement a long long
+ version of abs or llabs.
+
+ No new tests.
+
+ * platform/FractionalLayoutUnit.h:
+ (WebCore::FractionalLayoutUnit::setRawValue):
+ Compare against int min/max instead of just max with abs.
+
+ (WebCore::FractionalLayoutUnit::isInBounds):
+ Fix type mismatch warning.
+
+ (WebCore::operator==):
+ Fix typo.
+
+ (WebCore::operator*):
+ Use long long version of setRawValue.
+
2012-02-15 Shinya Kawanaka <shin...@chromium.org>
Add an internal flag to accept multiple shadow roots for the purpose of tests.
Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (108005 => 108006)
--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-02-17 01:11:25 UTC (rev 108005)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-02-17 01:16:15 UTC (rev 108006)
@@ -64,7 +64,11 @@
inline int rawValue() const { return m_value; }
inline void setRawValue(int value) { m_value = value; }
- inline void setRawValue(long long value) { ASSERT(::abs(value) < std::numeric_limits<int>::max()); m_value = value; }
+ inline void setRawValue(long long value)
+ {
+ ASSERT(value > std::numeric_limits<int>::min() && value < std::numeric_limits<int>::max());
+ m_value = value;
+ }
inline FractionalLayoutUnit abs()
{
@@ -115,7 +119,7 @@
}
inline bool isInBounds(unsigned value)
{
- return value < std::numeric_limits<int>::max() / kFixedPointDenominator;
+ return value < static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
}
inline bool isInBounds(double value)
{
@@ -262,12 +266,12 @@
inline bool operator==(const FractionalLayoutUnit& a, int b)
{
- return a == FractionLayoutUnit(b);
+ return a == FractionalLayoutUnit(b);
}
inline bool operator==(const int a, const FractionalLayoutUnit& b)
{
- return FractionLayoutUnit(a) == b;
+ return FractionalLayoutUnit(a) == b;
}
inline bool operator==(const FractionalLayoutUnit& a, float b)
@@ -297,7 +301,7 @@
{
FractionalLayoutUnit returnVal;
long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator;
- returnVal.setRawValue((a.rawValue() / kFixedPointDenominator) * b.rawValue());
+ returnVal.setRawValue(rawVal);
return returnVal;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes