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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 result.append(range.consume()); 101 result.append(range.consume());
102 } else { 102 } else {
103 resolveVariableTokensRecursive(range.consumeBlock(), result, context ); 103 resolveVariableTokensRecursive(range.consumeBlock(), result, context );
104 } 104 }
105 } 105 }
106 if (!context.success) 106 if (!context.success)
107 result.clear(); 107 result.clear();
108 return; 108 return;
109 } 109 }
110 110
111 PassRefPtrWillBeRawPtr<CSSValue> CSSVariableResolver::resolveVariableReferences( StyleVariableData* styleVariableData, CSSPropertyID id, const CSSVariableReferen ceValue& value) 111 RawPtr<CSSValue> CSSVariableResolver::resolveVariableReferences(StyleVariableDat a* styleVariableData, CSSPropertyID id, const CSSVariableReferenceValue& value)
112 { 112 {
113 ASSERT(!isShorthandProperty(id)); 113 ASSERT(!isShorthandProperty(id));
114 114
115 CSSVariableResolver resolver(styleVariableData); 115 CSSVariableResolver resolver(styleVariableData);
116 Vector<CSSParserToken> tokens; 116 Vector<CSSParserToken> tokens;
117 ResolutionState resolutionContext; 117 ResolutionState resolutionContext;
118 resolver.resolveVariableReferencesFromTokens(value.variableDataValue()->toke ns(), tokens, resolutionContext); 118 resolver.resolveVariableReferencesFromTokens(value.variableDataValue()->toke ns(), tokens, resolutionContext);
119 119
120 if (!resolutionContext.success) 120 if (!resolutionContext.success)
121 return cssValuePool().createUnsetValue(); 121 return cssValuePool().createUnsetValue();
122 122
123 CSSParserContext context(HTMLStandardMode, nullptr); 123 CSSParserContext context(HTMLStandardMode, nullptr);
124 WillBeHeapVector<CSSProperty, 256> parsedProperties; 124 HeapVector<CSSProperty, 256> parsedProperties;
125 // TODO(timloh): This should be CSSParser::parseSingleValue and not need a v ector. 125 // TODO(timloh): This should be CSSParser::parseSingleValue and not need a v ector.
126 if (!CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens), c ontext, parsedProperties, StyleRule::Type::Style)) 126 if (!CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens), c ontext, parsedProperties, StyleRule::Type::Style))
127 return cssValuePool().createUnsetValue(); 127 return cssValuePool().createUnsetValue();
128 ASSERT(parsedProperties.size() == 1); 128 ASSERT(parsedProperties.size() == 1);
129 return parsedProperties[0].value(); 129 return parsedProperties[0].value();
130 } 130 }
131 131
132 void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState& state, CSSPropertyID id, const CSSVariableReferenceValue& value) 132 void CSSVariableResolver::resolveAndApplyVariableReferences(StyleResolverState& state, CSSPropertyID id, const CSSVariableReferenceValue& value)
133 { 133 {
134 134
135 // TODO(leviw): This should be a stack 135 // TODO(leviw): This should be a stack
136 CSSVariableResolver resolver(state.style()->variables()); 136 CSSVariableResolver resolver(state.style()->variables());
137 137
138 Vector<CSSParserToken> tokens; 138 Vector<CSSParserToken> tokens;
139 ResolutionState resolutionContext; 139 ResolutionState resolutionContext;
140 resolver.resolveVariableReferencesFromTokens(value.variableDataValue()->toke ns(), tokens, resolutionContext); 140 resolver.resolveVariableReferencesFromTokens(value.variableDataValue()->toke ns(), tokens, resolutionContext);
141 141
142 if (resolutionContext.success) { 142 if (resolutionContext.success) {
143 CSSParserContext context(HTMLStandardMode, 0); 143 CSSParserContext context(HTMLStandardMode, 0);
144 144
145 WillBeHeapVector<CSSProperty, 256> parsedProperties; 145 HeapVector<CSSProperty, 256> parsedProperties;
146 146
147 if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens) , context, parsedProperties, StyleRule::Type::Style)) { 147 if (CSSPropertyParser::parseValue(id, false, CSSParserTokenRange(tokens) , context, parsedProperties, StyleRule::Type::Style)) {
148 unsigned parsedPropertiesCount = parsedProperties.size(); 148 unsigned parsedPropertiesCount = parsedProperties.size();
149 for (unsigned i = 0; i < parsedPropertiesCount; ++i) 149 for (unsigned i = 0; i < parsedPropertiesCount; ++i)
150 StyleBuilder::applyProperty(parsedProperties[i].id(), state, par sedProperties[i].value()); 150 StyleBuilder::applyProperty(parsedProperties[i].id(), state, par sedProperties[i].value());
151 return; 151 return;
152 } 152 }
153 } 153 }
154 154
155 RefPtrWillBeRawPtr<CSSUnsetValue> unset = cssValuePool().createUnsetValue(); 155 RawPtr<CSSUnsetValue> unset = cssValuePool().createUnsetValue();
156 if (isShorthandProperty(id)) { 156 if (isShorthandProperty(id)) {
157 StylePropertyShorthand shorthand = shorthandForProperty(id); 157 StylePropertyShorthand shorthand = shorthandForProperty(id);
158 for (unsigned i = 0; i < shorthand.length(); i++) 158 for (unsigned i = 0; i < shorthand.length(); i++)
159 StyleBuilder::applyProperty(shorthand.properties()[i], state, unset. get()); 159 StyleBuilder::applyProperty(shorthand.properties()[i], state, unset. get());
160 return; 160 return;
161 } 161 }
162 162
163 StyleBuilder::applyProperty(id, state, unset.get()); 163 StyleBuilder::applyProperty(id, state, unset.get());
164 } 164 }
165 165
(...skipping 20 matching lines...) Expand all
186 { 186 {
187 } 187 }
188 188
189 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData, A tomicString& variable) 189 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData, A tomicString& variable)
190 : m_styleVariableData(styleVariableData) 190 : m_styleVariableData(styleVariableData)
191 { 191 {
192 m_variablesSeen.add(variable); 192 m_variablesSeen.add(variable);
193 } 193 }
194 194
195 } // namespace blink 195 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698