Chromium Code Reviews| 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 864a5ea1bea4505e7f64ae0c864ddfd265169f13..8683035452b47b96119bb531f0210c388f9f5159 100644 |
| --- a/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp |
| +++ b/third_party/WebKit/Source/core/css/parser/CSSParserToken.cpp |
| @@ -147,6 +147,22 @@ CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars |
| return copy; |
| } |
| +bool CSSParserToken::valueDataCharRawEqual(const CSSParserToken& other) const |
| +{ |
| + if (m_valueLength != other.m_valueLength) |
|
Timothy Loh
2016/05/09 07:07:07
I don't think this change should be part of this p
ikilpatrick
2016/05/10 20:39:37
I think that case is pretty important, at least at
Timothy Loh
2016/05/11 06:20:37
I don't get why this case is important, but regard
ikilpatrick
2016/05/11 23:59:12
Done.
|
| + return false; |
| + |
| + if (m_valueIs8Bit) { |
| + return other.m_valueIs8Bit ? |
| + equal((const LChar*) m_valueDataCharRaw, (const LChar*) other.m_valueDataCharRaw, m_valueLength) : |
|
esprehn
2016/05/09 21:59:54
static_cast, don't do C style casts in blink.
ikilpatrick
2016/05/10 20:39:37
Done.
|
| + equal((const LChar*) m_valueDataCharRaw, (const UChar*) other.m_valueDataCharRaw, m_valueLength); |
| + } else { |
| + return other.m_valueIs8Bit ? |
| + equal((const UChar*) m_valueDataCharRaw, (const LChar*) other.m_valueDataCharRaw, m_valueLength) : |
| + equal((const UChar*) m_valueDataCharRaw, (const UChar*) other.m_valueDataCharRaw, m_valueLength); |
| + } |
| +} |
| + |
| bool CSSParserToken::operator==(const CSSParserToken& other) const |
| { |
| if (m_type != other.m_type) |
| @@ -162,9 +178,9 @@ bool CSSParserToken::operator==(const CSSParserToken& other) const |
| case FunctionToken: |
| case StringToken: |
| case UrlToken: |
| - return m_valueDataCharRaw == other.m_valueDataCharRaw && m_valueLength == other.m_valueLength && m_valueIs8Bit == other.m_valueIs8Bit; |
| + return valueDataCharRawEqual(other); |
| case DimensionToken: |
| - if (m_valueDataCharRaw != other.m_valueDataCharRaw || m_valueLength != other.m_valueLength || m_valueIs8Bit != other.m_valueIs8Bit) |
| + if (!valueDataCharRawEqual(other)) |
| return false; |
| // fallthrough |
| case NumberToken: |