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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 if (!isTransformRelatedCSSProperty(property)) | 190 if (!isTransformRelatedCSSProperty(property)) |
191 continue; | 191 continue; |
192 | 192 |
193 const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropert
ySpecificKeyframes(property); | 193 const PropertySpecificKeyframeVector& frames = keyframeEffect.getPropert
ySpecificKeyframes(property); |
194 if (frames.isEmpty() || frames.size() < 2) | 194 if (frames.isEmpty() || frames.size() < 2) |
195 continue; | 195 continue; |
196 | 196 |
197 FloatBox originalBox(box); | 197 FloatBox originalBox(box); |
198 | 198 |
199 for (size_t j = 0; j < frames.size() - 1; ++j) { | 199 for (size_t j = 0; j < frames.size() - 1; ++j) { |
200 const AnimatableTransform* startTransform = toAnimatableTransform(fr
ames[j]->getAnimatableValue().get()); | 200 const AnimatableTransform* startTransform = toAnimatableTransform(fr
ames[j]->getAnimatableValue()); |
201 const AnimatableTransform* endTransform = toAnimatableTransform(fram
es[j+1]->getAnimatableValue().get()); | 201 const AnimatableTransform* endTransform = toAnimatableTransform(fram
es[j+1]->getAnimatableValue()); |
202 if (!startTransform || !endTransform) | 202 if (!startTransform || !endTransform) |
203 return false; | 203 return false; |
204 | 204 |
205 // TODO: Add support for inflating modes other than Replace. | 205 // TODO: Add support for inflating modes other than Replace. |
206 if (frames[j]->composite() != EffectModel::CompositeReplace) | 206 if (frames[j]->composite() != EffectModel::CompositeReplace) |
207 return false; | 207 return false; |
208 | 208 |
209 const TimingFunction& timing = frames[j]->easing(); | 209 const TimingFunction& timing = frames[j]->easing(); |
210 double min = 0; | 210 double min = 0; |
211 double max = 1; | 211 double max = 1; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if ((keyframe->composite() != EffectModel::CompositeReplace && !isNe
utralKeyframe) || !keyframe->getAnimatableValue()) | 261 if ((keyframe->composite() != EffectModel::CompositeReplace && !isNe
utralKeyframe) || !keyframe->getAnimatableValue()) |
262 return false; | 262 return false; |
263 | 263 |
264 switch (property.cssProperty()) { | 264 switch (property.cssProperty()) { |
265 case CSSPropertyOpacity: | 265 case CSSPropertyOpacity: |
266 break; | 266 break; |
267 case CSSPropertyRotate: | 267 case CSSPropertyRotate: |
268 case CSSPropertyScale: | 268 case CSSPropertyScale: |
269 case CSSPropertyTranslate: | 269 case CSSPropertyTranslate: |
270 case CSSPropertyTransform: | 270 case CSSPropertyTransform: |
271 if (toAnimatableTransform(keyframe->getAnimatableValue().get())-
>transformOperations().dependsOnBoxSize()) | 271 if (toAnimatableTransform(keyframe->getAnimatableValue())->trans
formOperations().dependsOnBoxSize()) |
272 return false; | 272 return false; |
273 break; | 273 break; |
274 case CSSPropertyWebkitFilter: { | 274 case CSSPropertyWebkitFilter: { |
275 const FilterOperations& operations = toAnimatableFilterOperation
s(keyframe->getAnimatableValue().get())->operations(); | 275 const FilterOperations& operations = toAnimatableFilterOperation
s(keyframe->getAnimatableValue())->operations(); |
276 if (operations.hasFilterThatMovesPixels()) | 276 if (operations.hasFilterThatMovesPixels()) |
277 return false; | 277 return false; |
278 break; | 278 break; |
279 } | 279 } |
280 default: | 280 default: |
281 // any other types are not allowed to run on compositor. | 281 // any other types are not allowed to run on compositor. |
282 return false; | 282 return false; |
283 } | 283 } |
284 } | 284 } |
285 } | 285 } |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 auto* lastKeyframe = keyframes.last().get(); | 615 auto* lastKeyframe = keyframes.last().get(); |
616 for (const auto& keyframe : keyframes) { | 616 for (const auto& keyframe : keyframes) { |
617 const TimingFunction* keyframeTimingFunction = 0; | 617 const TimingFunction* keyframeTimingFunction = 0; |
618 if (keyframe != lastKeyframe) { // Ignore timing function of last frame. | 618 if (keyframe != lastKeyframe) { // Ignore timing function of last frame. |
619 keyframeTimingFunction = &keyframe->easing(); | 619 keyframeTimingFunction = &keyframe->easing(); |
620 } | 620 } |
621 | 621 |
622 // FIXME: This relies on StringKeyframes being eagerly evaluated, which
will | 622 // FIXME: This relies on StringKeyframes being eagerly evaluated, which
will |
623 // not happen eventually. Instead we should extract the CSSValue here | 623 // not happen eventually. Instead we should extract the CSSValue here |
624 // and convert using another set of toAnimatableXXXOperations functions. | 624 // and convert using another set of toAnimatableXXXOperations functions. |
625 const AnimatableValue* value = keyframe->getAnimatableValue().get(); | 625 const AnimatableValue* value = keyframe->getAnimatableValue(); |
626 | 626 |
627 switch (curve.type()) { | 627 switch (curve.type()) { |
628 case WebCompositorAnimationCurve::AnimationCurveTypeFilter: { | 628 case WebCompositorAnimationCurve::AnimationCurveTypeFilter: { |
629 OwnPtr<WebFilterOperations> ops = adoptPtr(Platform::current()->comp
ositorSupport()->createFilterOperations()); | 629 OwnPtr<WebFilterOperations> ops = adoptPtr(Platform::current()->comp
ositorSupport()->createFilterOperations()); |
630 toWebFilterOperations(toAnimatableFilterOperations(value)->operation
s(), ops.get()); | 630 toWebFilterOperations(toAnimatableFilterOperations(value)->operation
s(), ops.get()); |
631 | 631 |
632 WebFilterKeyframe filterKeyframe(keyframe->offset(), ops.release()); | 632 WebFilterKeyframe filterKeyframe(keyframe->offset(), ops.release()); |
633 WebFilterAnimationCurve* filterCurve = static_cast<WebFilterAnimatio
nCurve*>(&curve); | 633 WebFilterAnimationCurve* filterCurve = static_cast<WebFilterAnimatio
nCurve*>(&curve); |
634 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe
TimingFunction); | 634 addKeyframeWithTimingFunction(*filterCurve, filterKeyframe, keyframe
TimingFunction); |
635 break; | 635 break; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 break; | 747 break; |
748 default: | 748 default: |
749 ASSERT_NOT_REACHED(); | 749 ASSERT_NOT_REACHED(); |
750 } | 750 } |
751 animations.append(animation.release()); | 751 animations.append(animation.release()); |
752 } | 752 } |
753 ASSERT(!animations.isEmpty()); | 753 ASSERT(!animations.isEmpty()); |
754 } | 754 } |
755 | 755 |
756 } // namespace blink | 756 } // namespace blink |
OLD | NEW |