OLD | NEW |
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 Loading... |
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& |
1175 state.AnimationUpdate().ActiveInterpolationsForAnimations(); | 1175 active_interpolations_map_for_standard_animations = |
| 1176 state.AnimationUpdate().ActiveInterpolationsForStandardAnimations(); |
1176 const ActiveInterpolationsMap& | 1177 const ActiveInterpolationsMap& |
1177 active_interpolations_map_for_standard_transitions = | 1178 active_interpolations_map_for_standard_transitions = |
1178 state.AnimationUpdate().ActiveInterpolationsForStandardTransitions(); | 1179 state.AnimationUpdate().ActiveInterpolationsForStandardTransitions(); |
1179 // TODO(crbug.com/644148): Apply animations on custom properties. | 1180 // TODO(crbug.com/644148): Apply animations on custom properties. |
1180 ApplyAnimatedProperties<kHighPropertyPriority>( | 1181 ApplyAnimatedProperties<kHighPropertyPriority>( |
1181 state, active_interpolations_map_for_animations); | 1182 state, active_interpolations_map_for_standard_animations); |
1182 ApplyAnimatedProperties<kHighPropertyPriority>( | 1183 ApplyAnimatedProperties<kHighPropertyPriority>( |
1183 state, active_interpolations_map_for_standard_transitions); | 1184 state, active_interpolations_map_for_standard_transitions); |
1184 | 1185 |
1185 UpdateFont(state); | 1186 UpdateFont(state); |
1186 | 1187 |
1187 ApplyAnimatedProperties<kLowPropertyPriority>( | 1188 ApplyAnimatedProperties<kLowPropertyPriority>( |
1188 state, active_interpolations_map_for_animations); | 1189 state, active_interpolations_map_for_standard_animations); |
1189 ApplyAnimatedProperties<kLowPropertyPriority>( | 1190 ApplyAnimatedProperties<kLowPropertyPriority>( |
1190 state, active_interpolations_map_for_standard_transitions); | 1191 state, active_interpolations_map_for_standard_transitions); |
1191 | 1192 |
1192 // Start loading resources used by animations. | 1193 // Start loading resources used by animations. |
1193 LoadPendingResources(state); | 1194 LoadPendingResources(state); |
1194 | 1195 |
1195 DCHECK(!state.GetFontBuilder().FontDirty()); | 1196 DCHECK(!state.GetFontBuilder().FontDirty()); |
1196 | 1197 |
1197 state.SetApplyPropertyToVisitedLinkStyle(false); | 1198 state.SetApplyPropertyToVisitedLinkStyle(false); |
1198 | 1199 |
(...skipping 24 matching lines...) Expand all Loading... |
1223 void StyleResolver::ApplyAnimatedProperties( | 1224 void StyleResolver::ApplyAnimatedProperties( |
1224 StyleResolverState& state, | 1225 StyleResolverState& state, |
1225 const ActiveInterpolationsMap& active_interpolations_map) { | 1226 const ActiveInterpolationsMap& active_interpolations_map) { |
1226 // TODO(alancutter): Don't apply presentation attribute animations here, | 1227 // TODO(alancutter): Don't apply presentation attribute animations here, |
1227 // they should instead apply in | 1228 // they should instead apply in |
1228 // SVGElement::CollectStyleForPresentationAttribute(). | 1229 // SVGElement::CollectStyleForPresentationAttribute(). |
1229 for (const auto& entry : active_interpolations_map) { | 1230 for (const auto& entry : active_interpolations_map) { |
1230 CSSPropertyID property = entry.key.IsCSSProperty() | 1231 CSSPropertyID property = entry.key.IsCSSProperty() |
1231 ? entry.key.CssProperty() | 1232 ? entry.key.CssProperty() |
1232 : entry.key.PresentationAttribute(); | 1233 : entry.key.PresentationAttribute(); |
| 1234 DCHECK_EQ(entry.key.IsCSSCustomProperty(), priority == kResolveVariables); |
1233 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) | 1235 if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) |
1234 continue; | 1236 continue; |
1235 const Interpolation& interpolation = *entry.value.front(); | 1237 const Interpolation& interpolation = *entry.value.front(); |
1236 if (interpolation.IsInvalidatableInterpolation()) { | 1238 if (interpolation.IsInvalidatableInterpolation()) { |
1237 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry()); | 1239 CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry()); |
1238 CSSInterpolationEnvironment environment(map, state); | 1240 CSSInterpolationEnvironment environment(map, state); |
1239 InvalidatableInterpolation::ApplyStack(entry.value, environment); | 1241 InvalidatableInterpolation::ApplyStack(entry.value, environment); |
1240 } else if (interpolation.IsTransitionInterpolation()) { | 1242 } else if (interpolation.IsTransitionInterpolation()) { |
1241 ToTransitionInterpolation(interpolation).Apply(state); | 1243 ToTransitionInterpolation(interpolation).Apply(state); |
1242 } else { | 1244 } else { |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1745 // TODO(leviw): We need the proper bit for tracking whether we need to do | 1747 // TODO(leviw): We need the proper bit for tracking whether we need to do |
1746 // this work. | 1748 // this work. |
1747 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( | 1749 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( |
1748 state, match_result.AuthorRules(), false, apply_inherited_only, | 1750 state, match_result.AuthorRules(), false, apply_inherited_only, |
1749 needs_apply_pass); | 1751 needs_apply_pass); |
1750 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( | 1752 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( |
1751 state, match_result.AuthorRules(), true, apply_inherited_only, | 1753 state, match_result.AuthorRules(), true, apply_inherited_only, |
1752 needs_apply_pass); | 1754 needs_apply_pass); |
1753 if (apply_animations == kIncludeAnimations) { | 1755 if (apply_animations == kIncludeAnimations) { |
1754 ApplyAnimatedProperties<kResolveVariables>( | 1756 ApplyAnimatedProperties<kResolveVariables>( |
1755 state, state.AnimationUpdate().ActiveInterpolationsForAnimations()); | 1757 state, |
| 1758 state.AnimationUpdate().ActiveInterpolationsForCustomAnimations()); |
1756 ApplyAnimatedProperties<kResolveVariables>( | 1759 ApplyAnimatedProperties<kResolveVariables>( |
1757 state, | 1760 state, |
1758 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); | 1761 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); |
1759 } | 1762 } |
1760 // TODO(leviw): stop recalculating every time | 1763 // TODO(leviw): stop recalculating every time |
1761 CSSVariableResolver::ResolveVariableDefinitions(state); | 1764 CSSVariableResolver::ResolveVariableDefinitions(state); |
1762 | 1765 |
1763 if (RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) { | 1766 if (RuntimeEnabledFeatures::cssApplyAtRulesEnabled()) { |
1764 if (CacheCustomPropertiesForApplyAtRules(state, | 1767 if (CacheCustomPropertiesForApplyAtRules(state, |
1765 match_result.AuthorRules())) { | 1768 match_result.AuthorRules())) { |
1766 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( | 1769 ApplyMatchedProperties<kResolveVariables, kUpdateNeedsApplyPass>( |
1767 state, match_result.AuthorRules(), false, apply_inherited_only, | 1770 state, match_result.AuthorRules(), false, apply_inherited_only, |
1768 needs_apply_pass); | 1771 needs_apply_pass); |
1769 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( | 1772 ApplyMatchedProperties<kResolveVariables, kCheckNeedsApplyPass>( |
1770 state, match_result.AuthorRules(), true, apply_inherited_only, | 1773 state, match_result.AuthorRules(), true, apply_inherited_only, |
1771 needs_apply_pass); | 1774 needs_apply_pass); |
1772 if (apply_animations == kIncludeAnimations) { | 1775 if (apply_animations == kIncludeAnimations) { |
1773 ApplyAnimatedProperties<kResolveVariables>( | 1776 ApplyAnimatedProperties<kResolveVariables>( |
1774 state, state.AnimationUpdate().ActiveInterpolationsForAnimations()); | 1777 state, |
| 1778 state.AnimationUpdate().ActiveInterpolationsForCustomAnimations()); |
1775 ApplyAnimatedProperties<kResolveVariables>( | 1779 ApplyAnimatedProperties<kResolveVariables>( |
1776 state, | 1780 state, |
1777 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); | 1781 state.AnimationUpdate().ActiveInterpolationsForCustomTransitions()); |
1778 } | 1782 } |
1779 CSSVariableResolver::ResolveVariableDefinitions(state); | 1783 CSSVariableResolver::ResolveVariableDefinitions(state); |
1780 } | 1784 } |
1781 } | 1785 } |
1782 } | 1786 } |
1783 | 1787 |
1784 void StyleResolver::ApplyMatchedAnimationProperties( | 1788 void StyleResolver::ApplyMatchedAnimationProperties( |
(...skipping 24 matching lines...) Expand all Loading... |
1809 CSSAnimations::CalculateTransitionUpdate(state.AnimationUpdate(), | 1813 CSSAnimations::CalculateTransitionUpdate(state.AnimationUpdate(), |
1810 CSSAnimations::PropertyPass::kCustom, | 1814 CSSAnimations::PropertyPass::kCustom, |
1811 animating_element, *state.Style()); | 1815 animating_element, *state.Style()); |
1812 | 1816 |
1813 state.SetIsAnimationInterpolationMapReady(); | 1817 state.SetIsAnimationInterpolationMapReady(); |
1814 | 1818 |
1815 if (state.IsAnimatingCustomProperties()) { | 1819 if (state.IsAnimatingCustomProperties()) { |
1816 return; | 1820 return; |
1817 } | 1821 } |
1818 if (!state.AnimationUpdate() | 1822 if (!state.AnimationUpdate() |
| 1823 .ActiveInterpolationsForCustomAnimations() |
| 1824 .IsEmpty() || |
| 1825 !state.AnimationUpdate() |
1819 .ActiveInterpolationsForCustomTransitions() | 1826 .ActiveInterpolationsForCustomTransitions() |
1820 .IsEmpty()) { | 1827 .IsEmpty()) { |
1821 state.SetIsAnimatingCustomProperties(true); | 1828 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 } | 1829 } |
1831 } | 1830 } |
1832 | 1831 |
1833 void StyleResolver::ApplyMatchedStandardProperties( | 1832 void StyleResolver::ApplyMatchedStandardProperties( |
1834 StyleResolverState& state, | 1833 StyleResolverState& state, |
1835 const MatchResult& match_result, | 1834 const MatchResult& match_result, |
1836 const CacheSuccess& cache_success, | 1835 const CacheSuccess& cache_success, |
1837 NeedsApplyPass& needs_apply_pass) { | 1836 NeedsApplyPass& needs_apply_pass) { |
1838 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), | 1837 INCREMENT_STYLE_STATS_COUNTER(GetDocument().GetStyleEngine(), |
1839 matched_property_apply, 1); | 1838 matched_property_apply, 1); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 | 2021 |
2023 DEFINE_TRACE(StyleResolver) { | 2022 DEFINE_TRACE(StyleResolver) { |
2024 visitor->Trace(matched_properties_cache_); | 2023 visitor->Trace(matched_properties_cache_); |
2025 visitor->Trace(selector_filter_); | 2024 visitor->Trace(selector_filter_); |
2026 visitor->Trace(style_sharing_lists_); | 2025 visitor->Trace(style_sharing_lists_); |
2027 visitor->Trace(document_); | 2026 visitor->Trace(document_); |
2028 visitor->Trace(tracker_); | 2027 visitor->Trace(tracker_); |
2029 } | 2028 } |
2030 | 2029 |
2031 } // namespace blink | 2030 } // namespace blink |
OLD | NEW |