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

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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 1070
1071 if (!(animatingElement && animatingElement->hasActiveAnimations()) 1071 if (!(animatingElement && animatingElement->hasActiveAnimations())
1072 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty()) 1072 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty())
1073 && !(state.style()->animations() && !state.style()->animations()->isEmpt y())) 1073 && !(state.style()->animations() && !state.style()->animations()->isEmpt y()))
1074 return; 1074 return;
1075 1075
1076 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this)); 1076 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this));
1077 if (!state.animationUpdate()) 1077 if (!state.animationUpdate())
1078 return; 1078 return;
1079 1079
1080 const AnimationEffect::CompositableValueMap& compositableValuesForAnimations = state.animationUpdate()->compositableValuesForAnimations(); 1080 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rAnimations = state.animationUpdate()->activeInterpolationsForAnimations();
1081 const AnimationEffect::CompositableValueMap& compositableValuesForTransition s = state.animationUpdate()->compositableValuesForTransitions(); 1081 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolationsFo rTransitions = state.animationUpdate()->activeInterpolationsForTransitions();
1082 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Animations); 1082 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF orAnimations);
1083 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Transitions); 1083 applyAnimatedProperties<HighPriorityProperties>(state, activeInterpolationsF orTransitions);
1084 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForA nimations); 1084 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo rAnimations);
1085 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForT ransitions); 1085 applyAnimatedProperties<LowPriorityProperties>(state, activeInterpolationsFo rTransitions);
1086 1086
1087 // If the animations/transitions change opacity or transform, we need to upd ate 1087 // If the animations/transitions change opacity or transform, we need to upd ate
1088 // the style to impose the stacking rules. Note that this is also 1088 // the style to impose the stacking rules. Note that this is also
1089 // done in StyleResolver::adjustRenderStyle(). 1089 // done in StyleResolver::adjustRenderStyle().
1090 RenderStyle* style = state.style(); 1090 RenderStyle* style = state.style();
1091 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m())) 1091 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m()))
1092 style->setZIndex(0); 1092 style->setZIndex(0);
1093 1093
1094 // Start loading resources used by animations. 1094 // Start loading resources used by animations.
1095 loadPendingResources(state); 1095 loadPendingResources(state);
1096 } 1096 }
1097 1097
1098 template <StyleResolver::StyleApplicationPass pass> 1098 template <StyleResolver::StyleApplicationPass pass>
1099 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ani mationEffect::CompositableValueMap& compositableValues) 1099 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has hMap<CSSPropertyID, RefPtr<Interpolation> >& activeInterpolations)
1100 { 1100 {
1101 ASSERT(pass != AnimationProperties); 1101 ASSERT(pass != AnimationProperties);
1102 1102
1103 for (AnimationEffect::CompositableValueMap::const_iterator iter = compositab leValues.begin(); iter != compositableValues.end(); ++iter) { 1103 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = a ctiveInterpolations.begin(); iter != activeInterpolations.end(); ++iter) {
1104 CSSPropertyID property = iter->key; 1104 CSSPropertyID property = iter->key;
1105 if (!isPropertyForPass<pass>(property)) 1105 if (!isPropertyForPass<pass>(property))
1106 continue; 1106 continue;
1107 ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Web Anima tions not yet implemented: An interface for compositing onto the underlying valu e."); 1107 const StyleInterpolation *interpolation = toStyleInterpolation(iter->val ue.get());
1108 RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0); 1108 interpolation->apply(state);
1109 AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get ());
1110 } 1109 }
1111 } 1110 }
1112 1111
1113 static inline bool isValidCueStyleProperty(CSSPropertyID id) 1112 static inline bool isValidCueStyleProperty(CSSPropertyID id)
1114 { 1113 {
1115 switch (id) { 1114 switch (id) {
1116 case CSSPropertyBackground: 1115 case CSSPropertyBackground:
1117 case CSSPropertyBackgroundAttachment: 1116 case CSSPropertyBackgroundAttachment:
1118 case CSSPropertyBackgroundClip: 1117 case CSSPropertyBackgroundClip:
1119 case CSSPropertyBackgroundColor: 1118 case CSSPropertyBackgroundColor:
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1413 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1415 { 1414 {
1416 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1415 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1417 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1416 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1418 return true; 1417 return true;
1419 } 1418 }
1420 return false; 1419 return false;
1421 } 1420 }
1422 1421
1423 } // namespace WebCore 1422 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698