Fixed: number formatter was called twice for every setObjectValue.

Previously setObjectValue checked for a formatted value, and then called [self stringValue], which ended up formatting the value again.

Now all of the cases (no formatter, formatter succeeds, formatter fails) are handled explicitly in setObjectValue, eliminating the extra call to the formatter.
This commit is contained in:
Aparajita Fishman committed 2013-07-22 21:26:18 -04:00
1 parent a5e62ed132
commit 650bc77b2c
2 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -530,7 +530,7 @@ var CPControlBlackColor = [CPColor blackColor];
return formattedValue;
}
return (_value === undefined || _value === nil) ? "" : String(_value);
return (_value === undefined || _value === nil) ? @"" : String(_value);
}
/*!
+5 -2
View File
@@ -1103,10 +1103,13 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
value = undefined;
[super setObjectValue:value];
_stringValue = (value === nil || value === undefined) ? @"" : String(value);
}
else
_stringValue = formattedString;
}
_stringValue = [self stringValue];
else
_stringValue = [self stringValue];
#if PLATFORM(DOM)