Commit 08eca2a4 authored by timloh@chromium.org's avatar timloh@chromium.org

Don't UseCounter CSS properties on recursive parseValue calls

Currently we count CSS properties in CSSPropertyParser::parseValue (the
non-static version). This function is used recursively for shorthands,
so we end up tracking many CSS properties which haven't been specified
by users.

This patch moves the check up a level, so that it is only called on
properties specified by a user. I've also made it only count properties
that succeeded at parsing (behaviour wouldn't change for declarations
that fail to parse if we removed the property).

This should reduce the usage numbers on chromestatus.com for many
properties. For example while border-spacing is not specced as a
shorthand, it is implemented as a shorthand and we end up measuring
-webkit-border-horizontal-spacing whenever we parse border-spacing.

Review URL: https://codereview.chromium.org/642583006

git-svn-id: svn://svn.chromium.org/blink/trunk@183636 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3c60e676
...@@ -122,7 +122,13 @@ bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important, ...@@ -122,7 +122,13 @@ bool CSSPropertyParser::parseValue(CSSPropertyID property, bool important,
WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Type ruleType) WillBeHeapVector<CSSProperty, 256>& parsedProperties, CSSRuleSourceData::Type ruleType)
{ {
CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, ruleType); CSSPropertyParser parser(valueList, context, inViewport, parsedProperties, ruleType);
return parser.parseValue(property, important); bool parseSuccess = parser.parseValue(property, important);
// This doesn't count UA style sheets
if (parseSuccess && context.useCounter())
context.useCounter()->count(context, property);
return parseSuccess;
} }
void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit) void CSSPropertyParser::addPropertyWithPrefixingVariant(CSSPropertyID propId, PassRefPtrWillBeRawPtr<CSSValue> value, bool important, bool implicit)
...@@ -428,10 +434,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important) ...@@ -428,10 +434,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId, bool important)
if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && isInternalProperty(propId)) if (!isInternalPropertyAndValueParsingEnabledForMode(m_context.mode()) && isInternalProperty(propId))
return false; return false;
// We don't count the UA style sheet in our statistics.
if (m_context.useCounter())
m_context.useCounter()->count(m_context, propId);
if (!m_valueList) if (!m_valueList)
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment