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

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

Issue 2024373002: Replace CSSParserString with StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Match arguments to equalStringView. Created 4 years, 6 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 #include "core/css/parser/CSSTokenizerInputStream.h" 5 #include "core/css/parser/CSSTokenizerInputStream.h"
6 6
7 #include "core/css/parser/CSSParserString.h"
8 #include "core/html/parser/InputStreamPreprocessor.h" 7 #include "core/html/parser/InputStreamPreprocessor.h"
9 8
10 namespace blink { 9 namespace blink {
11 10
12 CSSTokenizerInputStream::CSSTokenizerInputStream(String input) 11 CSSTokenizerInputStream::CSSTokenizerInputStream(String input)
13 : m_offset(0) 12 : m_offset(0)
14 , m_stringLength(input.length()) 13 , m_stringLength(input.length())
15 , m_string(input.impl()) 14 , m_string(input.impl())
16 { 15 {
17 } 16 }
(...skipping 20 matching lines...) Expand all
38 if (start < end) { 37 if (start < end) {
39 if (m_string->is8Bit()) 38 if (m_string->is8Bit())
40 result = charactersToDouble(m_string->characters8() + m_offset + sta rt, end - start, &isResultOK); 39 result = charactersToDouble(m_string->characters8() + m_offset + sta rt, end - start, &isResultOK);
41 else 40 else
42 result = charactersToDouble(m_string->characters16() + m_offset + st art, end - start, &isResultOK); 41 result = charactersToDouble(m_string->characters16() + m_offset + st art, end - start, &isResultOK);
43 } 42 }
44 // FIXME: It looks like callers ensure we have a valid number 43 // FIXME: It looks like callers ensure we have a valid number
45 return isResultOK ? result : 0.0; 44 return isResultOK ? result : 0.0;
46 } 45 }
47 46
48 CSSParserString CSSTokenizerInputStream::rangeAsCSSParserString(unsigned start, unsigned length) const 47 StringView CSSTokenizerInputStream::rangeAt(unsigned start, unsigned length) con st
49 { 48 {
50 ASSERT(start + length <= m_stringLength); 49 ASSERT(start + length <= m_stringLength);
51 CSSParserString result; 50 return StringView(m_string.get(), start, length);
52 if (m_string->is8Bit())
53 result.init(m_string->characters8() + start, length);
54 else
55 result.init(m_string->characters16() + start, length);
56 return result;
57 } 51 }
58 52
59 } // namespace blink 53 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698