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

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

Issue 2115923002: Improve numeric value handling in CSS Parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 5 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/CSSParserToken.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
index adfb87636dd8fbc54cdfef1075e35e65ce607219..968c1489cdac414fc0ce5e079559c6107d76e427 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
@@ -42,9 +42,9 @@ CSSParserToken::CSSParserToken(CSSParserTokenType type, double numericValue, Num
, m_numericValueType(numericValueType)
, m_numericSign(sign)
, m_unit(static_cast<unsigned>(CSSPrimitiveValue::UnitType::Number))
- , m_numericValue(numericValue)
{
ASSERT(type == NumberToken);
+ m_numericValue = clampTo<double>(numericValue, -std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
}
CSSParserToken::CSSParserToken(CSSParserTokenType type, UChar32 start, UChar32 end)
@@ -288,15 +288,4 @@ void CSSParserToken::serialize(StringBuilder& builder) const
}
}
-bool CSSParserToken::isValidNumericValue(double value)
-{
- return value >= -std::numeric_limits<float>::max()
- && value <= std::numeric_limits<float>::max();
-}
-
-bool CSSParserToken::isValidNumericValue() const
-{
- return isValidNumericValue(numericValue());
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698