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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 642583006: Don't UseCounter CSS properties on recursive parseValue calls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 , m_currentShorthand(CSSPropertyInvalid) 115 , m_currentShorthand(CSSPropertyInvalid)
116 , m_implicitShorthand(false) 116 , m_implicitShorthand(false)
117 { 117 {
118 } 118 }
119 119
120 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, 120 bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important,
121 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort, 121 CSSParserValueList* valueList, const CSSParserContext& context, bool inViewp ort,
122 WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Typ e ruleType) 122 WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Typ e ruleType)
123 { 123 {
124 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType); 124 CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, r uleType);
125 return parser.parseValue(property, important); 125 bool parseSuccess = parser.parseValue(property, important);
126
127 // This doesn't count UA style sheets
128 if (parseSuccess && context.useCounter())
129 context.useCounter()->count(context, property);
130
131 return parseSuccess;
126 } 132 }
127 133
128 void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, Pa ssRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit) 134 void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, Pa ssRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit)
129 { 135 {
130 RefPtrWillBeRawPtr<CSSValue> val = value.get(); 136 RefPtrWillBeRawPtr<CSSValue> val = value.get();
131 addProperty(propId, value, important, implicit); 137 addProperty(propId, value, important, implicit);
132 138
133 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId); 139 CSSPropertyID prefixingVariant = prefixingVariantForPropertyId(propId);
134 if (prefixingVariant == propId) 140 if (prefixingVariant == propId)
135 return; 141 return;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 const CSSPropertyID* longhands = shorthand.properties(); 427 const CSSPropertyID* longhands = shorthand.properties();
422 for (unsigned i = 0; i < shorthandLength; ++i) 428 for (unsigned i = 0; i < shorthandLength; ++i)
423 addPropertyWithPrefixingVariant(longhands[i], value, important); 429 addPropertyWithPrefixingVariant(longhands[i], value, important);
424 } 430 }
425 431
426 bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) 432 bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
427 { 433 {
428 if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && is InternalProperty(propId)) 434 if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && is InternalProperty(propId))
429 return false; 435 return false;
430 436
431 // We don't count the UA style sheet in our statistics.
432 if (m_context.useCounter())
433 m_context.useCounter()->count(m_context, propId);
434
435 if (!m_valueList) 437 if (!m_valueList)
436 return false; 438 return false;
437 439
438 CSSParserValue* value = m_valueList->current(); 440 CSSParserValue* value = m_valueList->current();
439 441
440 if (!value) 442 if (!value)
441 return false; 443 return false;
442 444
443 if (inViewport()) { 445 if (inViewport()) {
444 // Allow @viewport rules from UA stylesheets even if the feature is disa bled. 446 // Allow @viewport rules from UA stylesheets even if the feature is disa bled.
(...skipping 7926 matching lines...) Expand 10 before | Expand all | Expand 10 after
8371 return nullptr; 8373 return nullptr;
8372 a = args->next(); 8374 a = args->next();
8373 8375
8374 argNumber++; 8376 argNumber++;
8375 } 8377 }
8376 8378
8377 return transformValue.release(); 8379 return transformValue.release();
8378 } 8380 }
8379 8381
8380 } // namespace blink 8382 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698