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

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: address comments. Created 4 years, 7 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..93dc74d1fd524d8679a618ded6c730ee9b4d45be 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)
+ return false;
+
+ if (m_valueIs8Bit) {
+ return other.m_valueIs8Bit ?
+ equal(static_cast<const LChar*>(m_valueDataCharRaw), static_cast<const LChar*>(other.m_valueDataCharRaw), m_valueLength) :
+ equal(static_cast<const LChar*>(m_valueDataCharRaw), static_cast<const UChar*>(other.m_valueDataCharRaw), m_valueLength);
+ } else {
+ return other.m_valueIs8Bit ?
+ equal(static_cast<const UChar*>(m_valueDataCharRaw), static_cast<const LChar*>(other.m_valueDataCharRaw), m_valueLength) :
+ equal(static_cast<const UChar*>(m_valueDataCharRaw), static_cast<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