Bug 130297 - Double values passed to fabsf() in maxScaleFromTransform()
Summary: Double values passed to fabsf() in maxScaleFromTransform()
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-15 21:46 PDT by David Kilzer (:ddkilzer)
Modified: 2014-03-16 14:42 PDT (History)
5 users (show)

See Also:


Attachments
Patch v1 (2.86 KB, patch)
2014-03-15 22:08 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch for follow-up issue (1.55 KB, patch)
2014-03-16 12:00 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2014-03-15 21:46:32 PDT
WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287:21: error: absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value [-Werror,-Wabsolute-value]
    return std::max(fabsf(decomposeData.scaleX), fabsf(decomposeData.scaleY));
                    ^
WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287:21: note: use function 'fabs' instead
    return std::max(fabsf(decomposeData.scaleX), fabsf(decomposeData.scaleY));
                    ^~~~~
                    fabs
WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287:50: error: absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value [-Werror,-Wabsolute-value]
    return std::max(fabsf(decomposeData.scaleX), fabsf(decomposeData.scaleY));
                                                 ^
WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287:50: note: use function 'fabs' instead
    return std::max(fabsf(decomposeData.scaleX), fabsf(decomposeData.scaleY));
                                                 ^~~~~
                                                 fabs
2 errors generated.
Comment 1 David Kilzer (:ddkilzer) 2014-03-15 22:08:57 PDT
Created attachment 226832 [details]
Patch v1
Comment 2 Darin Adler 2014-03-16 00:58:19 PDT
Comment on attachment 226832 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=226832&action=review

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287
> +    return std::max(fabsf(static_cast<float>(decomposeData.scaleX)), fabsf(static_cast<float>(decomposeData.scaleY)));

I’d really prefer we use syntax cast for casting double to float that would not also work to convert, say, int to float.
Comment 3 Darin Adler 2014-03-16 00:58:42 PDT
Comment on attachment 226832 [details]
Patch v1

View in context: https://bugs.webkit.org/attachment.cgi?id=226832&action=review

>> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:287
>> +    return std::max(fabsf(static_cast<float>(decomposeData.scaleX)), fabsf(static_cast<float>(decomposeData.scaleY)));
> 
> I’d really prefer we use syntax cast for casting double to float that would not also work to convert, say, int to float.

Seems like we have it! It’s called narrowPrecisionToFloat.
Comment 4 WebKit Commit Bot 2014-03-16 01:28:04 PDT
Comment on attachment 226832 [details]
Patch v1

Clearing flags on attachment: 226832

Committed r165693: <http://trac.webkit.org/changeset/165693>
Comment 5 WebKit Commit Bot 2014-03-16 01:28:08 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 David Kilzer (:ddkilzer) 2014-03-16 11:52:26 PDT
Reopening for follow-up patch to switch to using narrowPrecisionToFloat() instead.
Comment 7 David Kilzer (:ddkilzer) 2014-03-16 12:00:44 PDT
Created attachment 226850 [details]
Patch for follow-up issue
Comment 8 WebKit Commit Bot 2014-03-16 14:42:16 PDT
Comment on attachment 226850 [details]
Patch for follow-up issue

Clearing flags on attachment: 226850

Committed r165711: <http://trac.webkit.org/changeset/165711>
Comment 9 WebKit Commit Bot 2014-03-16 14:42:19 PDT
All reviewed patches have been landed.  Closing bug.