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
parent 5c5459f2d8
commit fc73382e05

View File

@ -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>