Commit fc10893a authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[cascade] Use StyleCascade::Exclude to skip animation properties

Instead of removing animation properties from the cascade, it's cheaper
to just skip them using the Exclude functionality.

BUG=947004

Change-Id: Ic42ca2ef396a61cd8e1828f5022717a189f8f02c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986796Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728495}
parent ef544317
...@@ -265,6 +265,7 @@ class CSSProperties(object): ...@@ -265,6 +265,7 @@ class CSSProperties(object):
set_if_none(property_, 'setter', 'Set' + method_name) set_if_none(property_, 'setter', 'Set' + method_name)
if property_['inherited']: if property_['inherited']:
property_['is_inherited_setter'] = 'Set' + method_name + 'IsInherited' property_['is_inherited_setter'] = 'Set' + method_name + 'IsInherited'
property_['is_animation_property'] = property_['priority'] == 'Animation'
# Figure out whether this property should have style builders at all. # Figure out whether this property should have style builders at all.
# E.g. shorthands do not get style builders. # E.g. shorthands do not get style builders.
......
...@@ -41,6 +41,7 @@ namespace {{namespace}} { ...@@ -41,6 +41,7 @@ namespace {{namespace}} {
(property.is_internal and 'kInternal' or ''), (property.is_internal and 'kInternal' or ''),
(property.affected_by_forced_colors and 'kIsAffectedByForcedColors' or ''), (property.affected_by_forced_colors and 'kIsAffectedByForcedColors' or ''),
(property.ua and 'kUA' or ''), (property.ua and 'kUA' or ''),
(property.is_animation_property and 'kAnimation' or ''),
] | reject('==', '') | join(' | ') %} ] | reject('==', '') | join(' | ') %}
{% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %} {% set ctor_args = (not is_alias and [property_id, flags, separator] or []) %}
// {{property.name}} // {{property.name}}
......
...@@ -115,6 +115,9 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty { ...@@ -115,6 +115,9 @@ class CORE_EXPORT CSSProperty : public CSSUnresolvedProperty {
// 'background-color' would have had without any user or author // 'background-color' would have had without any user or author
// declarations. // declarations.
kUA = 1 << 10, kUA = 1 << 10,
// Animation properties have this flag set. (I.e. longhands of the
// 'animation' and 'transition' shorthands).
kAnimation = 1 << 11,
}; };
constexpr CSSProperty(CSSPropertyID property_id, constexpr CSSProperty(CSSPropertyID property_id,
......
...@@ -175,16 +175,6 @@ void StyleCascade::Excluder::Clear() { ...@@ -175,16 +175,6 @@ void StyleCascade::Excluder::Clear() {
mask_ = 0; mask_ = 0;
} }
void StyleCascade::RemoveAnimationPriority() {
using AnimPrio = CSSPropertyPriorityData<kAnimationPropertyPriority>;
int first = static_cast<int>(AnimPrio::First());
int last = static_cast<int>(AnimPrio::Last());
for (int i = first; i <= last; ++i) {
CSSPropertyName name(convertToCSSPropertyID(i));
cascade_.erase(name);
}
}
const CSSValue* StyleCascade::Resolve(const CSSPropertyName& name, const CSSValue* StyleCascade::Resolve(const CSSPropertyName& name,
const CSSValue& value, const CSSValue& value,
Resolver& resolver) { Resolver& resolver) {
......
...@@ -241,13 +241,6 @@ class CORE_EXPORT StyleCascade { ...@@ -241,13 +241,6 @@ class CORE_EXPORT StyleCascade {
CSSProperty::Flags flags_ = 0; CSSProperty::Flags flags_ = 0;
}; };
// Removes all kAnimationPropertyPriority properties from the cascade,
// without applying the properties. This is used when pre-emptively copying
// the cascade in case there are animations.
//
// TODO(crbug.com/985010): Improve with non-destructive Apply.
void RemoveAnimationPriority();
// Resolver is an object passed on a stack during Apply. Its most important // Resolver is an object passed on a stack during Apply. Its most important
// job is to detect cycles during Apply (in general, keep track of which // job is to detect cycles during Apply (in general, keep track of which
// properties we're currently applying). // properties we're currently applying).
......
...@@ -2175,7 +2175,6 @@ void StyleResolver::CascadeAndApplyMatchedProperties( ...@@ -2175,7 +2175,6 @@ void StyleResolver::CascadeAndApplyMatchedProperties(
// //
// TODO(crbug.com/985010): Avoid this copy with non-destructive Apply. // TODO(crbug.com/985010): Avoid this copy with non-destructive Apply.
StyleCascade cascade_copy(cascade); StyleCascade cascade_copy(cascade);
cascade_copy.RemoveAnimationPriority();
if (!cache_success.IsFullCacheHit()) if (!cache_success.IsFullCacheHit())
cascade.Apply(); cascade.Apply();
...@@ -2189,6 +2188,7 @@ void StyleResolver::CascadeAndApplyMatchedProperties( ...@@ -2189,6 +2188,7 @@ void StyleResolver::CascadeAndApplyMatchedProperties(
CascadeAnimations(state, cascade_copy); CascadeAnimations(state, cascade_copy);
CascadeTransitions(state, cascade_copy); CascadeTransitions(state, cascade_copy);
StyleAnimator animator(state, cascade_copy); StyleAnimator animator(state, cascade_copy);
cascade_copy.Exclude(CSSProperty::kAnimation, true);
cascade_copy.Apply(animator); cascade_copy.Apply(animator);
} }
} }
......
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