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

Side by Side Diff: Source/core/animation/CompositorAnimations.cpp

Issue 851693007: Prepare for responsive CSS animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address comments Created 5 years, 10 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 ASSERT(values.isEmpty()); 65 ASSERT(values.isEmpty());
66 66
67 for (const auto& keyframe : effect->getPropertySpecificKeyframes(id)) { 67 for (const auto& keyframe : effect->getPropertySpecificKeyframes(id)) {
68 double offset = keyframe->offset() * scale; 68 double offset = keyframe->offset() * scale;
69 values.append(keyframe->cloneWithOffset(offset)); 69 values.append(keyframe->cloneWithOffset(offset));
70 } 70 }
71 } 71 }
72 72
73 } 73 }
74 74
75 CSSPropertyID CompositorAnimations::CompositableProperties[3] = {
76 CSSPropertyOpacity, CSSPropertyTransform, CSSPropertyWebkitFilter
77 };
78
75 bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const Animation Effect& effect, double minValue, double maxValue) const 79 bool CompositorAnimations::getAnimatedBoundingBox(FloatBox& box, const Animation Effect& effect, double minValue, double maxValue) const
76 { 80 {
77 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef fect); 81 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef fect);
78 82
79 PropertySet properties = keyframeEffect.properties(); 83 PropertySet properties = keyframeEffect.properties();
80 84
81 if (properties.isEmpty()) 85 if (properties.isEmpty())
82 return true; 86 return true;
83 87
84 minValue = std::min(minValue, 0.0); 88 minValue = std::min(minValue, 0.0);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 PropertySet properties = keyframeEffect.properties(); 144 PropertySet properties = keyframeEffect.properties();
141 145
142 if (properties.isEmpty()) 146 if (properties.isEmpty())
143 return false; 147 return false;
144 148
145 for (const auto& property : properties) { 149 for (const auto& property : properties) {
146 const PropertySpecificKeyframeVector& keyframes = keyframeEffect.getProp ertySpecificKeyframes(property); 150 const PropertySpecificKeyframeVector& keyframes = keyframeEffect.getProp ertySpecificKeyframes(property);
147 ASSERT(keyframes.size() >= 2); 151 ASSERT(keyframes.size() >= 2);
148 for (const auto& keyframe : keyframes) { 152 for (const auto& keyframe : keyframes) {
149 // FIXME: Determine candidacy based on the CSSValue instead of a sna pshot AnimatableValue. 153 // FIXME: Determine candidacy based on the CSSValue instead of a sna pshot AnimatableValue.
150 if (keyframe->composite() != AnimationEffect::CompositeReplace || !k eyframe->getAnimatableValue()) 154 bool isNeutralKeyframe = keyframe->isStringPropertySpecificKeyframe( ) && !toStringPropertySpecificKeyframe(keyframe.get())->value() && keyframe->com posite() == AnimationEffect::CompositeAdd;
155 if ((keyframe->composite() != AnimationEffect::CompositeReplace && ! isNeutralKeyframe) || !keyframe->getAnimatableValue())
dstockwell 2015/02/05 23:04:52 When can getAnimatableValue() return null here?
shend 2015/02/06 03:16:25 Since we're using StringKeyframes, initially the a
151 return false; 156 return false;
152 157
153 switch (property) { 158 switch (property) {
154 case CSSPropertyOpacity: 159 case CSSPropertyOpacity:
155 break; 160 break;
156 case CSSPropertyTransform: 161 case CSSPropertyTransform:
157 if (toAnimatableTransform(keyframe->getAnimatableValue().get())- >transformOperations().dependsOnBoxSize()) 162 if (toAnimatableTransform(keyframe->getAnimatableValue().get())- >transformOperations().dependsOnBoxSize())
158 return false; 163 return false;
159 break; 164 break;
160 case CSSPropertyWebkitFilter: { 165 case CSSPropertyWebkitFilter: {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 break; 547 break;
543 default: 548 default:
544 ASSERT_NOT_REACHED(); 549 ASSERT_NOT_REACHED();
545 } 550 }
546 animations.append(animation.release()); 551 animations.append(animation.release());
547 } 552 }
548 ASSERT(!animations.isEmpty()); 553 ASSERT(!animations.isEmpty());
549 } 554 }
550 555
551 } // namespace blink 556 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698