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

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

Issue 814083003: Update animation when changes in animation keyframes are detected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Detect when style changes to a different object Created 5 years, 11 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 } 1031 }
1032 return 0; 1032 return 0;
1033 } 1033 }
1034 1034
1035 void StyleResolver::resolveScopedStyles(const Element* element, WillBeHeapVector <RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers) 1035 void StyleResolver::resolveScopedStyles(const Element* element, WillBeHeapVector <RawPtrWillBeMember<ScopedStyleResolver>, 8>& resolvers)
1036 { 1036 {
1037 for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scope dResolver; scopedResolver = scopedResolver->parent()) 1037 for (ScopedStyleResolver* scopedResolver = scopedResolverFor(element); scope dResolver; scopedResolver = scopedResolver->parent())
1038 resolvers.append(scopedResolver); 1038 resolvers.append(scopedResolver);
1039 } 1039 }
1040 1040
1041 const StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* elemen t, const AtomicString& animationName) 1041 const StyleRuleKeyframes* StyleResolver::findKeyframesRule(const Element* elemen t, const AtomicString& animationName) const
1042 { 1042 {
1043 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; 1043 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers;
1044 collectScopedResolversForHostedShadowTrees(element, resolvers); 1044 collectScopedResolversForHostedShadowTrees(element, resolvers);
1045 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver()) 1045 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver())
1046 resolvers.append(scopedResolver); 1046 resolvers.append(scopedResolver);
1047 1047
1048 for (size_t i = 0; i < resolvers.size(); ++i) { 1048 for (size_t i = 0; i < resolvers.size(); ++i) {
1049 if (const StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStyl esForAnimation(animationName.impl())) 1049 if (const StyleRuleKeyframes* keyframesRule = resolvers[i]->keyframeStyl esForAnimation(animationName.impl()).get())
1050 return keyframesRule; 1050 return keyframesRule;
1051 } 1051 }
1052 return nullptr; 1052 return nullptr;
1053 }
1054
1055 PassRefPtrWillBeRawPtr<StyleRuleKeyframes> StyleResolver::findKeyframesRule(cons t Element* element, const AtomicString& animationName)
1056 {
1057 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers;
1058 collectScopedResolversForHostedShadowTrees(element, resolvers);
1059 if (ScopedStyleResolver* scopedResolver = element->treeScope().scopedStyleRe solver())
1060 resolvers.append(scopedResolver);
1061
1062 for (size_t i = 0; i < resolvers.size(); ++i) {
1063 if (RefPtrWillBeRawPtr<StyleRuleKeyframes> keyframesRule = resolvers[i]- >keyframeStylesForAnimation(animationName.impl()))
1064 return keyframesRule;
1065 }
1066 return nullptr;
1053 } 1067 }
1054 1068
1055 template <StyleResolver::StyleApplicationPass pass> 1069 template <StyleResolver::StyleApplicationPass pass>
1056 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo lations) 1070 void StyleResolver::applyAnimatedProperties(StyleResolverState& state, const Wil lBeHeapHashMap<CSSPropertyID, RefPtrWillBeMember<Interpolation> >& activeInterpo lations)
1057 { 1071 {
1058 for (const auto& interpolationEntry : activeInterpolations) { 1072 for (const auto& interpolationEntry : activeInterpolations) {
1059 CSSPropertyID property = interpolationEntry.key; 1073 CSSPropertyID property = interpolationEntry.key;
1060 if (!isPropertyForPass<pass>(property)) 1074 if (!isPropertyForPass<pass>(property))
1061 continue; 1075 continue;
1062 const StyleInterpolation* interpolation = toStyleInterpolation(interpola tionEntry.value.get()); 1076 const StyleInterpolation* interpolation = toStyleInterpolation(interpola tionEntry.value.get());
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 visitor->trace(m_uncommonAttributeRuleSet); 1618 visitor->trace(m_uncommonAttributeRuleSet);
1605 visitor->trace(m_watchedSelectorsRules); 1619 visitor->trace(m_watchedSelectorsRules);
1606 visitor->trace(m_treeBoundaryCrossingRules); 1620 visitor->trace(m_treeBoundaryCrossingRules);
1607 visitor->trace(m_styleSharingLists); 1621 visitor->trace(m_styleSharingLists);
1608 visitor->trace(m_pendingStyleSheets); 1622 visitor->trace(m_pendingStyleSheets);
1609 visitor->trace(m_document); 1623 visitor->trace(m_document);
1610 #endif 1624 #endif
1611 } 1625 }
1612 1626
1613 } // namespace blink 1627 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698