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

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

Issue 2707113003: Add "customPropertiesApplied" metric to StyleResolverStats. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "core/css/CSSPendingSubstitutionValue.h" 11 #include "core/css/CSSPendingSubstitutionValue.h"
12 #include "core/css/CSSUnsetValue.h" 12 #include "core/css/CSSUnsetValue.h"
13 #include "core/css/CSSVariableData.h" 13 #include "core/css/CSSVariableData.h"
14 #include "core/css/CSSVariableReferenceValue.h" 14 #include "core/css/CSSVariableReferenceValue.h"
15 #include "core/css/PropertyRegistry.h" 15 #include "core/css/PropertyRegistry.h"
16 #include "core/css/parser/CSSParserToken.h" 16 #include "core/css/parser/CSSParserToken.h"
17 #include "core/css/parser/CSSParserTokenRange.h" 17 #include "core/css/parser/CSSParserTokenRange.h"
18 #include "core/css/parser/CSSPropertyParser.h" 18 #include "core/css/parser/CSSPropertyParser.h"
19 #include "core/css/resolver/StyleBuilder.h" 19 #include "core/css/resolver/StyleBuilder.h"
20 #include "core/css/resolver/StyleBuilderConverter.h" 20 #include "core/css/resolver/StyleBuilderConverter.h"
21 #include "core/css/resolver/StyleResolverState.h" 21 #include "core/css/resolver/StyleResolverState.h"
22 #include "core/css/resolver/StyleResolverStats.h"
23 #include "core/dom/StyleEngine.h"
22 #include "core/style/StyleInheritedVariables.h" 24 #include "core/style/StyleInheritedVariables.h"
23 #include "core/style/StyleNonInheritedVariables.h" 25 #include "core/style/StyleNonInheritedVariables.h"
24 #include "wtf/Vector.h" 26 #include "wtf/Vector.h"
25 27
26 namespace blink { 28 namespace blink {
27 29
28 bool CSSVariableResolver::resolveFallback(CSSParserTokenRange range, 30 bool CSSVariableResolver::resolveFallback(CSSParserTokenRange range,
29 bool disallowAnimationTainted, 31 bool disallowAnimationTainted,
30 Vector<CSSParserToken>& result, 32 Vector<CSSParserToken>& result,
31 bool& resultIsAnimationTainted) { 33 bool& resultIsAnimationTainted) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 void CSSVariableResolver::resolveVariableDefinitions( 284 void CSSVariableResolver::resolveVariableDefinitions(
283 const StyleResolverState& state) { 285 const StyleResolverState& state) {
284 StyleInheritedVariables* inheritedVariables = 286 StyleInheritedVariables* inheritedVariables =
285 state.style()->inheritedVariables(); 287 state.style()->inheritedVariables();
286 StyleNonInheritedVariables* nonInheritedVariables = 288 StyleNonInheritedVariables* nonInheritedVariables =
287 state.style()->nonInheritedVariables(); 289 state.style()->nonInheritedVariables();
288 if (!inheritedVariables && !nonInheritedVariables) 290 if (!inheritedVariables && !nonInheritedVariables)
289 return; 291 return;
290 292
291 CSSVariableResolver resolver(state); 293 CSSVariableResolver resolver(state);
294 int variableCount = 0;
292 if (inheritedVariables) { 295 if (inheritedVariables) {
293 for (auto& variable : inheritedVariables->m_data) 296 for (auto& variable : inheritedVariables->m_data)
294 resolver.valueForCustomProperty(variable.key); 297 resolver.valueForCustomProperty(variable.key);
298 variableCount += inheritedVariables->m_data.size();
295 } 299 }
296 if (nonInheritedVariables) { 300 if (nonInheritedVariables) {
297 for (auto& variable : nonInheritedVariables->m_data) 301 for (auto& variable : nonInheritedVariables->m_data)
298 resolver.valueForCustomProperty(variable.key); 302 resolver.valueForCustomProperty(variable.key);
303 variableCount += nonInheritedVariables->m_data.size();
299 } 304 }
305 INCREMENT_STYLE_STATS_COUNTER(state.document().styleEngine(),
306 customPropertiesApplied, variableCount);
300 } 307 }
301 308
302 void CSSVariableResolver::computeRegisteredVariables( 309 void CSSVariableResolver::computeRegisteredVariables(
303 const StyleResolverState& state) { 310 const StyleResolverState& state) {
304 // const_cast is needed because Persistent<const ...> doesn't work properly. 311 // const_cast is needed because Persistent<const ...> doesn't work properly.
305 312
306 StyleInheritedVariables* inheritedVariables = 313 StyleInheritedVariables* inheritedVariables =
307 state.style()->inheritedVariables(); 314 state.style()->inheritedVariables();
308 if (inheritedVariables) { 315 if (inheritedVariables) {
309 for (auto& variable : inheritedVariables->m_registeredData) { 316 for (auto& variable : inheritedVariables->m_registeredData) {
(...skipping 17 matching lines...) Expand all
327 } 334 }
328 } 335 }
329 } 336 }
330 337
331 CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state) 338 CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state)
332 : m_inheritedVariables(state.style()->inheritedVariables()), 339 : m_inheritedVariables(state.style()->inheritedVariables()),
333 m_nonInheritedVariables(state.style()->nonInheritedVariables()), 340 m_nonInheritedVariables(state.style()->nonInheritedVariables()),
334 m_registry(state.document().propertyRegistry()) {} 341 m_registry(state.document().propertyRegistry()) {}
335 342
336 } // namespace blink 343 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/resolver/StyleResolverStats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698