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

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

Issue 1973083002: Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get element id's from scroll node data directly. Created 4 years, 6 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 19 matching lines...) Expand all
30 30
31 #include "core/animation/CompositorAnimations.h" 31 #include "core/animation/CompositorAnimations.h"
32 32
33 #include "core/animation/AnimationEffect.h" 33 #include "core/animation/AnimationEffect.h"
34 #include "core/animation/CompositorAnimationsImpl.h" 34 #include "core/animation/CompositorAnimationsImpl.h"
35 #include "core/animation/ElementAnimations.h" 35 #include "core/animation/ElementAnimations.h"
36 #include "core/animation/animatable/AnimatableDouble.h" 36 #include "core/animation/animatable/AnimatableDouble.h"
37 #include "core/animation/animatable/AnimatableFilterOperations.h" 37 #include "core/animation/animatable/AnimatableFilterOperations.h"
38 #include "core/animation/animatable/AnimatableTransform.h" 38 #include "core/animation/animatable/AnimatableTransform.h"
39 #include "core/animation/animatable/AnimatableValue.h" 39 #include "core/animation/animatable/AnimatableValue.h"
40 #include "core/dom/DOMNodeIds.h"
40 #include "core/layout/LayoutBoxModelObject.h" 41 #include "core/layout/LayoutBoxModelObject.h"
41 #include "core/layout/LayoutObject.h" 42 #include "core/layout/LayoutObject.h"
42 #include "core/layout/compositing/CompositedLayerMapping.h" 43 #include "core/layout/compositing/CompositedLayerMapping.h"
43 #include "core/paint/PaintLayer.h" 44 #include "core/paint/PaintLayer.h"
44 #include "platform/RuntimeEnabledFeatures.h" 45 #include "platform/RuntimeEnabledFeatures.h"
45 #include "platform/animation/AnimationTranslationUtil.h" 46 #include "platform/animation/AnimationTranslationUtil.h"
46 #include "platform/animation/CompositorAnimation.h" 47 #include "platform/animation/CompositorAnimation.h"
47 #include "platform/animation/CompositorAnimationPlayer.h" 48 #include "platform/animation/CompositorAnimationPlayer.h"
48 #include "platform/animation/CompositorFilterAnimationCurve.h" 49 #include "platform/animation/CompositorFilterAnimationCurve.h"
49 #include "platform/animation/CompositorFilterKeyframe.h" 50 #include "platform/animation/CompositorFilterKeyframe.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 384
384 if (!canStartAnimationOnCompositor(element)) { 385 if (!canStartAnimationOnCompositor(element)) {
385 ASSERT_NOT_REACHED(); 386 ASSERT_NOT_REACHED();
386 return; 387 return;
387 } 388 }
388 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); 389 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
389 ASSERT(compositorPlayer); 390 ASSERT(compositorPlayer);
390 compositorPlayer->pauseAnimation(id, pauseTime); 391 compositorPlayer->pauseAnimation(id, pauseTime);
391 } 392 }
392 393
393 bool CompositorAnimations::canAttachCompositedLayers(const Element& element, con st Animation& animation) 394 void CompositorAnimations::attachCompositedLayers(Element& element, const Animat ion& animation)
394 { 395 {
395 if (!animation.compositorPlayer()) 396 if (!animation.compositorPlayer())
396 return false; 397 return;
397
398 if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
399 return false;
400
401 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
402
403 if (!layer || !layer->isAllowedToQueryCompositingState()
404 || !layer->compositedLayerMapping()
405 || !layer->compositedLayerMapping()->mainGraphicsLayer())
406 return false;
407
408 if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer())
409 return false;
410
411 return true;
412 }
413
414 void CompositorAnimations::attachCompositedLayers(const Element& element, const Animation& animation)
415 {
416 ASSERT(element.layoutObject());
417
418 PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
419 ASSERT(layer);
420 398
421 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer(); 399 CompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
422 ASSERT(compositorPlayer); 400 compositorPlayer->attachElement(CompositorElementId(DOMNodeIds::idForNode(&e lement)));
Ian Vollick 2016/06/01 18:08:26 By not pulling from cc, we are able to simplify th
423
424 ASSERT(layer->compositedLayerMapping());
425 compositorPlayer->attachLayer(layer->compositedLayerMapping()->mainGraphicsL ayer()->platformLayer());
426 } 401 }
427 402
428 // ----------------------------------------------------------------------- 403 // -----------------------------------------------------------------------
429 // CompositorAnimationsImpl 404 // CompositorAnimationsImpl
430 // ----------------------------------------------------------------------- 405 // -----------------------------------------------------------------------
431 406
432 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double animationPlaybackRate) 407 bool CompositorAnimationsImpl::convertTimingForCompositor(const Timing& timing, double timeOffset, CompositorTiming& out, double animationPlaybackRate)
433 { 408 {
434 timing.assertValid(); 409 timing.assertValid();
435 410
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 break; 648 break;
674 default: 649 default:
675 ASSERT_NOT_REACHED(); 650 ASSERT_NOT_REACHED();
676 } 651 }
677 animations.append(std::move(animation)); 652 animations.append(std::move(animation));
678 } 653 }
679 ASSERT(!animations.isEmpty()); 654 ASSERT(!animations.isEmpty());
680 } 655 }
681 656
682 } // namespace blink 657 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698