Round instead of truncating when converting a percentage color into aninteger. Bug 340613, r+sr=dbaron

This commit is contained in:
bzbarsky@mit.edu 2007-04-22 15:03:30 -07:00
parent 230cf21323
commit b952d0f1fb

View File

@ -3052,7 +3052,7 @@ PRBool CSSParserImpl::ParseColorComponent(nsresult& aErrorCode,
if (ExpectSymbol(aErrorCode, aStop, PR_TRUE)) {
if (value < 0.0f) value = 0.0f;
if (value > 255.0f) value = 255.0f;
aComponent = (PRUint8) value;
aComponent = NSToIntRound(value);
return PR_TRUE;
}
const PRUnichar stopString[] = { PRUnichar(aStop), PRUnichar(0) };