Title: [174383] trunk/Source/WebCore
- Revision
- 174383
- Author
- [email protected]
- Date
- 2014-10-06 20:32:55 -0700 (Mon, 06 Oct 2014)
Log Message
[iOS] Fix remaining misuses of abs() and fabsf()
https://bugs.webkit.org/show_bug.cgi?id=130947
Reviewed by Simon Fraser.
Fixed issues found when compiling with -Wabsolute-value.
* platform/ios/ScrollAnimatorIOS.mm:
(WebCore::ScrollAnimatorIOS::handleTouchEvent): Called abs() instead of fabsf for integral types. Explicitly
cast the divisor to float in the call to atanf().
* platform/ios/wak/WKView.mm:
(_WKViewAutoresizeCoord): Explicitly cast origMarginsTotal to an int before calling abs(). Added a FIXME
indicating the strange behavior when origMarginsTotal is in the range (0, 1) (as pointed out by Darin).
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (174382 => 174383)
--- trunk/Source/WebCore/ChangeLog 2014-10-07 03:28:32 UTC (rev 174382)
+++ trunk/Source/WebCore/ChangeLog 2014-10-07 03:32:55 UTC (rev 174383)
@@ -1,3 +1,19 @@
+2014-10-06 Andy Estes <[email protected]>
+
+ [iOS] Fix remaining misuses of abs() and fabsf()
+ https://bugs.webkit.org/show_bug.cgi?id=130947
+
+ Reviewed by Simon Fraser.
+
+ Fixed issues found when compiling with -Wabsolute-value.
+
+ * platform/ios/ScrollAnimatorIOS.mm:
+ (WebCore::ScrollAnimatorIOS::handleTouchEvent): Called abs() instead of fabsf for integral types. Explicitly
+ cast the divisor to float in the call to atanf().
+ * platform/ios/wak/WKView.mm:
+ (_WKViewAutoresizeCoord): Explicitly cast origMarginsTotal to an int before calling abs(). Added a FIXME
+ indicating the strange behavior when origMarginsTotal is in the range (0, 1) (as pointed out by Darin).
+
2014-10-06 Andreas Kling <[email protected]>
CanvasPattern always has an internal WebCore::Pattern.
Modified: trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm (174382 => 174383)
--- trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm 2014-10-07 03:28:32 UTC (rev 174382)
+++ trunk/Source/WebCore/platform/ios/ScrollAnimatorIOS.mm 2014-10-07 03:32:55 UTC (rev 174383)
@@ -128,7 +128,7 @@
if (m_touchScrollAxisLatch == AxisLatchNotComputed) {
const float lockAngleDegrees = 20;
if (deltaFromStart.width() && deltaFromStart.height()) {
- float dragAngle = atanf(fabsf(deltaFromStart.height()) / fabsf(deltaFromStart.width()));
+ float dragAngle = atanf(static_cast<float>(abs(deltaFromStart.height())) / abs(deltaFromStart.width()));
if (dragAngle <= deg2rad(lockAngleDegrees))
m_touchScrollAxisLatch = AxisLatchHorizontal;
else if (dragAngle >= deg2rad(90 - lockAngleDegrees))
@@ -146,13 +146,13 @@
// Horizontal
if (m_touchScrollAxisLatch != AxisLatchVertical) {
int delta = touchDelta.width();
- handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollLeft : ScrollRight, ScrollByPixel, fabsf(delta));
+ handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollLeft : ScrollRight, ScrollByPixel, abs(delta));
}
// Vertical
if (m_touchScrollAxisLatch != AxisLatchHorizontal) {
int delta = touchDelta.height();
- handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollUp : ScrollDown, ScrollByPixel, fabsf(delta));
+ handled |= m_scrollableAreaForTouchSequence->scroll(delta < 0 ? ScrollUp : ScrollDown, ScrollByPixel, abs(delta));
}
// Return false until we manage to scroll at all, and then keep returning true until the gesture ends.
Modified: trunk/Source/WebCore/platform/ios/wak/WKView.mm (174382 => 174383)
--- trunk/Source/WebCore/platform/ios/wak/WKView.mm 2014-10-07 03:28:32 UTC (rev 174382)
+++ trunk/Source/WebCore/platform/ios/wak/WKView.mm 2014-10-07 03:32:55 UTC (rev 174383)
@@ -247,8 +247,9 @@
}
// Do the 50/50 split even if XorY = 0 and the WidthOrHeight is only
// one pixel shorter...
+ // FIXME: If origMarginsTotal is in the range (0, 1) then we won't do the 50/50 split. Is this right?
else if (origMarginsTotal == 0.0f
- || (abs(origMarginsTotal) == 1)) {
+ || (abs(static_cast<int>(origMarginsTotal)) == 1)) {
prop = 0.5f; // Then split it 50:50.
}
else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes