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

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

Issue 2162863002: Add StringView constructor that takes a ref to save a branch in CSSTokenizerInputStream::rangeAt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo. 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
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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