Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp |
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp |
| index 19b0fb25922f37537ab040c552e34104e09ee99a..fb172c70ad37c3d640b11811ade8ee48adef6499 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp |
| @@ -365,8 +365,8 @@ static inline bool parseAlphaValue(const CharacterType*& string, |
| } |
| if (isTenthAlpha(string, length - 1)) { |
| - static const int tenthAlphaValues[] = {0, 25, 51, 76, 102, |
| - 127, 153, 179, 204, 230}; |
| + static const int tenthAlphaValues[] = {0, 26, 51, 77, 102, |
|
sashab
2017/01/02 23:04:15
What are these numbers? Maybe add a comment
ktyliu
2017/01/03 02:14:22
Done.
|
| + 128, 153, 179, 204, 230}; |
| value = negative ? 0 : tenthAlphaValues[string[length - 2] - '0']; |
| string = end; |
| return true; |
| @@ -375,9 +375,8 @@ static inline bool parseAlphaValue(const CharacterType*& string, |
| double alpha = 0; |
| if (!parseDouble(string, end, terminator, alpha)) |
| return false; |
| - value = negative |
| - ? 0 |
| - : static_cast<int>(std::min(alpha, 1.0) * nextafter(256.0, 0.0)); |
| + value = |
| + negative ? 0 : static_cast<int>(roundf(std::min(alpha, 1.0) * 255.0f)); |
| string = end; |
| return true; |
| } |