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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 #include "core/animation/ActiveAnimations.h" | 34 #include "core/animation/ActiveAnimations.h" |
35 #include "core/animation/AnimationNode.h" | 35 #include "core/animation/AnimationNode.h" |
36 #include "core/animation/AnimationTranslationUtil.h" | 36 #include "core/animation/AnimationTranslationUtil.h" |
37 #include "core/animation/CompositorAnimationsImpl.h" | 37 #include "core/animation/CompositorAnimationsImpl.h" |
38 #include "core/animation/animatable/AnimatableDouble.h" | 38 #include "core/animation/animatable/AnimatableDouble.h" |
39 #include "core/animation/animatable/AnimatableFilterOperations.h" | 39 #include "core/animation/animatable/AnimatableFilterOperations.h" |
40 #include "core/animation/animatable/AnimatableTransform.h" | 40 #include "core/animation/animatable/AnimatableTransform.h" |
41 #include "core/animation/animatable/AnimatableValue.h" | 41 #include "core/animation/animatable/AnimatableValue.h" |
42 #include "core/layout/Layer.h" | 42 #include "core/layout/Layer.h" |
| 43 #include "core/layout/LayoutBoxModelObject.h" |
43 #include "core/layout/LayoutObject.h" | 44 #include "core/layout/LayoutObject.h" |
44 #include "core/layout/compositing/CompositedLayerMapping.h" | 45 #include "core/layout/compositing/CompositedLayerMapping.h" |
45 #include "core/rendering/RenderBoxModelObject.h" | |
46 #include "platform/geometry/FloatBox.h" | 46 #include "platform/geometry/FloatBox.h" |
47 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
48 #include "public/platform/WebCompositorAnimation.h" | 48 #include "public/platform/WebCompositorAnimation.h" |
49 #include "public/platform/WebCompositorSupport.h" | 49 #include "public/platform/WebCompositorSupport.h" |
50 #include "public/platform/WebFilterAnimationCurve.h" | 50 #include "public/platform/WebFilterAnimationCurve.h" |
51 #include "public/platform/WebFilterKeyframe.h" | 51 #include "public/platform/WebFilterKeyframe.h" |
52 #include "public/platform/WebFloatAnimationCurve.h" | 52 #include "public/platform/WebFloatAnimationCurve.h" |
53 #include "public/platform/WebFloatKeyframe.h" | 53 #include "public/platform/WebFloatKeyframe.h" |
54 #include "public/platform/WebTransformAnimationCurve.h" | 54 #include "public/platform/WebTransformAnimationCurve.h" |
55 #include "public/platform/WebTransformKeyframe.h" | 55 #include "public/platform/WebTransformKeyframe.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 | 262 |
263 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in
t group, double startTime, double timeOffset, const Timing& timing, const Animat
ionPlayer* player, const AnimationEffect& effect, Vector<int>& startedAnimationI
ds, double playerPlaybackRate) | 263 bool CompositorAnimations::startAnimationOnCompositor(const Element& element, in
t group, double startTime, double timeOffset, const Timing& timing, const Animat
ionPlayer* player, const AnimationEffect& effect, Vector<int>& startedAnimationI
ds, double playerPlaybackRate) |
264 { | 264 { |
265 ASSERT(startedAnimationIds.isEmpty()); | 265 ASSERT(startedAnimationIds.isEmpty()); |
266 ASSERT(isCandidateForAnimationOnCompositor(timing, element, player, effect,
playerPlaybackRate)); | 266 ASSERT(isCandidateForAnimationOnCompositor(timing, element, player, effect,
playerPlaybackRate)); |
267 ASSERT(canStartAnimationOnCompositor(element)); | 267 ASSERT(canStartAnimationOnCompositor(element)); |
268 | 268 |
269 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef
fect); | 269 const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(ef
fect); |
270 | 270 |
271 Layer* layer = toRenderBoxModelObject(element.renderer())->layer(); | 271 Layer* layer = toLayoutBoxModelObject(element.renderer())->layer(); |
272 ASSERT(layer); | 272 ASSERT(layer); |
273 | 273 |
274 Vector<OwnPtr<WebCompositorAnimation>> animations; | 274 Vector<OwnPtr<WebCompositorAnimation>> animations; |
275 CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime,
timeOffset, keyframeEffect, animations, playerPlaybackRate); | 275 CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime,
timeOffset, keyframeEffect, animations, playerPlaybackRate); |
276 ASSERT(!animations.isEmpty()); | 276 ASSERT(!animations.isEmpty()); |
277 for (auto& animation : animations) { | 277 for (auto& animation : animations) { |
278 int id = animation->id(); | 278 int id = animation->id(); |
279 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(
animation.release())) { | 279 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(
animation.release())) { |
280 // FIXME: We should know ahead of time whether these animations can
be started. | 280 // FIXME: We should know ahead of time whether these animations can
be started. |
281 for (int startedAnimationId : startedAnimationIds) | 281 for (int startedAnimationId : startedAnimationIds) |
(...skipping 10 matching lines...) Expand all Loading... |
292 void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, i
nt id) | 292 void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, i
nt id) |
293 { | 293 { |
294 if (!canStartAnimationOnCompositor(element)) { | 294 if (!canStartAnimationOnCompositor(element)) { |
295 // When an element is being detached, we cancel any associated | 295 // When an element is being detached, we cancel any associated |
296 // AnimationPlayers for CSS animations. But by the time we get | 296 // AnimationPlayers for CSS animations. But by the time we get |
297 // here the mapping will have been removed. | 297 // here the mapping will have been removed. |
298 // FIXME: Defer remove/pause operations until after the | 298 // FIXME: Defer remove/pause operations until after the |
299 // compositing update. | 299 // compositing update. |
300 return; | 300 return; |
301 } | 301 } |
302 toRenderBoxModelObject(element.renderer())->layer()->compositedLayerMapping(
)->mainGraphicsLayer()->removeAnimation(id); | 302 toLayoutBoxModelObject(element.renderer())->layer()->compositedLayerMapping(
)->mainGraphicsLayer()->removeAnimation(id); |
303 } | 303 } |
304 | 304 |
305 void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
lement, int id, double pauseTime) | 305 void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& e
lement, int id, double pauseTime) |
306 { | 306 { |
307 // FIXME: canStartAnimationOnCompositor queries compositingState, which is n
ot necessarily up to date. | 307 // FIXME: canStartAnimationOnCompositor queries compositingState, which is n
ot necessarily up to date. |
308 // https://code.google.com/p/chromium/issues/detail?id=339847 | 308 // https://code.google.com/p/chromium/issues/detail?id=339847 |
309 DisableCompositingQueryAsserts disabler; | 309 DisableCompositingQueryAsserts disabler; |
310 | 310 |
311 if (!canStartAnimationOnCompositor(element)) { | 311 if (!canStartAnimationOnCompositor(element)) { |
312 ASSERT_NOT_REACHED(); | 312 ASSERT_NOT_REACHED(); |
313 return; | 313 return; |
314 } | 314 } |
315 toRenderBoxModelObject(element.renderer())->layer()->compositedLayerMapping(
)->mainGraphicsLayer()->pauseAnimation(id, pauseTime); | 315 toLayoutBoxModelObject(element.renderer())->layer()->compositedLayerMapping(
)->mainGraphicsLayer()->pauseAnimation(id, pauseTime); |
316 } | 316 } |
317 | 317 |
318 // ----------------------------------------------------------------------- | 318 // ----------------------------------------------------------------------- |
319 // CompositorAnimationsImpl | 319 // CompositorAnimationsImpl |
320 // ----------------------------------------------------------------------- | 320 // ----------------------------------------------------------------------- |
321 | 321 |
322 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing,
double timeOffset, CompositorTiming& out, double playerPlaybackRate) | 322 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing,
double timeOffset, CompositorTiming& out, double playerPlaybackRate) |
323 { | 323 { |
324 timing.assertValid(); | 324 timing.assertValid(); |
325 | 325 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 break; | 621 break; |
622 default: | 622 default: |
623 ASSERT_NOT_REACHED(); | 623 ASSERT_NOT_REACHED(); |
624 } | 624 } |
625 animations.append(animation.release()); | 625 animations.append(animation.release()); |
626 } | 626 } |
627 ASSERT(!animations.isEmpty()); | 627 ASSERT(!animations.isEmpty()); |
628 } | 628 } |
629 | 629 |
630 } // namespace blink | 630 } // namespace blink |
OLD | NEW |