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

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

Issue 2160943002: Use CSSTokenizerInputStream::peekWithoutReplacement instead of peek(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checks. 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 | « third_party/WebKit/Source/core/css/parser/CSSTokenizerInputStream.h ('k') | no next file » | 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 #include "core/css/parser/CSSTokenizerInputStream.h" 5 #include "core/css/parser/CSSTokenizerInputStream.h"
6 6
7 #include "core/html/parser/HTMLParserIdioms.h" 7 #include "core/html/parser/HTMLParserIdioms.h"
8 #include "core/html/parser/InputStreamPreprocessor.h"
9 #include "wtf/text/StringToNumber.h" 8 #include "wtf/text/StringToNumber.h"
10 9
11 namespace blink { 10 namespace blink {
12 11
13 CSSTokenizerInputStream::CSSTokenizerInputStream(String input) 12 CSSTokenizerInputStream::CSSTokenizerInputStream(String input)
14 : m_offset(0) 13 : m_offset(0)
15 , m_stringLength(input.length()) 14 , m_stringLength(input.length())
16 , m_string(input.impl()) 15 , m_string(input.impl())
17 { 16 {
18 } 17 }
19 18
20 UChar CSSTokenizerInputStream::peek(unsigned lookaheadOffset) const
21 {
22 if ((m_offset + lookaheadOffset) >= m_stringLength)
23 return kEndOfFileMarker;
24 UChar result = (*m_string)[m_offset + lookaheadOffset];
25 return result ? result : 0xFFFD;
26 }
27
28 void CSSTokenizerInputStream::advanceUntilNonWhitespace() 19 void CSSTokenizerInputStream::advanceUntilNonWhitespace()
29 { 20 {
30 // Using HTML space here rather than CSS space since we don't do preprocessi ng 21 // Using HTML space here rather than CSS space since we don't do preprocessi ng
31 if (m_string->is8Bit()) { 22 if (m_string->is8Bit()) {
32 const LChar* characters = m_string->characters8(); 23 const LChar* characters = m_string->characters8();
33 while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset])) 24 while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset]))
34 ++m_offset; 25 ++m_offset;
35 } else { 26 } else {
36 const UChar* characters = m_string->characters16(); 27 const UChar* characters = m_string->characters16();
37 while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset])) 28 while (m_offset < m_stringLength && isHTMLSpace(characters[m_offset]))
(...skipping 16 matching lines...) Expand all
54 return isResultOK ? result : 0.0; 45 return isResultOK ? result : 0.0;
55 } 46 }
56 47
57 StringView CSSTokenizerInputStream::rangeAt(unsigned start, unsigned length) con st 48 StringView CSSTokenizerInputStream::rangeAt(unsigned start, unsigned length) con st
58 { 49 {
59 DCHECK(start + length <= m_stringLength); 50 DCHECK(start + length <= m_stringLength);
60 return StringView(m_string.get(), start, length); 51 return StringView(m_string.get(), start, length);
61 } 52 }
62 53
63 } // namespace blink 54 } // namespace blink
OLDNEW
« 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