RESOLVED FIXED 130297
Double values passed to fabsf() in maxScaleFromTransform()
https://bugs.webkit.org/show_bug.cgi?id=130297
Summary Double values passed to fabsf() in maxScaleFromTransform()
David Kilzer (:ddkilzer)
Reported 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.
Attachments
Patch v1 (2.86 KB, patch)
2014-03-15 22:08 PDT, David Kilzer (:ddkilzer)
no flags
Patch for follow-up issue (1.55 KB, patch)
2014-03-16 12:00 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2014-03-15 22:08:57 PDT
Created attachment 226832 [details] Patch v1
Darin Adler
Comment 2 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.
Darin Adler
Comment 3 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.
WebKit Commit Bot
Comment 4 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>
WebKit Commit Bot
Comment 5 2014-03-16 01:28:08 PDT
All reviewed patches have been landed. Closing bug.
David Kilzer (:ddkilzer)
Comment 6 2014-03-16 11:52:26 PDT
Reopening for follow-up patch to switch to using narrowPrecisionToFloat() instead.
David Kilzer (:ddkilzer)
Comment 7 2014-03-16 12:00:44 PDT
Created attachment 226850 [details] Patch for follow-up issue
WebKit Commit Bot
Comment 8 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>
WebKit Commit Bot
Comment 9 2014-03-16 14:42:19 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.