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

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

Issue 143573004: [wip] interpolable value refactor. NOT FOR LANDING. Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 years, 10 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 1143
1144 if (!(animatingElement && animatingElement->hasActiveAnimations()) 1144 if (!(animatingElement && animatingElement->hasActiveAnimations())
1145 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty()) 1145 && !(state.style()->transitions() && !state.style()->transitions()->isEm pty())
1146 && !(state.style()->animations() && !state.style()->animations()->isEmpt y())) 1146 && !(state.style()->animations() && !state.style()->animations()->isEmpt y()))
1147 return; 1147 return;
1148 1148
1149 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this)); 1149 state.setAnimationUpdate(CSSAnimations::calculateUpdate(animatingElement, *e lement, *state.style(), state.parentStyle(), this));
1150 if (!state.animationUpdate()) 1150 if (!state.animationUpdate())
1151 return; 1151 return;
1152 1152
1153 const AnimationEffect::CompositableValueMap& compositableValuesForAnimations = state.animationUpdate()->compositableValuesForAnimations(); 1153 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& compositableValuesForA nimations = state.animationUpdate()->compositableValuesForAnimations();
1154 const AnimationEffect::CompositableValueMap& compositableValuesForTransition s = state.animationUpdate()->compositableValuesForTransitions(); 1154 const HashMap<CSSPropertyID, RefPtr<Interpolation> >& compositableValuesForT ransitions = state.animationUpdate()->compositableValuesForTransitions();
1155 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Animations); 1155 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Animations);
1156 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Transitions); 1156 applyAnimatedProperties<HighPriorityProperties>(state, compositableValuesFor Transitions);
1157 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForA nimations); 1157 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForA nimations);
1158 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForT ransitions); 1158 applyAnimatedProperties<LowPriorityProperties>(state, compositableValuesForT ransitions);
1159 1159
1160 // If the animations/transitions change opacity or transform, we need to upd ate 1160 // If the animations/transitions change opacity or transform, we need to upd ate
1161 // the style to impose the stacking rules. Note that this is also 1161 // the style to impose the stacking rules. Note that this is also
1162 // done in StyleResolver::adjustRenderStyle(). 1162 // done in StyleResolver::adjustRenderStyle().
1163 RenderStyle* style = state.style(); 1163 RenderStyle* style = state.style();
1164 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m())) 1164 if (style->hasAutoZIndex() && (style->opacity() < 1.0f || style->hasTransfor m()))
1165 style->setZIndex(0); 1165 style->setZIndex(0);
1166 } 1166 }
1167 1167
1168 template <StyleResolver::StyleApplicationPass pass> 1168 template <StyleResolver::StyleApplicationPass pass>
1169 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Ani mationEffect::CompositableValueMap& compositableValues) 1169 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Has hMap<CSSPropertyID, RefPtr<Interpolation> >& compositableValues)
1170 { 1170 {
1171 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled()); 1171 ASSERT(RuntimeEnabledFeatures::webAnimationsCSSEnabled());
1172 ASSERT(pass != VariableDefinitions); 1172 ASSERT(pass != VariableDefinitions);
1173 ASSERT(pass != AnimationProperties); 1173 ASSERT(pass != AnimationProperties);
1174 1174
1175 for (AnimationEffect::CompositableValueMap::const_iterator iter = compositab leValues.begin(); iter != compositableValues.end(); ++iter) { 1175 for (HashMap<CSSPropertyID, RefPtr<Interpolation> >::const_iterator iter = c ompositableValues.begin(); iter != compositableValues.end(); ++iter) {
1176 CSSPropertyID property = iter->key; 1176 CSSPropertyID property = iter->key;
1177 if (!isPropertyForPass<pass>(property)) 1177 if (!isPropertyForPass<pass>(property))
1178 continue; 1178 continue;
1179 ASSERT_WITH_MESSAGE(!iter->value->dependsOnUnderlyingValue(), "Web Anima tions not yet implemented: An interface for compositing onto the underlying valu e."); 1179 const StyleInterpolation *interpolation = static_cast<const StyleInterpo lation *>(iter->value.get());
1180 RefPtr<AnimatableValue> animatableValue = iter->value->compositeOnto(0); 1180 interpolation->apply(state);
1181 AnimatedStyleBuilder::applyProperty(property, state, animatableValue.get ());
1182 } 1181 }
1183 } 1182 }
1184 1183
1185 // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule 1184 // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule
1186 // FIXME: add incremental support for other region styling properties. 1185 // FIXME: add incremental support for other region styling properties.
1187 static inline bool isValidRegionStyleProperty(CSSPropertyID id) 1186 static inline bool isValidRegionStyleProperty(CSSPropertyID id)
1188 { 1187 {
1189 switch (id) { 1188 switch (id) {
1190 case CSSPropertyBackgroundColor: 1189 case CSSPropertyBackgroundColor:
1191 case CSSPropertyColor: 1190 case CSSPropertyColor:
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1513 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1515 { 1514 {
1516 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1515 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1517 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1516 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1518 return true; 1517 return true;
1519 } 1518 }
1520 return false; 1519 return false;
1521 } 1520 }
1522 1521
1523 } // namespace WebCore 1522 } // 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