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

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

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, 5 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 #ifndef CSSTokenizerInputStream_h 5 #ifndef CSSTokenizerInputStream_h
6 #define CSSTokenizerInputStream_h 6 #define CSSTokenizerInputStream_h
7 7
8 #include "wtf/text/StringView.h" 8 #include "wtf/text/StringView.h"
9 #include "wtf/text/WTFString.h" 9 #include "wtf/text/WTFString.h"
10 10
(...skipping 26 matching lines...) Expand all
37 double getDouble(unsigned start, unsigned end); 37 double getDouble(unsigned start, unsigned end);
38 38
39 template<bool characterPredicate(UChar)> 39 template<bool characterPredicate(UChar)>
40 unsigned skipWhilePredicate(unsigned offset) 40 unsigned skipWhilePredicate(unsigned offset)
41 { 41 {
42 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset])) 42 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset]))
43 ++offset; 43 ++offset;
44 return offset; 44 return offset;
45 } 45 }
46 46
47 void advanceUntilNonWhitespace();
48
47 unsigned length() const { return m_stringLength; } 49 unsigned length() const { return m_stringLength; }
48 unsigned offset() const { return std::min(m_offset, m_stringLength); } 50 unsigned offset() const { return std::min(m_offset, m_stringLength); }
49 StringView rangeAt(unsigned start, unsigned length) const; 51 StringView rangeAt(unsigned start, unsigned length) const;
50 52
51 private: 53 private:
52 size_t m_offset; 54 size_t m_offset;
53 const size_t m_stringLength; 55 const size_t m_stringLength;
54 const RefPtr<StringImpl> m_string; 56 const RefPtr<StringImpl> m_string;
55 }; 57 };
56 58
57 } // namespace blink 59 } // namespace blink
58 60
59 #endif // CSSTokenizerInputStream_h 61 #endif // CSSTokenizerInputStream_h
60 62
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698