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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.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/resolver/CSSVariableResolver.h" 5 #include "core/css/resolver/CSSVariableResolver.h"
6 6
7 #include "core/CSSPropertyNames.h" 7 #include "core/CSSPropertyNames.h"
8 #include "core/CSSValueKeywords.h" 8 #include "core/CSSValueKeywords.h"
9 #include "core/StyleBuilderFunctions.h" 9 #include "core/StyleBuilderFunctions.h"
10 #include "core/StylePropertyShorthand.h" 10 #include "core/StylePropertyShorthand.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 m_cycleStartPoints.remove(name); 66 m_cycleStartPoints.remove(name);
67 return nullptr; 67 return nullptr;
68 } 68 }
69 return CSSVariableData::createResolved(tokens, variableData); 69 return CSSVariableData::createResolved(tokens, variableData);
70 } 70 }
71 71
72 bool CSSVariableResolver::resolveVariableReference(CSSParserTokenRange range, Ve ctor<CSSParserToken>& result) 72 bool CSSVariableResolver::resolveVariableReference(CSSParserTokenRange range, Ve ctor<CSSParserToken>& result)
73 { 73 {
74 range.consumeWhitespace(); 74 range.consumeWhitespace();
75 ASSERT(range.peek().type() == IdentToken); 75 ASSERT(range.peek().type() == IdentToken);
76 AtomicString variableName = range.consumeIncludingWhitespace().value(); 76 AtomicString variableName = AtomicString(range.consumeIncludingWhitespace(). value().toString());
77 ASSERT(range.atEnd() || (range.peek().type() == CommaToken)); 77 ASSERT(range.atEnd() || (range.peek().type() == CommaToken));
78 78
79 CSSVariableData* variableData = valueForCustomProperty(variableName); 79 CSSVariableData* variableData = valueForCustomProperty(variableName);
80 if (!variableData) 80 if (!variableData)
81 return resolveFallback(range, result); 81 return resolveFallback(range, result);
82 82
83 result.appendVector(variableData->tokens()); 83 result.appendVector(variableData->tokens());
84 Vector<CSSParserToken> trash; 84 Vector<CSSParserToken> trash;
85 resolveFallback(range, trash); 85 resolveFallback(range, trash);
86 return true; 86 return true;
87 } 87 }
88 88
89 void CSSVariableResolver::resolveApplyAtRule(CSSParserTokenRange& range, 89 void CSSVariableResolver::resolveApplyAtRule(CSSParserTokenRange& range,
90 Vector<CSSParserToken>& result) 90 Vector<CSSParserToken>& result)
91 { 91 {
92 ASSERT(range.peek().type() == AtKeywordToken && range.peek().valueEqualsIgno ringASCIICase("apply")); 92 ASSERT(range.peek().type() == AtKeywordToken && range.peek().valueEqualsIgno ringASCIICase("apply"));
93 range.consumeIncludingWhitespace(); 93 range.consumeIncludingWhitespace();
94 const CSSParserToken& variableName = range.consumeIncludingWhitespace(); 94 const CSSParserToken& variableName = range.consumeIncludingWhitespace();
95 // TODO(timloh): Should we actually be consuming this? 95 // TODO(timloh): Should we actually be consuming this?
96 if (range.peek().type() == SemicolonToken) 96 if (range.peek().type() == SemicolonToken)
97 range.consume(); 97 range.consume();
98 98
99 CSSVariableData* variableData = valueForCustomProperty(variableName.value()) ; 99 CSSVariableData* variableData = valueForCustomProperty(AtomicString(variable Name.value().toString()));
100 if (!variableData) 100 if (!variableData)
101 return; // Invalid custom property 101 return; // Invalid custom property
102 102
103 CSSParserTokenRange rule = variableData->tokenRange(); 103 CSSParserTokenRange rule = variableData->tokenRange();
104 rule.consumeWhitespace(); 104 rule.consumeWhitespace();
105 if (rule.peek().type() != LeftBraceToken) 105 if (rule.peek().type() != LeftBraceToken)
106 return; 106 return;
107 CSSParserTokenRange ruleContents = rule.consumeBlock(); 107 CSSParserTokenRange ruleContents = rule.consumeBlock();
108 rule.consumeWhitespace(); 108 rule.consumeWhitespace();
109 if (!rule.atEnd()) 109 if (!rule.atEnd())
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 variable.value = resolver.resolveCustomProperty(variable.key, *varia ble.value); 184 variable.value = resolver.resolveCustomProperty(variable.key, *varia ble.value);
185 } 185 }
186 } 186 }
187 187
188 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData) 188 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData)
189 : m_styleVariableData(styleVariableData) 189 : m_styleVariableData(styleVariableData)
190 { 190 {
191 } 191 }
192 192
193 } // namespace blink 193 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/MediaQueryParser.cpp ('k') | third_party/WebKit/Source/wtf/text/StringView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698