Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp

Issue 2629163002: Revert of Fix RGBA alpha parsing and serialization to adhere to W3 standard. (Closed)
Patch Set: fix conflicts Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2f16c13ce3e34bbc54c3032eea2e6ac092b8ce5b..d7c12f45623c69da6b9864b56872447cad781635 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -369,10 +369,8 @@ static inline bool parseAlphaValue(const CharacterType*& string,
}
if (isTenthAlpha(string, length - 1)) {
- // Fast conversions for 0.1 steps of alpha values between 0.0 and 0.9,
- // where 0.1 alpha is value 26 (25.5 rounded) and so on.
- static const int tenthAlphaValues[] = {0, 26, 51, 77, 102,
- 128, 153, 179, 204, 230};
+ static const int tenthAlphaValues[] = {0, 25, 51, 76, 102,
+ 127, 153, 179, 204, 230};
value = negative ? 0 : tenthAlphaValues[string[length - 2] - '0'];
string = end;
return true;
@@ -381,8 +379,9 @@ static inline bool parseAlphaValue(const CharacterType*& string,
double alpha = 0;
if (!parseDouble(string, end, terminator, alpha))
return false;
- value =
- negative ? 0 : static_cast<int>(roundf(std::min(alpha, 1.0) * 255.0f));
+ value = negative
+ ? 0
+ : static_cast<int>(std::min(alpha, 1.0) * nextafter(256.0, 0.0));
string = end;
return true;
}

Powered by Google App Engine
This is Rietveld 408576698