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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h

Issue 2217853002: Merge all of the consumeNumber() logic and make a single call to getDouble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add back CSSParserFastPath. Created 4 years, 4 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/CSSTokenizerInputStream.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h
index ededc8b11f5a9f9d99b9438346d6aec18ecd2e86..18c9e80b6787e050a7fa556206c6319567ef267a 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h
@@ -50,8 +50,15 @@ public:
template<bool characterPredicate(UChar)>
unsigned skipWhilePredicate(unsigned offset)
{
- while ((m_offset + offset) < m_stringLength && characterPredicate((*m_string)[m_offset + offset]))
- ++offset;
+ if (m_string->is8Bit()) {
+ const LChar* characters8 = m_string->characters8();
+ while ((m_offset + offset) < m_stringLength && characterPredicate(characters8[m_offset + offset]))
+ ++offset;
+ } else {
+ const UChar* characters16 = m_string->characters16();
+ while ((m_offset + offset) < m_stringLength && characterPredicate(characters16[m_offset + offset]))
+ ++offset;
+ }
return offset;
}

Powered by Google App Engine
This is Rietveld 408576698