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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 if (property.cssProperty() != CSSPropertyTransform) | 145 if (property.cssProperty() != CSSPropertyTransform) |
146 continue; | 146 continue; |
147 | 147 |
148 const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropert
ySpecificKeyframes(property); | 148 const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropert
ySpecificKeyframes(property); |
149 if (frames.isEmpty() || frames.size() < 2) | 149 if (frames.isEmpty() || frames.size() < 2) |
150 continue; | 150 continue; |
151 | 151 |
152 FloatBox originalBox(box); | 152 FloatBox originalBox(box); |
153 | 153 |
154 for (size_t j = 0; j < frames.size() - 1; ++j) { | 154 for (size_t j = 0; j < frames.size() - 1; ++j) { |
155 const AnimatableTransform* startTransform = toAnimatableTransform(fr
ames[j]->getAnimatableValue().get()); | 155 const AnimatableTransform* startTransform = toAnimatableTransform(fr
ames[j]->getAnimatableValue()); |
156 const AnimatableTransform* endTransform = toAnimatableTransform(fram
es[j+1]->getAnimatableValue().get()); | 156 const AnimatableTransform* endTransform = toAnimatableTransform(fram
es[j+1]->getAnimatableValue()); |
157 if (!startTransform || !endTransform) | 157 if (!startTransform || !endTransform) |
158 return false; | 158 return false; |
159 | 159 |
160 // TODO: Add support for inflating modes other than Replace. | 160 // TODO: Add support for inflating modes other than Replace. |
161 if (frames[j]->composite() != EffectModel::CompositeReplace) | 161 if (frames[j]->composite() != EffectModel::CompositeReplace) |
162 return false; | 162 return false; |
163 | 163 |
164 const TimingFunction& timing = frames[j]->easing(); | 164 const TimingFunction& timing = frames[j]->easing(); |
165 double min = 0; | 165 double min = 0; |
166 double max = 1; | 166 double max = 1; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 for (const auto& keyframe : keyframes) { | 209 for (const auto& keyframe : keyframes) { |
210 // FIXME: Determine candidacy based on the CSSValue instead of a sna
pshot AnimatableValue. | 210 // FIXME: Determine candidacy based on the CSSValue instead of a sna
pshot AnimatableValue. |
211 bool isNeutralKeyframe = keyframe->isCSSPropertySpecificKeyframe() &
& !toCSSPropertySpecificKeyframe(keyframe.get())->value() && keyframe->composite
() == EffectModel::CompositeAdd; | 211 bool isNeutralKeyframe = keyframe->isCSSPropertySpecificKeyframe() &
& !toCSSPropertySpecificKeyframe(keyframe.get())->value() && keyframe->composite
() == EffectModel::CompositeAdd; |
212 if ((keyframe->composite() != EffectModel::CompositeReplace && !isNe
utralKeyframe) || !keyframe->getAnimatableValue()) | 212 if ((keyframe->composite() != EffectModel::CompositeReplace && !isNe
utralKeyframe) || !keyframe->getAnimatableValue()) |
213 return false; | 213 return false; |
214 | 214 |
215 switch (property.cssProperty()) { | 215 switch (property.cssProperty()) { |
216 case CSSPropertyOpacity: | 216 case CSSPropertyOpacity: |
217 break; | 217 break; |
218 case CSSPropertyTransform: | 218 case CSSPropertyTransform: |
219 if (toAnimatableTransform(keyframe->getAnimatableValue().get())-
>transformOperations().dependsOnBoxSize()) | 219 if (toAnimatableTransform(keyframe->getAnimatableValue())->trans
formOperations().dependsOnBoxSize()) |
220 return false; | 220 return false; |
221 break; | 221 break; |
222 case CSSPropertyWebkitFilter: { | 222 case CSSPropertyWebkitFilter: { |
223 const FilterOperations& operations = toAnimatableFilterOperation
s(keyframe->getAnimatableValue().get())->operations(); | 223 const FilterOperations& operations = toAnimatableFilterOperation
s(keyframe->getAnimatableValue())->operations(); |
224 if (operations.hasFilterThatMovesPixels()) | 224 if (operations.hasFilterThatMovesPixels()) |
225 return false; | 225 return false; |
226 break; | 226 break; |
227 } | 227 } |
228 default: | 228 default: |
229 // any other types are not allowed to run on compositor. | 229 // any other types are not allowed to run on compositor. |
230 return false; | 230 return false; |
231 } | 231 } |
232 } | 232 } |
233 } | 233 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 auto* lastKeyframe = keyframes.last().get(); | 557 auto* lastKeyframe = keyframes.last().get(); |
558 for (const auto& keyframe : keyframes) { | 558 for (const auto& keyframe : keyframes) { |
559 const TimingFunction* keyframeTimingFunction = 0; | 559 const TimingFunction* keyframeTimingFunction = 0; |
560 if (keyframe != lastKeyframe) { // Ignore timing function of last frame. | 560 if (keyframe != lastKeyframe) { // Ignore timing function of last frame. |
561 keyframeTimingFunction = &keyframe->easing(); | 561 keyframeTimingFunction = &keyframe->easing(); |
562 } | 562 } |
563 | 563 |
564 // FIXME: This relies on StringKeyframes being eagerly evaluated, which
will | 564 // FIXME: This relies on StringKeyframes being eagerly evaluated, which
will |
565 // not happen eventually. Instead we should extract the CSSValue here | 565 // not happen eventually. Instead we should extract the CSSValue here |
566 // and convert using another set of toAnimatableXXXOperations functions. | 566 // and convert using another set of toAnimatableXXXOperations functions. |
567 const AnimatableValue* value = keyframe->getAnimatableValue().get(); | 567 const AnimatableValue* value = keyframe->getAnimatableValue(); |
568 | 568 |
569 switch (curve.type()) { | 569 switch (curve.type()) { |
570 case WebCompositorAnimationCurve::AnimationCurveTypeFilter: { | 570 case WebCompositorAnimationCurve::AnimationCurveTypeFilter: { |
571 OwnPtr<WebFilterOperations> ops = adoptPtr(Platform::current()->comp
ositorSupport()->createFilterOperations()); | 571 OwnPtr<WebFilterOperations> ops = adoptPtr(Platform::current()->comp
ositorSupport()->createFilterOperations()); |
572 toWebFilterOperations(toAnimatableFilterOperations(value)->operation
s(), ops.get()); | 572 toWebFilterOperations(toAnimatableFilterOperations(value)->operation
s(), ops.get()); |
573 | 573 |
574 WebFilterKeyframe filterKeyframe(keyframe->offset(), ops.release()); | 574 WebFilterKeyframe filterKeyframe(keyframe->offset(), ops.release()); |
575 WebFilterAnimationCurve* filterCurve = static_cast<WebFilterAnimatio
nCurve*>(&curve); | 575 WebFilterAnimationCurve* filterCurve = static_cast<WebFilterAnimatio
nCurve*>(&curve); |
576 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe
TimingFunction); | 576 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe
TimingFunction); |
577 break; | 577 break; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 break; | 686 break; |
687 default: | 687 default: |
688 ASSERT_NOT_REACHED(); | 688 ASSERT_NOT_REACHED(); |
689 } | 689 } |
690 animations.append(animation.release()); | 690 animations.append(animation.release()); |
691 } | 691 } |
692 ASSERT(!animations.isEmpty()); | 692 ASSERT(!animations.isEmpty()); |
693 } | 693 } |
694 | 694 |
695 } // namespace blink | 695 } // namespace blink |
OLD | NEW |