This proposal is for * reducing number of lines in call sites for ease of maintenance, * be functional style (no side effect and increasing chance to use floating pointer register) == Current Pattern 1 == double numberValue; if (!parseToDoubleForNumberType(string, &numberValue)) return defaultValue; ASSERT(isfinite(numberValue)); return numberValue; == New Pattern 1 == return parseToDoubleForNumberType(string, defaultValue) == Current Pattern 2 == double max; bool ok = parseToDoubleForNumberType(string, &max); if (!ok || max <= 0) return 1; return max; == New Pattern 2 == return max(parseToDoubleForNumberType(string), 1); == Current Pattern 3 == return !value.isEmpty() && !parseToDoubleForNumberType(value, 0); == New Pattern 3 == return !value.isEmpty() && isfinite(parseToDubleForNumberType(value)); == Current Pattern 4 == double min = 0; parseToDoubleForNumberType(string, &min); return min; == New Pattern 4 == return parseToDoubleForNumberType(string, 0);
Created attachment 143191 [details] Patch 1
Comment on attachment 143191 [details] Patch 1 Could you review changes? This change helps introducing decimal arithmetic for allowing us to use const reference of Decimal object. Thanks in advance.
Comment on attachment 143191 [details] Patch 1 View in context: https://bugs.webkit.org/attachment.cgi?id=143191&action=review > Source/WebCore/html/parser/HTMLParserIdioms.h:48 > +double parseToDoubleForNumberType(const String&, double); It's worth giving a parameter name since the intention isn't clear for this case. > Source/WebCore/html/parser/HTMLParserIdioms.h:50 > +double parseToDoubleForNumberTypeWithDecimalPlaces(const String&, unsigned*, double); Ditto.
Created attachment 143207 [details] Patch 2
Comment on attachment 143207 [details] Patch 2 Thanks for quick response. I updated as you suggested. Could you review again? Thanks in advance.
Comment on attachment 143207 [details] Patch 2 Clearing flags on attachment: 143207 Committed r117929: <http://trac.webkit.org/changeset/117929>
All reviewed patches have been landed. Closing bug.