Index: third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
index c4c2011d5f00436317e2473f73d26fc4870847dd..b356ef92c62f51e7d8094b62005ac515544848ad 100644 |
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParserHelpers.cpp |
@@ -433,10 +433,9 @@ static bool parseRGBParameters(CSSParserTokenRange& range, |
double alpha; |
if (!consumeNumberRaw(args, alpha)) |
return false; |
- // Convert the floating pointer number of alpha to an integer in the range |
- // [0, 256), with an equal distribution across all 256 values. |
- int alphaComponent = static_cast<int>(clampTo<double>(alpha, 0.0, 1.0) * |
- nextafter(256.0, 0.0)); |
+ // W3 standard stipulates a 2.55 alpha value multiplication factor. |
+ int alphaComponent = |
+ static_cast<int>(lroundf(clampTo<double>(alpha, 0.0, 1.0) * 255.0f)); |
result = |
makeRGBA(colorArray[0], colorArray[1], colorArray[2], alphaComponent); |
} else { |