Title: [124253] trunk/Source/WebCore
- Revision
- 124253
- Author
- [email protected]
- Date
- 2012-07-31 14:32:03 -0700 (Tue, 31 Jul 2012)
Log Message
FractionalLayoutUnit minor math bugs
https://bugs.webkit.org/show_bug.cgi?id=86065
Reviewed by Levi Weintraub.
Implement a consistent set of subject modifying operators, to ensure
operations that need to be in float are performed in float.
Scale FractionalLayoutSize in FractionalLayoutUnits instead of intergers.
No new functionality. No new tests.
* platform/FractionalLayoutUnit.h:
(WebCore::operator-=):
(WebCore::operator*=):
(WebCore::operator/=):
* platform/graphics/FractionalLayoutSize.h:
(WebCore::FractionalLayoutSize::scale):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (124252 => 124253)
--- trunk/Source/WebCore/ChangeLog 2012-07-31 21:29:31 UTC (rev 124252)
+++ trunk/Source/WebCore/ChangeLog 2012-07-31 21:32:03 UTC (rev 124253)
@@ -1,3 +1,24 @@
+2012-07-31 Allan Sandfeld Jensen <[email protected]>
+
+ FractionalLayoutUnit minor math bugs
+ https://bugs.webkit.org/show_bug.cgi?id=86065
+
+ Reviewed by Levi Weintraub.
+
+ Implement a consistent set of subject modifying operators, to ensure
+ operations that need to be in float are performed in float.
+
+ Scale FractionalLayoutSize in FractionalLayoutUnits instead of intergers.
+
+ No new functionality. No new tests.
+
+ * platform/FractionalLayoutUnit.h:
+ (WebCore::operator-=):
+ (WebCore::operator*=):
+ (WebCore::operator/=):
+ * platform/graphics/FractionalLayoutSize.h:
+ (WebCore::FractionalLayoutSize::scale):
+
2012-07-31 Joshua Netterfield <[email protected]>
[BlackBerry] Enable CSS Filter Effects
Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (124252 => 124253)
--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-07-31 21:29:31 UTC (rev 124252)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-07-31 21:32:03 UTC (rev 124253)
@@ -592,17 +592,24 @@
return a;
}
+inline FractionalLayoutUnit& operator-=(FractionalLayoutUnit& a, float b)
+{
+ a = a - b;
+ return a;
+}
+
inline float& operator-=(float& a, const FractionalLayoutUnit& b)
{
a = a - b;
return a;
}
-inline FractionalLayoutUnit& operator*=(FractionalLayoutUnit& a, int b)
+inline FractionalLayoutUnit& operator*=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
{
a = a * b;
return a;
}
+// operator*=(FractionalLayoutUnit& a, int b) is supported by the operator above plus FractionalLayoutUnit(int).
inline FractionalLayoutUnit& operator*=(FractionalLayoutUnit& a, float b)
{
@@ -610,6 +617,31 @@
return a;
}
+inline float& operator*=(float& a, const FractionalLayoutUnit& b)
+{
+ a = a * b;
+ return a;
+}
+
+inline FractionalLayoutUnit& operator/=(FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
+{
+ a = a / b;
+ return a;
+}
+// operator/=(FractionalLayoutUnit& a, int b) is supported by the operator above plus FractionalLayoutUnit(int).
+
+inline FractionalLayoutUnit& operator/=(FractionalLayoutUnit& a, float b)
+{
+ a = a / b;
+ return a;
+}
+
+inline float& operator/=(float& a, const FractionalLayoutUnit& b)
+{
+ a = a / b;
+ return a;
+}
+
inline int snapSizeToPixel(FractionalLayoutUnit size, FractionalLayoutUnit location)
{
return (location + size).round() - location.round();
Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutSize.h (124252 => 124253)
--- trunk/Source/WebCore/platform/graphics/FractionalLayoutSize.h 2012-07-31 21:29:31 UTC (rev 124252)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutSize.h 2012-07-31 21:32:03 UTC (rev 124253)
@@ -74,8 +74,8 @@
void scale(float scale)
{
- m_width = static_cast<int>(static_cast<float>(m_width) * scale);
- m_height = static_cast<int>(static_cast<float>(m_height) * scale);
+ m_width *= scale;
+ m_height *= scale;
}
FractionalLayoutSize expandedTo(const FractionalLayoutSize& other) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes