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

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

Issue 2043273002: Defer compositor keyframe snapshots until the next style resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 if (state.style()->hasViewportUnits()) 843 if (state.style()->hasViewportUnits())
844 document().setHasViewportUnits(); 844 document().setHasViewportUnits();
845 845
846 if (state.style()->hasRemUnits()) 846 if (state.style()->hasRemUnits())
847 document().styleEngine().setUsesRemUnit(true); 847 document().styleEngine().setUsesRemUnit(true);
848 848
849 // Now return the style. 849 // Now return the style.
850 return state.takeStyle(); 850 return state.takeStyle();
851 } 851 }
852 852
853 // This function is used by the WebAnimations JavaScript API method animate(). 853 // TODO(alancutter): Create compositor keyframe values directly instead of inter mediate AnimatableValues.
854 // FIXME: Remove this when animate() switches away from resolution-dependent par sing. 854 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element & element, const ComputedStyle& baseStyle, const ComputedStyle* parentStyle, CSS PropertyID property, const CSSValue* value)
855 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(Element & element, const ComputedStyle* baseStyle, CSSPropertyID property, const CSSValu e* value)
856 { 855 {
857 StyleResolverState state(element.document(), &element); 856 // TODO(alancutter): Avoid creating a StyleResolverState just to apply a sin gle value on a ComputedStyle.
858 state.setStyle(baseStyle ? ComputedStyle::clone(*baseStyle) : ComputedStyle: :create()); 857 StyleResolverState state(element.document(), &element, parentStyle);
859 return createAnimatableValueSnapshot(state, property, value); 858 state.setStyle(ComputedStyle::clone(baseStyle));
860 }
861
862 PassRefPtr<AnimatableValue> StyleResolver::createAnimatableValueSnapshot(StyleRe solverState& state, CSSPropertyID property, const CSSValue* value)
863 {
864 if (value) { 859 if (value) {
865 StyleBuilder::applyProperty(property, state, *value); 860 StyleBuilder::applyProperty(property, state, *value);
866 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef()); 861 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef());
867 } 862 }
868 return CSSAnimatableValueFactory::create(property, *state.style()); 863 return CSSAnimatableValueFactory::create(property, *state.style());
869 } 864 }
870 865
871 PseudoElement* StyleResolver::createPseudoElement(Element* parent, PseudoId pseu doId) 866 PseudoElement* StyleResolver::createPseudoElement(Element* parent, PseudoId pseu doId)
872 { 867 {
873 if (pseudoId == PseudoIdFirstLetter) 868 if (pseudoId == PseudoIdFirstLetter)
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 ASSERT(animatingElement == element || !animatingElement || animatingElement- >parentOrShadowHostElement() == element); 1119 ASSERT(animatingElement == element || !animatingElement || animatingElement- >parentOrShadowHostElement() == element);
1125 1120
1126 if (!(animatingElement && animatingElement->hasAnimations()) 1121 if (!(animatingElement && animatingElement->hasAnimations())
1127 && !state.style()->transitions() && !state.style()->animations()) 1122 && !state.style()->transitions() && !state.style()->animations())
1128 return false; 1123 return false;
1129 1124
1130 CSSAnimations::calculateUpdate(animatingElement, *element, *state.style(), s tate.parentStyle(), state.animationUpdate(), this); 1125 CSSAnimations::calculateUpdate(animatingElement, *element, *state.style(), s tate.parentStyle(), state.animationUpdate(), this);
1131 if (state.animationUpdate().isEmpty()) 1126 if (state.animationUpdate().isEmpty())
1132 return false; 1127 return false;
1133 1128
1129 CSSAnimations::snapshotCompositorKeyframes(*element, state.animationUpdate() , *state.style(), state.parentStyle());
1130
1134 if (state.style()->insideLink() != NotInsideLink) { 1131 if (state.style()->insideLink() != NotInsideLink) {
1135 ASSERT(state.applyPropertyToRegularStyle()); 1132 ASSERT(state.applyPropertyToRegularStyle());
1136 state.setApplyPropertyToVisitedLinkStyle(true); 1133 state.setApplyPropertyToVisitedLinkStyle(true);
1137 } 1134 }
1138 1135
1139 const ActiveInterpolationsMap& activeInterpolationsMapForAnimations = state. animationUpdate().activeInterpolationsForAnimations(); 1136 const ActiveInterpolationsMap& activeInterpolationsMapForAnimations = state. animationUpdate().activeInterpolationsForAnimations();
1140 const ActiveInterpolationsMap& activeInterpolationsMapForTransitions = state .animationUpdate().activeInterpolationsForTransitions(); 1137 const ActiveInterpolationsMap& activeInterpolationsMapForTransitions = state .animationUpdate().activeInterpolationsForTransitions();
1141 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForAnimations); 1138 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForAnimations);
1142 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForTransitions); 1139 applyAnimatedProperties<HighPropertyPriority>(state, activeInterpolationsMap ForTransitions);
1143 1140
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 visitor->trace(m_siblingRuleSet); 1743 visitor->trace(m_siblingRuleSet);
1747 visitor->trace(m_uncommonAttributeRuleSet); 1744 visitor->trace(m_uncommonAttributeRuleSet);
1748 visitor->trace(m_watchedSelectorsRules); 1745 visitor->trace(m_watchedSelectorsRules);
1749 visitor->trace(m_treeBoundaryCrossingScopes); 1746 visitor->trace(m_treeBoundaryCrossingScopes);
1750 visitor->trace(m_styleSharingLists); 1747 visitor->trace(m_styleSharingLists);
1751 visitor->trace(m_pendingStyleSheets); 1748 visitor->trace(m_pendingStyleSheets);
1752 visitor->trace(m_document); 1749 visitor->trace(m_document);
1753 } 1750 }
1754 1751
1755 } // namespace blink 1752 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698