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

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

Issue 194673002: Web Animations: Refactor KeyframeEffectModel to work via an InterpolationEffect. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 years, 9 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. 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 1065
1066 if (!(animatingElement && animatingElement->hasActiveAnimations()) 1066 if (!(animatingElement && animatingElement->hasActiveAnimations())
1067 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty()) 1067 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty())
1068 && !(state.style()->animations() && !state.style()->animations()->isEmpt y())) 1068 && !(state.style()->animations() && !state.style()->animations()->isEmpt y()))
1069 return; 1069 return;
1070 1070
1071 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this)); 1071 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this));
1072 if (!state.animationUpdate()) 1072 if (!state.animationUpdate())
1073 return; 1073 return;
1074 1074
1075 const AnimationEffect::CompositableValueMap& compositableValuesForAnimations = state.animationUpdate()->compositableValuesForAnimations(); 1075 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations = state.animationUpdate()->activeInterpolationsForAnimations();
1076 const AnimationEffect::CompositableValueMap& compositableValuesForTransition s = state.animationUpdate()->compositableValuesForTransitions(); 1076 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions = state.animationUpdate()->activeInterpolationsForTransitions();
1077 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Animations); 1077 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF orAnimations);
1078 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Transitions); 1078 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF orTransitions);
1079 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForA nimations); 1079 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo rAnimations);
1080 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForT ransitions); 1080 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo rTransitions);
1081 1081
1082 // If the animations/transitions change opacity or transform, we need to upd ate 1082 // If the animations/transitions change opacity or transform, we need to upd ate
1083 // the style to impose the stacking rules. Note that this is also 1083 // the style to impose the stacking rules. Note that this is also
1084 // done in StyleResolver::adjustRenderStyle(). 1084 // done in StyleResolver::adjustRenderStyle().
1085 RenderStyle* style = state.style(); 1085 RenderStyle* style = state.style();
1086 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m())) 1086 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m()))
1087 style->setZIndex(0); 1087 style->setZIndex(0);
1088 } 1088 }
1089 1089
1090 template <StyleResolver::StyleApplicationPass pass> 1090 template <StyleResolver::StyleApplicationPass pass>
1091 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ani mationEffect::CompositableValueMap& compositableValues) 1091 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations)
1092 { 1092 {
1093 ASSERT(pass != AnimationProperties); 1093 ASSERT(pass != AnimationProperties);
1094 1094
1095 for (AnimationEffect::CompositableValueMap::const_iterator iter = compositab leValues.begin(); iter != compositableValues.end(); ++iter) { 1095 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) {
1096 CSSPropertyID property = iter->key; 1096 CSSPropertyID property = iter->key;
1097 if (!isPropertyForPass<pass>(property)) 1097 if (!isPropertyForPass<pass>(property))
1098 continue; 1098 continue;
1099 ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Web Anima tions not yet implemented: An interface for compositing onto the underlying valu e."); 1099 const StyleInterpolation *interpolation = toStyleInterpolation(iter->val ue.get());
1100 RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0); 1100 interpolation->apply(state);
1101 AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get ());
1102 } 1101 }
1103 } 1102 }
1104 1103
1105 static inline bool isValidCueStyleProperty(CSSPropertyID id) 1104 static inline bool isValidCueStyleProperty(CSSPropertyID id)
1106 { 1105 {
1107 switch (id) { 1106 switch (id) {
1108 case CSSPropertyBackground: 1107 case CSSPropertyBackground:
1109 case CSSPropertyBackgroundAttachment: 1108 case CSSPropertyBackgroundAttachment:
1110 case CSSPropertyBackgroundClip: 1109 case CSSPropertyBackgroundClip:
1111 case CSSPropertyBackgroundColor: 1110 case CSSPropertyBackgroundColor:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1407 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1409 { 1408 {
1410 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1409 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1411 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1410 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1412 return true; 1411 return true;
1413 } 1412 }
1414 return false; 1413 return false;
1415 } 1414 }
1416 1415
1417 } // namespace WebCore 1416 } // namespace WebCore
OLDNEW
« Source/core/animation/css/CSSAnimations.h ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698