WebKit::resistanceForDelta() truncates 'scaleDistance' to integer value using abs()
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Mar 2014 16:12:49 +0000 (16:12 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Mar 2014 16:12:49 +0000 (16:12 +0000)
<http://webkit.org/b/130651>

Reviewed by Darin Adler.

Fixes the following build failure with trunk clang:

    WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:112:28: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
        double scaleDistance = abs(limit - currentScale);
                               ^
    WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:112:28: note: use function 'fabs' instead
        double scaleDistance = abs(limit - currentScale);
                               ^~~
                               fabs

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::resistanceForDelta): Use fabs() instead of abs().

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166140 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm

index 6684f443b1a1ce63a120d734efc85fa871f6c19e..001bcb4236ea2d10002a5d84ead1472c117eed34 100644 (file)
@@ -1,3 +1,23 @@
+2014-03-23  David Kilzer  <ddkilzer@apple.com>
+
+        WebKit::resistanceForDelta() truncates 'scaleDistance' to integer value using abs()
+        <http://webkit.org/b/130651>
+
+        Reviewed by Darin Adler.
+
+        Fixes the following build failure with trunk clang:
+
+            WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:112:28: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
+                double scaleDistance = abs(limit - currentScale);
+                                       ^
+            WebKit2/UIProcess/mac/ViewGestureControllerMac.mm:112:28: note: use function 'fabs' instead
+                double scaleDistance = abs(limit - currentScale);
+                                       ^~~
+                                       fabs
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::resistanceForDelta): Use fabs() instead of abs().
+
 2014-03-23  Simon Fraser  <simon.fraser@apple.com>
 
         Clean up #includes by geometry classes
index af21d789673bd60636ffdadc8eadaa61509f60c3..5c8112da39e6a4ae7c09612a88d16533e3792a66 100644 (file)
@@ -109,7 +109,7 @@ static double resistanceForDelta(double deltaScale, double currentScale)
 
     // Outside of the extremes, resist further scaling.
     double limit = currentScale < minMagnification ? minMagnification : maxMagnification;
-    double scaleDistance = abs(limit - currentScale);
+    double scaleDistance = fabs(limit - currentScale);
     double scalePercent = std::min(std::max(scaleDistance / limit, 0.), 1.);
     double resistance = zoomOutResistance + scalePercent * (0.01 - zoomOutResistance);