| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 { | 42 { |
| 43 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])) |
| 44 ++offset; | 44 ++offset; |
| 45 return offset; | 45 return offset; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void advanceUntilNonWhitespace(); | 48 void advanceUntilNonWhitespace(); |
| 49 | 49 |
| 50 unsigned length() const { return m_stringLength; } | 50 unsigned length() const { return m_stringLength; } |
| 51 unsigned offset() const { return std::min(m_offset, m_stringLength); } | 51 unsigned offset() const { return std::min(m_offset, m_stringLength); } |
| 52 StringView rangeAt(unsigned start, unsigned length) const; | 52 |
| 53 StringView rangeAt(unsigned start, unsigned length) const |
| 54 { |
| 55 DCHECK(start + length <= m_stringLength); |
| 56 return StringView(*m_string, start, length); |
| 57 } |
| 53 | 58 |
| 54 private: | 59 private: |
| 55 size_t m_offset; | 60 size_t m_offset; |
| 56 const size_t m_stringLength; | 61 const size_t m_stringLength; |
| 57 const RefPtr<StringImpl> m_string; | 62 const RefPtr<StringImpl> m_string; |
| 58 }; | 63 }; |
| 59 | 64 |
| 60 } // namespace blink | 65 } // namespace blink |
| 61 | 66 |
| 62 #endif // CSSTokenizerInputStream_h | 67 #endif // CSSTokenizerInputStream_h |
| 63 | 68 |
| OLD | NEW |