Fixed: document was not wrap in a #if PLATFORM

This commit is contained in:
Alexandre Wilhelm
2015-07-07 11:14:56 -07:00
parent 799622a932
commit 2cb6ddf3ca
2 changed files with 30 additions and 11 deletions
+6 -3
View File
@@ -80,6 +80,8 @@ CPStringSizeCachingEnabled = YES;
- (CGSize)sizeWithFont:(CPFont)aFont inWidth:(float)aWidth
{
var size;
#if PLATFORM(DOM)
if (!CPStringSizeCachingEnabled)
return [CPPlatformString sizeOfString:self withFont:aFont forWidth:aWidth];
@@ -88,8 +90,9 @@ CPStringSizeCachingEnabled = YES;
CPStringSizeWithFontInWidthCache[self] = [];
var cssString = [aFont cssString],
cacheKey = cssString + '_' + aWidth,
size = CPStringSizeWithFontInWidthCache[self][cacheKey];
cacheKey = cssString + '_' + aWidth;
size = CPStringSizeWithFontInWidthCache[self][cacheKey];
if (size !== undefined)
return CGSizeMakeCopy(size);
@@ -105,7 +108,7 @@ CPStringSizeCachingEnabled = YES;
else
{
if (CPStringSizeMeasuringContext.font !== cssString)
CPStringSizeMeasuringContext.font = cssString;
CPStringSizeMeasuringContext.font = cssString;
var fontHeight = CPStringSizeWithFontHeightCache[cssString];