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

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

Issue 2107503002: Add missing const on CSSTokenizerInputStream methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 namespace blink { 11 namespace blink {
12 12
13 class CSSTokenizerInputStream { 13 class CSSTokenizerInputStream {
14 WTF_MAKE_NONCOPYABLE(CSSTokenizerInputStream); 14 WTF_MAKE_NONCOPYABLE(CSSTokenizerInputStream);
15 USING_FAST_MALLOC(CSSTokenizerInputStream); 15 USING_FAST_MALLOC(CSSTokenizerInputStream);
16 public: 16 public:
17 CSSTokenizerInputStream(String input); 17 explicit CSSTokenizerInputStream(String input);
18 18
19 UChar peek(unsigned); 19 UChar peek(unsigned) const;
20 inline UChar nextInputChar() 20 UChar nextInputChar() const { return peek(0); }
21 {
22 return peek(0);
23 }
24 21
25 // For fast-path code, don't replace nulls with replacement characters 22 // For fast-path code, don't replace nulls with replacement characters
26 UChar peekWithoutReplacement(unsigned lookaheadOffset) 23 UChar peekWithoutReplacement(unsigned lookaheadOffset) const
27 { 24 {
28 ASSERT((m_offset + lookaheadOffset) <= m_stringLength); 25 DCHECK((m_offset + lookaheadOffset) <= m_stringLength);
29 if ((m_offset + lookaheadOffset) == m_stringLength) 26 if ((m_offset + lookaheadOffset) == m_stringLength)
30 return '\0'; 27 return '\0';
31 return (*m_string)[m_offset + lookaheadOffset]; 28 return (*m_string)[m_offset + lookaheadOffset];
32 } 29 }
33 30
34 void advance(unsigned offset = 1) { m_offset += offset; } 31 void advance(unsigned offset = 1) { m_offset += offset; }
35 void pushBack(UChar); 32 void pushBack(UChar cc)
33 {
34 --m_offset;
35 DCHECK(nextInputChar() == cc);
36 }
36 37
37 double getDouble(unsigned start, unsigned end); 38 double getDouble(unsigned start, unsigned end) const;
38 39
39 template<bool characterPredicate(UChar)> 40 template<bool characterPredicate(UChar)>
40 unsigned skipWhilePredicate(unsigned offset) 41 unsigned skipWhilePredicate(unsigned offset)
41 { 42 {
42 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset])) 43 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset]))
43 ++offset; 44 ++offset;
44 return offset; 45 return offset;
45 } 46 }
46 47
47 void advanceUntilNonWhitespace(); 48 void advanceUntilNonWhitespace();
48 49
49 unsigned length() const { return m_stringLength; } 50 unsigned length() const { return m_stringLength; }
50 unsigned offset() const { return std::min(m_offset, m_stringLength); } 51 unsigned offset() const { return std::min(m_offset, m_stringLength); }
51 StringView rangeAt(unsigned start, unsigned length) const; 52 StringView rangeAt(unsigned start, unsigned length) const;
52 53
53 private: 54 private:
54 size_t m_offset; 55 size_t m_offset;
55 const size_t m_stringLength; 56 const size_t m_stringLength;
56 const RefPtr<StringImpl> m_string; 57 const RefPtr<StringImpl> m_string;
57 }; 58 };
58 59
59 } // namespace blink 60 } // namespace blink
60 61
61 #endif // CSSTokenizerInputStream_h 62 #endif // CSSTokenizerInputStream_h
62 63
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698