| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 const PropertySet& endKeyframeProperties = endKeyframe->properties(); | 161 const PropertySet& endKeyframeProperties = endKeyframe->properties(); |
| 162 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz
e(); | 162 bool missingStartValues = startKeyframeProperties.size() < allProperties.siz
e(); |
| 163 bool missingEndValues = endKeyframeProperties.size() < allProperties.size(); | 163 bool missingEndValues = endKeyframeProperties.size() < allProperties.size(); |
| 164 if (missingStartValues || missingEndValues) { | 164 if (missingStartValues || missingEndValues) { |
| 165 for (PropertySet::const_iterator iter = allProperties.begin(); iter != a
llProperties.end(); ++iter) { | 165 for (PropertySet::const_iterator iter = allProperties.begin(); iter != a
llProperties.end(); ++iter) { |
| 166 const CSSPropertyID property = *iter; | 166 const CSSPropertyID property = *iter; |
| 167 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(property); | 167 bool startNeedsValue = missingStartValues && !startKeyframePropertie
s.contains(property); |
| 168 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(property); | 168 bool endNeedsValue = missingEndValues && !endKeyframeProperties.cont
ains(property); |
| 169 if (!startNeedsValue && !endNeedsValue) | 169 if (!startNeedsValue && !endNeedsValue) |
| 170 continue; | 170 continue; |
| 171 RefPtr<AnimatableValue> snapshotValue = CSSAnimatableValueFactory::c
reate(property, style); | 171 RefPtrWillBeRawPtr<AnimatableValue> snapshotValue = CSSAnimatableVal
ueFactory::create(property, style); |
| 172 if (startNeedsValue) | 172 if (startNeedsValue) |
| 173 startKeyframe->setPropertyValue(property, snapshotValue.get()); | 173 startKeyframe->setPropertyValue(property, snapshotValue.get()); |
| 174 if (endNeedsValue) | 174 if (endNeedsValue) |
| 175 endKeyframe->setPropertyValue(property, snapshotValue.get()); | 175 endKeyframe->setPropertyValue(property, snapshotValue.get()); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 ASSERT(startKeyframe->properties().size() == allProperties.size()); | 178 ASSERT(startKeyframe->properties().size() == allProperties.size()); |
| 179 ASSERT(endKeyframe->properties().size() == allProperties.size()); | 179 ASSERT(endKeyframe->properties().size() == allProperties.size()); |
| 180 | 180 |
| 181 // Determine how many keyframes specify each property. Note that this must | 181 // Determine how many keyframes specify each property. Note that this must |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 element->document().cssPendingAnimations().add(player.get()); | 511 element->document().cssPendingAnimations().add(player.get()); |
| 512 runningTransition.transition = transition.get(); | 512 runningTransition.transition = transition.get(); |
| 513 m_transitions.set(id, runningTransition); | 513 m_transitions.set(id, runningTransition); |
| 514 ASSERT(id != CSSPropertyInvalid); | 514 ASSERT(id != CSSPropertyInvalid); |
| 515 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); | 515 blink::Platform::current()->histogramSparse("WebCore.Animation.CSSProper
ties", UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(id)); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const
CSSAnimationData* anim, const RenderStyle& oldStyle, const RenderStyle& style,
const TransitionMap* activeTransitions, CSSAnimationUpdate* update, const Elemen
t* element) | 519 void CSSAnimations::calculateTransitionUpdateForProperty(CSSPropertyID id, const
CSSAnimationData* anim, const RenderStyle& oldStyle, const RenderStyle& style,
const TransitionMap* activeTransitions, CSSAnimationUpdate* update, const Elemen
t* element) |
| 520 { | 520 { |
| 521 RefPtr<AnimatableValue> to; | 521 RefPtrWillBeRawPtr<AnimatableValue> to; |
| 522 if (activeTransitions) { | 522 if (activeTransitions) { |
| 523 TransitionMap::const_iterator activeTransitionIter = activeTransitions->
find(id); | 523 TransitionMap::const_iterator activeTransitionIter = activeTransitions->
find(id); |
| 524 if (activeTransitionIter != activeTransitions->end()) { | 524 if (activeTransitionIter != activeTransitions->end()) { |
| 525 to = CSSAnimatableValueFactory::create(id, style); | 525 to = CSSAnimatableValueFactory::create(id, style); |
| 526 const AnimatableValue* activeTo = activeTransitionIter->value.to; | 526 const AnimatableValue* activeTo = activeTransitionIter->value.to; |
| 527 if (to->equals(activeTo)) | 527 if (to->equals(activeTo)) |
| 528 return; | 528 return; |
| 529 update->cancelTransition(id); | 529 update->cancelTransition(id); |
| 530 ASSERT(!element->activeAnimations() || !element->activeAnimations()-
>isAnimationStyleChange()); | 530 ASSERT(!element->activeAnimations() || !element->activeAnimations()-
>isAnimationStyleChange()); |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 if (anim->duration() + anim->delay() <= 0) | 534 if (anim->duration() + anim->delay() <= 0) |
| 535 return; | 535 return; |
| 536 | 536 |
| 537 if (CSSPropertyEquality::propertiesEqual(id, oldStyle, style)) | 537 if (CSSPropertyEquality::propertiesEqual(id, oldStyle, style)) |
| 538 return; | 538 return; |
| 539 if (!to) | 539 if (!to) |
| 540 to = CSSAnimatableValueFactory::create(id, style); | 540 to = CSSAnimatableValueFactory::create(id, style); |
| 541 | 541 |
| 542 RefPtr<AnimatableValue> from = CSSAnimatableValueFactory::create(id, oldStyl
e); | 542 RefPtrWillBeRawPtr<AnimatableValue> from = CSSAnimatableValueFactory::create
(id, oldStyle); |
| 543 // If we have multiple transitions on the same property, we will use the | 543 // If we have multiple transitions on the same property, we will use the |
| 544 // last one since we iterate over them in order. | 544 // last one since we iterate over them in order. |
| 545 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get())) | 545 if (AnimatableValue::usesDefaultInterpolation(to.get(), from.get())) |
| 546 return; | 546 return; |
| 547 | 547 |
| 548 KeyframeEffectModel::KeyframeVector keyframes; | 548 KeyframeEffectModel::KeyframeVector keyframes; |
| 549 | 549 |
| 550 RefPtrWillBeRawPtr<Keyframe> startKeyframe = Keyframe::create(); | 550 RefPtrWillBeRawPtr<Keyframe> startKeyframe = Keyframe::create(); |
| 551 startKeyframe->setPropertyValue(id, from.get()); | 551 startKeyframe->setPropertyValue(id, from.get()); |
| 552 startKeyframe->setOffset(0); | 552 startKeyframe->setOffset(0); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 CSSPropertyID id = convertToCSSPropertyID(i); | 890 CSSPropertyID id = convertToCSSPropertyID(i); |
| 891 if (isAnimatableProperty(id)) | 891 if (isAnimatableProperty(id)) |
| 892 properties.append(id); | 892 properties.append(id); |
| 893 } | 893 } |
| 894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); | 894 propertyShorthand = StylePropertyShorthand(CSSPropertyInvalid, propertie
s.begin(), properties.size()); |
| 895 } | 895 } |
| 896 return propertyShorthand; | 896 return propertyShorthand; |
| 897 } | 897 } |
| 898 | 898 |
| 899 } // namespace WebCore | 899 } // namespace WebCore |
| OLD | NEW |