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

Side by Side Diff: sky/engine/core/animation/css/CSSAnimations.cpp

Issue 839473005: Simplify ScopedStyleResolver keyframe handling. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 break; 79 break;
80 } 80 }
81 return property; 81 return property;
82 } 82 }
83 83
84 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, 84 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction,
85 AnimatableValueKeyframeVector& keyframes) 85 AnimatableValueKeyframeVector& keyframes)
86 { 86 {
87 // When the element is null, use its parent for scoping purposes. 87 // When the element is null, use its parent for scoping purposes.
88 const Element* elementForScoping = element ? element : &parentElement; 88 const Element* elementForScoping = element ? element : &parentElement;
89 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe sRule(resolver, elementForScoping, name.impl()); 89 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe sRule(resolver, elementForScoping, name);
90 if (!keyframesRule) 90 if (!keyframesRule)
91 return; 91 return;
92 92
93 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); 93 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes();
94 if (styleKeyframes.isEmpty()) 94 if (styleKeyframes.isEmpty())
95 return; 95 return;
96 96
97 // Construct and populate the style for each keyframe 97 // Construct and populate the style for each keyframe
98 PropertySet specifiedPropertiesForUseCounter; 98 PropertySet specifiedPropertiesForUseCounter;
99 for (size_t i = 0; i < styleKeyframes.size(); ++i) { 99 for (size_t i = 0; i < styleKeyframes.size(); ++i) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 if (endNeedsValue) 186 if (endNeedsValue)
187 endKeyframe->setPropertyValue(property, snapshotValue.get()); 187 endKeyframe->setPropertyValue(property, snapshotValue.get());
188 } 188 }
189 } 189 }
190 ASSERT(startKeyframe->properties().size() == allProperties.size()); 190 ASSERT(startKeyframe->properties().size() == allProperties.size());
191 ASSERT(endKeyframe->properties().size() == allProperties.size()); 191 ASSERT(endKeyframe->properties().size() == allProperties.size());
192 } 192 }
193 193
194 } // namespace 194 } // namespace
195 195
196 const StyleRuleKeyframes* CSSAnimations::matchScopedKeyframesRule(StyleResolver* resolver, const Element* element, const StringImpl* animationName) 196 const StyleRuleKeyframes* CSSAnimations::matchScopedKeyframesRule(StyleResolver* resolver, const Element* element, String animationName)
197 { 197 {
198 // FIXME: This is all implementation detail of style resolver, CSSAnimations shouldn't be reaching into any of it. 198 // FIXME: This is all implementation detail of style resolver, CSSAnimations shouldn't be reaching into any of it.
199 Vector<RawPtr<ScopedStyleResolver>, 8> stack; 199 Vector<RawPtr<ScopedStyleResolver>, 8> stack;
200 resolver->styleTreeResolveScopedKeyframesRules(element, stack); 200 resolver->styleTreeResolveScopedKeyframesRules(element, stack);
201 if (stack.isEmpty()) 201 if (stack.isEmpty())
202 return 0; 202 return 0;
203 203
204 for (size_t i = 0; i < stack.size(); ++i) { 204 for (size_t i = 0; i < stack.size(); ++i) {
205 if (const StyleRuleKeyframes* keyframesRule = stack.at(i)->keyframeStyle sForAnimation(animationName)) 205 if (const StyleRuleKeyframes* keyframesRule = stack.at(i)->keyframeStyle sForAnimation(animationName))
206 return keyframesRule; 206 return keyframesRule;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 case CSSPropertyTransitionDuration: 639 case CSSPropertyTransitionDuration:
640 case CSSPropertyTransitionProperty: 640 case CSSPropertyTransitionProperty:
641 case CSSPropertyTransitionTimingFunction: 641 case CSSPropertyTransitionTimingFunction:
642 return false; 642 return false;
643 default: 643 default:
644 return true; 644 return true;
645 } 645 }
646 } 646 }
647 647
648 } // namespace blink 648 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698