Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserToken.h b/third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| index e4a12c3f55b0906ee9b9bee5f79aa05702ce0357..41a9935e40aec438f795870c7701438664309059 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| @@ -82,6 +82,36 @@ public: |
| CSSParserToken(HashTokenType, CSSParserString); |
| + bool operator==(const CSSParserToken& other) const |
| + { |
| + if (m_type != other.m_type) |
| + return false; |
| + switch (m_type) { |
| + case DelimiterToken: |
| + return delimiter() == other.delimiter(); |
| + case IdentToken: |
| + case FunctionToken: |
| + case StringToken: |
| + case HashToken: |
| + if (m_hashTokenType != other.m_hashTokenType) |
|
Timothy Loh
2015/12/17 04:22:56
This is only really for HashTokens
shans
2015/12/17 05:14:14
my bad - I ordered the cases incorrectly.
|
| + return false; |
| + // fallthrough |
| + case UrlToken: |
| + return m_valueDataCharRaw == other.m_valueDataCharRaw && m_valueLength == other.m_valueLength && m_valueIs8Bit == other.m_valueIs8Bit; |
| + case NumberToken: |
| + if (m_numericSign != other.m_numericSign) |
| + return false; |
| + // fallthrough |
| + case DimensionToken: |
|
Timothy Loh
2015/12/17 04:22:56
These also have a dimension (i.e. string) attached
shans
2015/12/17 05:14:14
that isn't just the numericValueType? Fixed, at an
|
| + case PercentageToken: |
| + return 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; |
| + } |
| + } |
| + |
| // Converts NumberToken to DimensionToken. |
| void convertToDimensionWithUnit(CSSParserString); |