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

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

Issue 1905163003: Fix CSSParserToken::operator== for NumberTokens (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserToken.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51014658dd27281ffba820e298957ff4838f9008..864a5ea1bea4505e7f64ae0c864ddfd265169f13 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp
@@ -147,6 +147,36 @@ CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars
return copy;
}
+bool CSSParserToken::operator==(const CSSParserToken& other) const
+{
+ if (m_type != other.m_type)
+ return false;
+ switch (m_type) {
+ case DelimiterToken:
+ return delimiter() == other.delimiter();
+ case HashToken:
+ if (m_hashTokenType != other.m_hashTokenType)
+ return false;
+ // fallthrough
+ case IdentToken:
+ case FunctionToken:
+ case StringToken:
+ case UrlToken:
+ return m_valueDataCharRaw == other.m_valueDataCharRaw && m_valueLength == other.m_valueLength && m_valueIs8Bit == other.m_valueIs8Bit;
+ case DimensionToken:
+ if (m_valueDataCharRaw != other.m_valueDataCharRaw || m_valueLength != other.m_valueLength || m_valueIs8Bit != other.m_valueIs8Bit)
+ return false;
+ // fallthrough
+ case NumberToken:
+ case PercentageToken:
+ return m_numericSign == other.m_numericSign && m_numericValue == other.m_numericValue && m_numericValueType == other.m_numericValueType;
+ case UnicodeRangeToken:
+ return m_unicodeRange.start == other.m_unicodeRange.start && m_unicodeRange.end == other.m_unicodeRange.end;
+ default:
+ return true;
+ }
+}
+
void CSSParserToken::serialize(StringBuilder& builder) const
{
// This is currently only used for @supports CSSOM. To keep our implementation
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSParserToken.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698