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

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

Issue 1329843002: Support per property CSS Animation stacks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Review comments Created 5 years, 3 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 | Annotate | Revision Log
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. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 17 matching lines...) Expand all
28 28
29 #include "config.h" 29 #include "config.h"
30 #include "core/css/resolver/StyleResolver.h" 30 #include "core/css/resolver/StyleResolver.h"
31 31
32 #include "core/CSSPropertyNames.h" 32 #include "core/CSSPropertyNames.h"
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/MediaTypeNames.h" 34 #include "core/MediaTypeNames.h"
35 #include "core/StylePropertyShorthand.h" 35 #include "core/StylePropertyShorthand.h"
36 #include "core/animation/AnimationTimeline.h" 36 #include "core/animation/AnimationTimeline.h"
37 #include "core/animation/ElementAnimations.h" 37 #include "core/animation/ElementAnimations.h"
38 #include "core/animation/InvalidatableStyleInterpolation.h"
38 #include "core/animation/KeyframeEffect.h" 39 #include "core/animation/KeyframeEffect.h"
39 #include "core/animation/StyleInterpolation.h" 40 #include "core/animation/StyleInterpolation.h"
40 #include "core/animation/animatable/AnimatableValue.h" 41 #include "core/animation/animatable/AnimatableValue.h"
41 #include "core/animation/css/CSSAnimatableValueFactory.h" 42 #include "core/animation/css/CSSAnimatableValueFactory.h"
42 #include "core/animation/css/CSSAnimations.h" 43 #include "core/animation/css/CSSAnimations.h"
43 #include "core/css/CSSCalculationValue.h" 44 #include "core/css/CSSCalculationValue.h"
44 #include "core/css/CSSDefaultStyleSheets.h" 45 #include "core/css/CSSDefaultStyleSheets.h"
45 #include "core/css/CSSFontSelector.h" 46 #include "core/css/CSSFontSelector.h"
46 #include "core/css/CSSKeyframeRule.h" 47 #include "core/css/CSSKeyframeRule.h"
47 #include "core/css/CSSKeyframesRule.h" 48 #include "core/css/CSSKeyframesRule.h"
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 953
953 CSSAnimations::calculateUpdate(animatingElement, *element, *state.style(), s tate.parentStyle(), state.animationUpdate(), this); 954 CSSAnimations::calculateUpdate(animatingElement, *element, *state.style(), s tate.parentStyle(), state.animationUpdate(), this);
954 if (state.animationUpdate().isEmpty()) 955 if (state.animationUpdate().isEmpty())
955 return false; 956 return false;
956 957
957 if (state.style()->insideLink() != NotInsideLink) { 958 if (state.style()->insideLink() != NotInsideLink) {
958 ASSERT(state.applyPropertyToRegularStyle()); 959 ASSERT(state.applyPropertyToRegularStyle());
959 state.setApplyPropertyToVisitedLinkStyle(true); 960 state.setApplyPropertyToVisitedLinkStyle(true);
960 } 961 }
961 962
962 const ActiveInterpolationMap& activeInterpolationsForAnimations = state.anim ationUpdate().activeInterpolationsForAnimations(); 963 const ActiveInterpolationsMap& activeInterpolationsMapForAnimations = state. animationUpdate().activeInterpolationsForAnimations();
963 const ActiveInterpolationMap& activeInterpolationsForTransitions = state.ani mationUpdate().activeInterpolationsForTransitions(); 964 const ActiveInterpolationsMap& activeInterpolationsMapForTransitions = state .animationUpdate().activeInterpolationsForTransitions();
964 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor Animations); 965 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForAnimations);
965 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsFor Transitions); 966 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForTransitions);
966 967
967 updateFont(state); 968 updateFont(state);
968 969
969 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForA nimations); 970 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsMapF orAnimations);
970 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsForT ransitions); 971 applyAnimatedProperties<LowPropertyPriority>(state, activeInterpolationsMapF orTransitions);
971 972
972 // Start loading resources used by animations. 973 // Start loading resources used by animations.
973 loadPendingResources(state); 974 loadPendingResources(state);
974 975
975 ASSERT(!state.fontBuilder().fontDirty()); 976 ASSERT(!state.fontBuilder().fontDirty());
976 977
977 state.setApplyPropertyToVisitedLinkStyle(false); 978 state.setApplyPropertyToVisitedLinkStyle(false);
978 979
979 return true; 980 return true;
980 } 981 }
(...skipping 21 matching lines...) Expand all
1002 resolvers.append(scopedResolver); 1003 resolvers.append(scopedResolver);
1003 1004
1004 for (size_t i = 0; i < resolvers.size(); ++i) { 1005 for (size_t i = 0; i < resolvers.size(); ++i) {
1005 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl())) 1006 if (StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStylesForA nimation(animationName.impl()))
1006 return keyframesRule; 1007 return keyframesRule;
1007 } 1008 }
1008 return nullptr; 1009 return nullptr;
1009 } 1010 }
1010 1011
1011 template <CSSPropertyPriority priority> 1012 template <CSSPropertyPriority priority>
1012 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has hMap<PropertyHandle, RefPtr<Interpolation>>& activeInterpolations) 1013 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Act iveInterpolationsMap& activeInterpolationsMap)
1013 { 1014 {
1014 for (const auto& interpolationEntry : activeInterpolations) { 1015 for (const auto& interpolationsVectorEntry : activeInterpolationsMap) {
1015 if (!interpolationEntry.key.isCSSProperty()) 1016 if (!interpolationsVectorEntry.key.isCSSProperty())
1016 continue; 1017 continue;
1017 CSSPropertyID property = interpolationEntry.key.cssProperty(); 1018 CSSPropertyID property = interpolationsVectorEntry.key.cssProperty();
1018 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property)) 1019 if (!CSSPropertyPriorityData<priority>::propertyHasPriority(property))
1019 continue; 1020 continue;
1020 const StyleInterpolation* interpolation = toStyleInterpolation(interpola tionEntry.value.get()); 1021 const Interpolation& interpolation = *interpolationsVectorEntry.value.fi rst();
1021 interpolation->apply(state); 1022 if (interpolation.isInvalidatableStyleInterpolation())
1023 InvalidatableStyleInterpolation::applyStack(interpolationsVectorEntr y.value, state);
1024 else
1025 toStyleInterpolation(interpolation).apply(state);
1022 } 1026 }
1023 } 1027 }
1024 1028
1025 static inline bool isValidCueStyleProperty(CSSPropertyID id) 1029 static inline bool isValidCueStyleProperty(CSSPropertyID id)
1026 { 1030 {
1027 switch (id) { 1031 switch (id) {
1028 case CSSPropertyBackground: 1032 case CSSPropertyBackground:
1029 case CSSPropertyBackgroundAttachment: 1033 case CSSPropertyBackgroundAttachment:
1030 case CSSPropertyBackgroundClip: 1034 case CSSPropertyBackgroundClip:
1031 case CSSPropertyBackgroundColor: 1035 case CSSPropertyBackgroundColor:
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 visitor->trace(m_watchedSelectorsRules); 1540 visitor->trace(m_watchedSelectorsRules);
1537 visitor->trace(m_treeBoundaryCrossingScopes); 1541 visitor->trace(m_treeBoundaryCrossingScopes);
1538 visitor->trace(m_styleResourceLoader); 1542 visitor->trace(m_styleResourceLoader);
1539 visitor->trace(m_styleSharingLists); 1543 visitor->trace(m_styleSharingLists);
1540 visitor->trace(m_pendingStyleSheets); 1544 visitor->trace(m_pendingStyleSheets);
1541 visitor->trace(m_document); 1545 visitor->trace(m_document);
1542 #endif 1546 #endif
1543 } 1547 }
1544 1548
1545 } // namespace blink 1549 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698