Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 TimingFunction* timingFunction = perKeyframeTimingFunctions.get(lowerBou nd); | 87 TimingFunction* timingFunction = perKeyframeTimingFunctions.get(lowerBou nd); |
| 88 isTimingFunctionLinearThroughout &= timingFunction->type() == TimingFunc tion::LinearFunction; | 88 isTimingFunctionLinearThroughout &= timingFunction->type() == TimingFunc tion::LinearFunction; |
| 89 chainedTimingFunction->appendSegment(upperBound, timingFunction); | 89 chainedTimingFunction->appendSegment(upperBound, timingFunction); |
| 90 } | 90 } |
| 91 if (isTimingFunctionLinearThroughout) | 91 if (isTimingFunctionLinearThroughout) |
| 92 return LinearTimingFunction::create(); | 92 return LinearTimingFunction::create(); |
| 93 return chainedTimingFunction; | 93 return chainedTimingFunction; |
| 94 } | 94 } |
| 95 | 95 |
| 96 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, | 96 static void resolveKeyframes(StyleResolver* resolver, Element* element, const El ement& parentElement, const RenderStyle& style, RenderStyle* parentStyle, const AtomicString& name, TimingFunction* defaultTimingFunction, |
| 97 Vector<std::pair<KeyframeEffectModel::KeyframeVector, RefPtr<TimingFunction> > >& keyframesAndTimingFunctions) | 97 HeapVector<std::pair<KeyframeEffectModel::KeyframeVector, RefPtr<TimingFunct ion> > >& keyframesAndTimingFunctions) |
|
Erik Corry
2014/03/04 12:45:12
WillBeHeapVector?
Mads Ager (chromium)
2014/03/04 12:49:07
Whoops, yes. Thanks!
| |
| 98 { | 98 { |
| 99 // When the element is null, use its parent for scoping purposes. | 99 // When the element is null, use its parent for scoping purposes. |
| 100 const Element* elementForScoping = element ? element : &parentElement; | 100 const Element* elementForScoping = element ? element : &parentElement; |
| 101 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe sRule(resolver, elementForScoping, name.impl()); | 101 const StyleRuleKeyframes* keyframesRule = CSSAnimations::matchScopedKeyframe sRule(resolver, elementForScoping, name.impl()); |
| 102 if (!keyframesRule) | 102 if (!keyframesRule) |
| 103 return; | 103 return; |
| 104 | 104 |
| 105 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); | 105 const Vector<RefPtr<StyleKeyframe> >& styleKeyframes = keyframesRule->keyfra mes(); |
| 106 if (styleKeyframes.isEmpty()) | 106 if (styleKeyframes.isEmpty()) |
| 107 return; | 107 return; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 ASSERT(!activeAnimations || !activeAnimations->isAnimati onStyleChange()); | 400 ASSERT(!activeAnimations || !activeAnimations->isAnimati onStyleChange()); |
| 401 update->toggleAnimationPaused(animationName); | 401 update->toggleAnimationPaused(animationName); |
| 402 } | 402 } |
| 403 continue; | 403 continue; |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 | 406 |
| 407 Timing timing; | 407 Timing timing; |
| 408 bool isPaused; | 408 bool isPaused; |
| 409 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa ta(animationData, timing, isPaused); | 409 RefPtr<TimingFunction> defaultTimingFunction = timingFromAnimationDa ta(animationData, timing, isPaused); |
| 410 Vector<std::pair<KeyframeEffectModel::KeyframeVector, RefPtr<TimingF unction> > > keyframesAndTimingFunctions; | 410 HeapVector<std::pair<KeyframeEffectModel::KeyframeVector, RefPtr<Tim ingFunction> > > keyframesAndTimingFunctions; |
| 411 resolveKeyframes(resolver, element, parentElement, style, parentStyl e, animationName, defaultTimingFunction.get(), keyframesAndTimingFunctions); | 411 resolveKeyframes(resolver, element, parentElement, style, parentStyl e, animationName, defaultTimingFunction.get(), keyframesAndTimingFunctions); |
| 412 if (!keyframesAndTimingFunctions.isEmpty()) { | 412 if (!keyframesAndTimingFunctions.isEmpty()) { |
| 413 HashSet<RefPtr<InertAnimation> > animations; | 413 HashSet<RefPtr<InertAnimation> > animations; |
| 414 for (size_t j = 0; j < keyframesAndTimingFunctions.size(); ++j) { | 414 for (size_t j = 0; j < keyframesAndTimingFunctions.size(); ++j) { |
| 415 ASSERT(!keyframesAndTimingFunctions[j].first.isEmpty()); | 415 ASSERT(!keyframesAndTimingFunctions[j].first.isEmpty()); |
| 416 timing.timingFunction = keyframesAndTimingFunctions[j].secon d; | 416 timing.timingFunction = keyframesAndTimingFunctions[j].secon d; |
| 417 // FIXME: crbug.com/268791 - Keyframes are already normalize d, perhaps there should be a flag on KeyframeEffectModel to skip normalization. | 417 // FIXME: crbug.com/268791 - Keyframes are already normalize d, perhaps there should be a flag on KeyframeEffectModel to skip normalization. |
| 418 animations.add(InertAnimation::create(KeyframeEffectModel::c reate(keyframesAndTimingFunctions[j].first), timing, isPaused)); | 418 animations.add(InertAnimation::create(KeyframeEffectModel::c reate(keyframesAndTimingFunctions[j].first), timing, isPaused)); |
| 419 } | 419 } |
| 420 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC hange()); | 420 ASSERT(!activeAnimations || !activeAnimations->isAnimationStyleC hange()); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 CSSPropertyID id = convertToCSSPropertyID(i); | 916 CSSPropertyID id = convertToCSSPropertyID(i); |
| 917 if (isAnimatableProperty(id)) | 917 if (isAnimatableProperty(id)) |
| 918 properties.append(id); | 918 properties.append(id); |
| 919 } | 919 } |
| 920 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size()); | 920 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie s.begin(), properties.size()); |
| 921 } | 921 } |
| 922 return propertyShorthand; | 922 return propertyShorthand; |
| 923 } | 923 } |
| 924 | 924 |
| 925 } // namespace WebCore | 925 } // namespace WebCore |
| OLD | NEW |