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

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

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 if (!canStartAnimationOnCompositor(element)) { 385 if (!canStartAnimationOnCompositor(element)) {
386 ASSERT_NOT_REACHED(); 386 ASSERT_NOT_REACHED();
387 return; 387 return;
388 } 388 }
389 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); 389 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
390 ASSERT(compositorPlayer); 390 ASSERT(compositorPlayer);
391 compositorPlayer->pauseAnimation(id, pauseTime); 391 compositorPlayer->pauseAnimation(id, pauseTime);
392 } 392 }
393 393
394 bool CompositorAnimations::canAttachCompositedLayers(const Element& element, con st Animation& animation)
395 {
396 if (!animation.compositorPlayer())
397 return false;
398
399 if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
400 return false;
401
402 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
403
404 if (!layer || !layer->isAllowedToQueryCompositingState()
405 || !layer->compositedLayerMapping()
406 || !layer->compositedLayerMapping()->mainGraphicsLayer())
407 return false;
408
409 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer())
410 return false;
411
412 return true;
413 }
414
415 void CompositorAnimations::attachCompositedLayers(const Element& element, const Animation& animation)
416 {
417 ASSERT(element.layoutObject());
418
419 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
420 ASSERT(layer);
421
422 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
423 ASSERT(compositorPlayer);
424
425 ASSERT(layer->compositedLayerMapping());
426 compositorPlayer->attachLayer(layer->compositedLayerMapping()->mainGraphicsL ayer()->platformLayer());
427 }
428
429 // ----------------------------------------------------------------------- 394 // -----------------------------------------------------------------------
430 // CompositorAnimationsImpl 395 // CompositorAnimationsImpl
431 // ----------------------------------------------------------------------- 396 // -----------------------------------------------------------------------
432 397
433 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double animationPlaybackRate) 398 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double animationPlaybackRate)
434 { 399 {
435 timing.assertValid(); 400 timing.assertValid();
436 401
437 // FIXME: Compositor does not know anything about endDelay. 402 // FIXME: Compositor does not know anything about endDelay.
438 if (timing.endDelay != 0) 403 if (timing.endDelay != 0)
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 break; 708 break;
744 default: 709 default:
745 ASSERT_NOT_REACHED(); 710 ASSERT_NOT_REACHED();
746 } 711 }
747 animations.append(animation.release()); 712 animations.append(animation.release());
748 } 713 }
749 ASSERT(!animations.isEmpty()); 714 ASSERT(!animations.isEmpty());
750 } 715 }
751 716
752 } // namespace blink 717 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698