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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSVariableParser.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/CSSVariableParser.h" 5 #include "core/css/parser/CSSVariableParser.h"
6 6
7 #include "core/css/CSSCustomPropertyDeclaration.h" 7 #include "core/css/CSSCustomPropertyDeclaration.h"
8 #include "core/css/parser/CSSParserTokenRange.h" 8 #include "core/css/parser/CSSParserTokenRange.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 bool CSSVariableParser::isValidVariableName(const CSSParserToken& token) 12 bool CSSVariableParser::isValidVariableName(const CSSParserToken& token)
13 { 13 {
14 if (token.type() != IdentToken) 14 if (token.type() != IdentToken)
15 return false; 15 return false;
16 16
17 CSSParserString value = token.value(); 17 StringView value = token.value();
18 return value.length() >= 2 && value[0] == '-' && value[1] == '-'; 18 return value.length() >= 2 && value[0] == '-' && value[1] == '-';
19 } 19 }
20 20
21 bool CSSVariableParser::isValidVariableName(const String& string) 21 bool CSSVariableParser::isValidVariableName(const String& string)
22 { 22 {
23 return string.length() >= 2 && string[0] == '-' && string[1] == '-'; 23 return string.length() >= 2 && string[0] == '-' && string[1] == '-';
24 } 24 }
25 25
26 bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule); 26 bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule);
27 27
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule ); 131 CSSValueID type = classifyVariableRange(range, hasReferences, hasAtApplyRule );
132 132
133 if (type == CSSValueInvalid) 133 if (type == CSSValueInvalid)
134 return nullptr; 134 return nullptr;
135 if (type == CSSValueInternalVariableValue) 135 if (type == CSSValueInternalVariableValue)
136 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat a::create(range, hasReferences || hasAtApplyRule)); 136 return CSSCustomPropertyDeclaration::create(variableName, CSSVariableDat a::create(range, hasReferences || hasAtApplyRule));
137 return CSSCustomPropertyDeclaration::create(variableName, type); 137 return CSSCustomPropertyDeclaration::create(variableName, type);
138 } 138 }
139 139
140 } // namespace blink 140 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698