Bug 1226627 - Truncate the result in ZoomText/UnZoomText rather than rounding it for better performance. r=roc

This commit is contained in:
Mats Palmgren 2015-11-21 04:41:00 +01:00
Родитель 0a25bbf702
Коммит 4e20c0f6c8
1 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -203,7 +203,7 @@ nsStyleFont::ZoomText(nsPresContext *aPresContext, nscoord aSize)
{
// aSize can be negative (e.g.: calc(-1px)) so we can't assert that here.
// The caller is expected deal with that.
return NSCoordSaturatingMultiply(aSize, aPresContext->TextZoom());
return NSToCoordTruncClamped(float(aSize) * aPresContext->TextZoom());
}
/* static */ nscoord
@ -211,7 +211,7 @@ nsStyleFont::UnZoomText(nsPresContext *aPresContext, nscoord aSize)
{
// aSize can be negative (e.g.: calc(-1px)) so we can't assert that here.
// The caller is expected deal with that.
return NSCoordSaturatingMultiply(aSize, 1.0 / aPresContext->TextZoom());
return NSToCoordTruncClamped(float(aSize) / aPresContext->TextZoom());
}
/* static */ already_AddRefed<nsIAtom>