[Webkit-unassigned] [Bug 42484] Support localized numbers in <input type=number>

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 1 16:08:42 PST 2011


--- Comment #18 from Alexey Proskuryakov <ap at webkit.org>  2011-03-01 16:08:42 PST ---
> Source/WebCore/platform/text/mac/LocalizedNumberMac.mm:58
> +    NSNumberFormatter* formatter = [[[NSNumberFormatter alloc] init] autorelease];

Although autorelease works, we prefer explicit refcounting in WebCore. So, this should be:

RetainPtr<NSNumberFormatter> formatter(AdoptNS, [[NSNumberFormatter alloc] init]);

+    NSNumber* num = [formatter numberFromString:numberString];

Please don't abbreviate.

+    if (num == nil)

WebKit style is to not compare to zero, so this should just be "if (!num)" (with a better name for num).

+    NSNumber* num = [NSNumber numberWithDouble:number];

WebKit style is to put stars on the other side for Objective-C types. But it would be better to use alloc/init and RetainPtr here, too. The reasons I know of are:
1) It's faster to destroy temporaries right away, while they are in memory cache.
2) The autorelease pool won't be drained during micro-benchmarks that spin without returning to message loop, causing high memory usage.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list