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

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

Issue 1896893004: Hook up style invalidation for CSS Paint API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@css-paint-register
Patch Set: Redo CSSParserToken::operator==() 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
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:

Powered by Google App Engine
This is Rietveld 408576698