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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSParserToken.h" 5 #include "core/css/parser/CSSParserToken.h"
6 6
7 #include "core/css/CSSMarkup.h" 7 #include "core/css/CSSMarkup.h"
8 #include "core/css/parser/CSSPropertyParser.h" 8 #include "core/css/parser/CSSPropertyParser.h"
9 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
10 #include "wtf/text/StringBuilder.h" 10 #include "wtf/text/StringBuilder.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 || tokenType == StringToken; 140 || tokenType == StringToken;
141 } 141 }
142 142
143 CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars erString) const 143 CSSParserToken CSSParserToken::copyWithUpdatedString(const CSSParserString& pars erString) const
144 { 144 {
145 CSSParserToken copy(*this); 145 CSSParserToken copy(*this);
146 copy.initValueFromCSSParserString(parserString); 146 copy.initValueFromCSSParserString(parserString);
147 return copy; 147 return copy;
148 } 148 }
149 149
150 bool CSSParserToken::valueDataCharRawEqual(const CSSParserToken& other) const
151 {
152 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.
153 return false;
154
155 if (m_valueIs8Bit) {
156 return other.m_valueIs8Bit ?
157 equal((const LChar*) m_valueDataCharRaw, (const LChar*) other.m_valu eDataCharRaw, 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.
158 equal((const LChar*) m_valueDataCharRaw, (const UChar*) other.m_valu eDataCharRaw, m_valueLength);
159 } else {
160 return other.m_valueIs8Bit ?
161 equal((const UChar*) m_valueDataCharRaw, (const LChar*) other.m_valu eDataCharRaw, m_valueLength) :
162 equal((const UChar*) m_valueDataCharRaw, (const UChar*) other.m_valu eDataCharRaw, m_valueLength);
163 }
164 }
165
150 bool CSSParserToken::operator==(const CSSParserToken& other) const 166 bool CSSParserToken::operator==(const CSSParserToken& other) const
151 { 167 {
152 if (m_type != other.m_type) 168 if (m_type != other.m_type)
153 return false; 169 return false;
154 switch (m_type) { 170 switch (m_type) {
155 case DelimiterToken: 171 case DelimiterToken:
156 return delimiter() == other.delimiter(); 172 return delimiter() == other.delimiter();
157 case HashToken: 173 case HashToken:
158 if (m_hashTokenType != other.m_hashTokenType) 174 if (m_hashTokenType != other.m_hashTokenType)
159 return false; 175 return false;
160 // fallthrough 176 // fallthrough
161 case IdentToken: 177 case IdentToken:
162 case FunctionToken: 178 case FunctionToken:
163 case StringToken: 179 case StringToken:
164 case UrlToken: 180 case UrlToken:
165 return m_valueDataCharRaw == other.m_valueDataCharRaw && m_valueLength = = other.m_valueLength && m_valueIs8Bit == other.m_valueIs8Bit; 181 return valueDataCharRawEqual(other);
166 case DimensionToken: 182 case DimensionToken:
167 if (m_valueDataCharRaw != other.m_valueDataCharRaw || m_valueLength != o ther.m_valueLength || m_valueIs8Bit != other.m_valueIs8Bit) 183 if (!valueDataCharRawEqual(other))
168 return false; 184 return false;
169 // fallthrough 185 // fallthrough
170 case NumberToken: 186 case NumberToken:
171 case PercentageToken: 187 case PercentageToken:
172 return m_numericSign == other.m_numericSign && m_numericValue == other.m _numericValue && m_numericValueType == other.m_numericValueType; 188 return m_numericSign == other.m_numericSign && m_numericValue == other.m _numericValue && m_numericValueType == other.m_numericValueType;
173 case UnicodeRangeToken: 189 case UnicodeRangeToken:
174 return m_unicodeRange.start == other.m_unicodeRange.start && m_unicodeRa nge.end == other.m_unicodeRange.end; 190 return m_unicodeRange.start == other.m_unicodeRange.start && m_unicodeRa nge.end == other.m_unicodeRange.end;
175 default: 191 default:
176 return true; 192 return true;
177 } 193 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 return builder.append('}'); 280 return builder.append('}');
265 281
266 case EOFToken: 282 case EOFToken:
267 case CommentToken: 283 case CommentToken:
268 ASSERT_NOT_REACHED(); 284 ASSERT_NOT_REACHED();
269 return; 285 return;
270 } 286 }
271 } 287 }
272 288
273 } // namespace blink 289 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698