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..88d00dc7f257ee8f4b7a751997331e4774366a46 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.h |
| @@ -82,6 +82,39 @@ 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 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; |
|
dstockwell
2015/12/17 09:45:16
We should probably compare the contents too, I ass
|
| + case NumberToken: |
| + if (m_numericSign != other.m_numericSign) |
| + return false; |
| + // fallthrough |
| + case DimensionToken: |
| + if (m_valueDataCharRaw != other.m_valueDataCharRaw || m_valueLength != other.m_valueLength || m_valueIs8Bit != other.m_valueIs8Bit) |
| + return false; |
| + // fallthrough |
| + 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); |