RESOLVED FIXED 52910
Add various clampToInt() methods to MathExtras.h
https://bugs.webkit.org/show_bug.cgi?id=52910
Summary Add various clampToInt() methods to MathExtras.h
Simon Fraser (smfr)
Reported 2011-01-21 11:55:54 PST
In CSS code we need to range-check doubles before double-to-int conversion in various places. We need versions that allow only positive numbers, and positive and negative.
Attachments
Patch (4.23 KB, patch)
2011-01-21 12:23 PST, Simon Fraser (smfr)
barraclough: review+
Need this change too. (673 bytes, text/plain)
2011-01-28 17:49 PST, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2011-01-21 12:23:22 PST
Gavin Barraclough
Comment 2 2011-01-21 13:45:33 PST
Comment on attachment 79774 [details] Patch r+, but have you thought about how these methods will handle NaN? - I'm guessing that the answer is, we don't care for CSS - in which case I'd suggest ASSERT(!isNaN(d)) in each. If you're not going to guard against NaN, I think you should document what expected behaviour is.
Build Bot
Comment 3 2011-01-21 14:12:55 PST
Simon Fraser (smfr)
Comment 4 2011-01-21 14:24:53 PST
Gah, windows: 14>C:\cygwin\home\buildbot\Webkit\WebKitBuild\Debug\include\private\JavaScriptCore/MathExtras.h(213) : error C2220: warning treated as error - no 'object' file generated 14>C:\cygwin\home\buildbot\Webkit\WebKitBuild\Debug\include\private\JavaScriptCore/MathExtras.h(213) : warning C4003: not enough actual parameters for macro 'max' 14>C:\cygwin\home\buildbot\Webkit\WebKitBuild\Debug\include\private\JavaScriptCore/MathExtras.h(213) : error C2589: '(' : illegal token on right side of '::'
Simon Fraser (smfr)
Comment 5 2011-01-28 15:58:54 PST
Test
Simon Fraser (smfr)
Comment 6 2011-01-28 17:49:09 PST
Created attachment 80531 [details] Need this change too.
Simon Fraser (smfr)
Comment 7 2011-01-28 21:02:55 PST
Note You need to log in before you can comment on or make changes to this bug.