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

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

Issue 2831273002: Split active animation interpolation storage between standard and custom properties (Closed)
Patch Set: rebased Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 *element, state.AnimationUpdate(), *state.Style(), state.ParentStyle()); 1164 *element, state.AnimationUpdate(), *state.Style(), state.ParentStyle());
1165 1165
1166 if (state.AnimationUpdate().IsEmpty()) 1166 if (state.AnimationUpdate().IsEmpty())
1167 return false; 1167 return false;
1168 1168
1169 if (state.Style()->InsideLink() != EInsideLink::kNotInsideLink) { 1169 if (state.Style()->InsideLink() != EInsideLink::kNotInsideLink) {
1170 DCHECK(state.ApplyPropertyToRegularStyle()); 1170 DCHECK(state.ApplyPropertyToRegularStyle());
1171 state.SetApplyPropertyToVisitedLinkStyle(true); 1171 state.SetApplyPropertyToVisitedLinkStyle(true);
1172 } 1172 }
1173 1173
1174 const ActiveInterpolationsMap& active_interpolations_map_for_animations = 1174 const ActiveInterpolationsMap& active_interpolations_map_for_animations =
suzyh_UTC10 (ex-contributor) 2017/05/26 01:56:00 Add "standard" to variable name to match the trans
alancutter (OOO until 2018) 2017/05/26 03:09:15 Good call, done.
1175 state.AnimationUpdate().ActiveInterpolationsForAnimations(); 1175 state.AnimationUpdate().ActiveInterpolationsForStandardAnimations();
1176 const ActiveInterpolationsMap& 1176 const ActiveInterpolationsMap&
1177 active_interpolations_map_for_standard_transitions = 1177 active_interpolations_map_for_standard_transitions =
1178 state.AnimationUpdate().ActiveInterpolationsForStandardTransitions(); 1178 state.AnimationUpdate().ActiveInterpolationsForStandardTransitions();
1179 // TODO(crbug.com/644148): Apply animations on custom properties. 1179 // TODO(crbug.com/644148): Apply animations on custom properties.
1180 ApplyAnimatedProperties<kHighPropertyPriority>( 1180 ApplyAnimatedProperties<kHighPropertyPriority>(
1181 state, active_interpolations_map_for_animations); 1181 state, active_interpolations_map_for_animations);
1182 ApplyAnimatedProperties<kHighPropertyPriority>( 1182 ApplyAnimatedProperties<kHighPropertyPriority>(
1183 state, active_interpolations_map_for_standard_transitions); 1183 state, active_interpolations_map_for_standard_transitions);
1184 1184
1185 UpdateFont(state); 1185 UpdateFont(state);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 void StyleResolver::ApplyAnimatedProperties( 1223 void StyleResolver::ApplyAnimatedProperties(
1224 StyleResolverState& state, 1224 StyleResolverState& state,
1225 const ActiveInterpolationsMap& active_interpolations_map) { 1225 const ActiveInterpolationsMap& active_interpolations_map) {
1226 // TODO(alancutter): Don't apply presentation attribute animations here, 1226 // TODO(alancutter): Don't apply presentation attribute animations here,
1227 // they should instead apply in 1227 // they should instead apply in
1228 // SVGElement::CollectStyleForPresentationAttribute(). 1228 // SVGElement::CollectStyleForPresentationAttribute().
1229 for (const auto& entry : active_interpolations_map) { 1229 for (const auto& entry : active_interpolations_map) {
1230 CSSPropertyID property = entry.key.IsCSSProperty() 1230 CSSPropertyID property = entry.key.IsCSSProperty()
1231 ? entry.key.CssProperty() 1231 ? entry.key.CssProperty()
1232 : entry.key.PresentationAttribute(); 1232 : entry.key.PresentationAttribute();
1233 DCHECK_EQ(entry.key.IsCSSCustomProperty(), priority == kResolveVariables);
1233 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) 1234 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property))
1234 continue; 1235 continue;
1235 const Interpolation& interpolation = *entry.value.front(); 1236 const Interpolation& interpolation = *entry.value.front();
1236 if (interpolation.IsInvalidatableInterpolation()) { 1237 if (interpolation.IsInvalidatableInterpolation()) {
1237 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry()); 1238 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry());
1238 CSSInterpolationEnvironment environment(map, state); 1239 CSSInterpolationEnvironment environment(map, state);
1239 InvalidatableInterpolation::ApplyStack(entry.value, environment); 1240 InvalidatableInterpolation::ApplyStack(entry.value, environment);
1240 } else if (interpolation.IsTransitionInterpolation()) { 1241 } else if (interpolation.IsTransitionInterpolation()) {
1241 ToTransitionInterpolation(interpolation).Apply(state); 1242 ToTransitionInterpolation(interpolation).Apply(state);
1242 } else { 1243 } else {
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 // TODO(leviw): We need the proper bit for tracking whether we need to do 1746 // TODO(leviw): We need the proper bit for tracking whether we need to do
1746 // this work. 1747 // this work.
1747 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( 1748 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>(
1748 state, match_result.AuthorRules(), false, apply_inherited_only, 1749 state, match_result.AuthorRules(), false, apply_inherited_only,
1749 needs_apply_pass); 1750 needs_apply_pass);
1750 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( 1751 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>(
1751 state, match_result.AuthorRules(), true, apply_inherited_only, 1752 state, match_result.AuthorRules(), true, apply_inherited_only,
1752 needs_apply_pass); 1753 needs_apply_pass);
1753 if (apply_animations == kIncludeAnimations) { 1754 if (apply_animations == kIncludeAnimations) {
1754 ApplyAnimatedProperties<kResolveVariables>( 1755 ApplyAnimatedProperties<kResolveVariables>(
1755 state, state.AnimationUpdate().ActiveInterpolationsForAnimations()); 1756 state,
1757 state.AnimationUpdate().ActiveInterpolationsForCustomAnimations());
1756 ApplyAnimatedProperties<kResolveVariables>( 1758 ApplyAnimatedProperties<kResolveVariables>(
1757 state, 1759 state,
1758 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); 1760 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions());
1759 } 1761 }
1760 // TODO(leviw): stop recalculating every time 1762 // TODO(leviw): stop recalculating every time
1761 CSSVariableResolver::ResolveVariableDefinitions(state); 1763 CSSVariableResolver::ResolveVariableDefinitions(state);
1762 1764
1763 if (RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) { 1765 if (RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) {
1764 if (CacheCustomPropertiesForApplyAtRules(state, 1766 if (CacheCustomPropertiesForApplyAtRules(state,
1765 match_result.AuthorRules())) { 1767 match_result.AuthorRules())) {
1766 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( 1768 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>(
1767 state, match_result.AuthorRules(), false, apply_inherited_only, 1769 state, match_result.AuthorRules(), false, apply_inherited_only,
1768 needs_apply_pass); 1770 needs_apply_pass);
1769 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( 1771 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>(
1770 state, match_result.AuthorRules(), true, apply_inherited_only, 1772 state, match_result.AuthorRules(), true, apply_inherited_only,
1771 needs_apply_pass); 1773 needs_apply_pass);
1772 if (apply_animations == kIncludeAnimations) { 1774 if (apply_animations == kIncludeAnimations) {
1773 ApplyAnimatedProperties<kResolveVariables>( 1775 ApplyAnimatedProperties<kResolveVariables>(
1774 state, state.AnimationUpdate().ActiveInterpolationsForAnimations()); 1776 state,
1777 state.AnimationUpdate().ActiveInterpolationsForCustomAnimations());
1775 ApplyAnimatedProperties<kResolveVariables>( 1778 ApplyAnimatedProperties<kResolveVariables>(
1776 state, 1779 state,
1777 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); 1780 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions());
1778 } 1781 }
1779 CSSVariableResolver::ResolveVariableDefinitions(state); 1782 CSSVariableResolver::ResolveVariableDefinitions(state);
1780 } 1783 }
1781 } 1784 }
1782 } 1785 }
1783 1786
1784 void StyleResolver::ApplyMatchedAnimationProperties( 1787 void StyleResolver::ApplyMatchedAnimationProperties(
(...skipping 24 matching lines...) Expand all
1809 CSSAnimations::CalculateTransitionUpdate(state.AnimationUpdate(), 1812 CSSAnimations::CalculateTransitionUpdate(state.AnimationUpdate(),
1810 CSSAnimations::PropertyPass::kCustom, 1813 CSSAnimations::PropertyPass::kCustom,
1811 animating_element, *state.Style()); 1814 animating_element, *state.Style());
1812 1815
1813 state.SetIsAnimationInterpolationMapReady(); 1816 state.SetIsAnimationInterpolationMapReady();
1814 1817
1815 if (state.IsAnimatingCustomProperties()) { 1818 if (state.IsAnimatingCustomProperties()) {
1816 return; 1819 return;
1817 } 1820 }
1818 if (!state.AnimationUpdate() 1821 if (!state.AnimationUpdate()
1822 .ActiveInterpolationsForCustomAnimations()
1823 .IsEmpty() ||
1824 !state.AnimationUpdate()
1819 .ActiveInterpolationsForCustomTransitions() 1825 .ActiveInterpolationsForCustomTransitions()
1820 .IsEmpty()) { 1826 .IsEmpty()) {
1821 state.SetIsAnimatingCustomProperties(true); 1827 state.SetIsAnimatingCustomProperties(true);
1822 return;
1823 }
1824 for (const auto& property_handle :
1825 state.AnimationUpdate().ActiveInterpolationsForAnimations().Keys()) {
1826 if (CSSAnimations::IsCustomPropertyHandle(property_handle)) {
1827 state.SetIsAnimatingCustomProperties(true);
1828 return;
1829 }
1830 } 1828 }
1831 } 1829 }
1832 1830
1833 void StyleResolver::ApplyMatchedStandardProperties( 1831 void StyleResolver::ApplyMatchedStandardProperties(
1834 StyleResolverState& state, 1832 StyleResolverState& state,
1835 const MatchResult& match_result, 1833 const MatchResult& match_result,
1836 const CacheSuccess& cache_success, 1834 const CacheSuccess& cache_success,
1837 NeedsApplyPass& needs_apply_pass) { 1835 NeedsApplyPass& needs_apply_pass) {
1838 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), 1836 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(),
1839 matched_property_apply, 1); 1837 matched_property_apply, 1);
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2022 2020
2023 DEFINE_TRACE(StyleResolver) { 2021 DEFINE_TRACE(StyleResolver) {
2024 visitor->Trace(matched_properties_cache_); 2022 visitor->Trace(matched_properties_cache_);
2025 visitor->Trace(selector_filter_); 2023 visitor->Trace(selector_filter_);
2026 visitor->Trace(style_sharing_lists_); 2024 visitor->Trace(style_sharing_lists_);
2027 visitor->Trace(document_); 2025 visitor->Trace(document_);
2028 visitor->Trace(tracker_); 2026 visitor->Trace(tracker_);
2029 } 2027 }
2030 2028
2031 } // namespace blink 2029 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698