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

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

Issue 2099683003: Optimize whitespace skipping in the CSSParser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp
index dc8bf3b7edfb51df27b50deb97170be2edcd627d..e95cbd74aff3ea6b0cc7942ba724bf5c3450f017 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp
@@ -4,6 +4,7 @@
#include "core/css/parser/CSSTokenizerInputStream.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/html/parser/InputStreamPreprocessor.h"
#include "wtf/text/StringToNumber.h"
@@ -30,6 +31,20 @@ void CSSTokenizerInputStream::pushBack(UChar cc)
ASSERT(nextInputChar() == cc);
}
+void CSSTokenizerInputStream::advanceUntilNonWhitespace()
+{
+ // Using HTML space here rather than CSS space since we don't do preprocessing
+ if (m_string->is8Bit()) {
+ const LChar* characters = m_string->characters8();
+ while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset]))
+ ++m_offset;
+ } else {
+ const UChar* characters = m_string->characters16();
+ while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset]))
+ ++m_offset;
+ }
+}
+
double CSSTokenizerInputStream::getDouble(unsigned start, unsigned end)
{
ASSERT(start <= end && ((m_offset + end) <= m_stringLength));
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698