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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
438 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer(); | 438 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer(); |
439 DCHECK(compositor_player); | 439 DCHECK(compositor_player); |
440 compositor_player->PauseAnimation(id, pause_time); | 440 compositor_player->PauseAnimation(id, pause_time); |
441 } | 441 } |
442 | 442 |
443 void CompositorAnimations::AttachCompositedLayers(Element& element, | 443 void CompositorAnimations::AttachCompositedLayers(Element& element, |
444 const Animation& animation) { | 444 const Animation& animation) { |
445 if (!animation.CompositorPlayer()) | 445 if (!animation.CompositorPlayer()) |
446 return; | 446 return; |
447 | 447 |
448 if (!element.GetLayoutObject() || | 448 if (!element.GetLayoutObject() || |
wkorman
2017/05/18 00:45:58
nit: consider local var for element.GetLayoutObjec
| |
449 !element.GetLayoutObject()->IsBoxModelObject()) | 449 !element.GetLayoutObject()->IsBoxModelObject() || |
450 !element.GetLayoutObject()->HasLayer()) | |
450 return; | 451 return; |
451 | 452 |
453 PaintLayer* layer = | |
454 ToLayoutBoxModelObject(element.GetLayoutObject())->Layer(); | |
455 | |
452 // Composited animations do not depend on a composited layer mapping for SPv2. | 456 // Composited animations do not depend on a composited layer mapping for SPv2. |
453 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 457 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
454 PaintLayer* layer = | 458 if (!layer->IsAllowedToQueryCompositingState() || |
455 ToLayoutBoxModelObject(element.GetLayoutObject())->Layer(); | |
456 | |
457 if (!layer || !layer->IsAllowedToQueryCompositingState() || | |
458 !layer->GetCompositedLayerMapping() || | 459 !layer->GetCompositedLayerMapping() || |
459 !layer->GetCompositedLayerMapping()->MainGraphicsLayer()) | 460 !layer->GetCompositedLayerMapping()->MainGraphicsLayer()) |
460 return; | 461 return; |
461 | 462 |
462 if (!layer->GetCompositedLayerMapping() | 463 if (!layer->GetCompositedLayerMapping() |
463 ->MainGraphicsLayer() | 464 ->MainGraphicsLayer() |
464 ->PlatformLayer()) | 465 ->PlatformLayer()) |
465 return; | 466 return; |
466 } | 467 } |
467 | 468 |
468 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer(); | 469 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer(); |
469 compositor_player->AttachElement(CompositorElementIdFromDOMNodeId( | 470 compositor_player->AttachElement(CompositorElementIdFromPaintLayerId( |
470 DOMNodeIds::IdForNode(&element), CompositorElementIdNamespace::kPrimary)); | 471 layer->UniqueId(), CompositorElementIdNamespace::kPrimary)); |
471 } | 472 } |
472 | 473 |
473 bool CompositorAnimations::ConvertTimingForCompositor( | 474 bool CompositorAnimations::ConvertTimingForCompositor( |
474 const Timing& timing, | 475 const Timing& timing, |
475 double time_offset, | 476 double time_offset, |
476 CompositorTiming& out, | 477 CompositorTiming& out, |
477 double animation_playback_rate) { | 478 double animation_playback_rate) { |
478 timing.AssertValid(); | 479 timing.AssertValid(); |
479 | 480 |
480 // FIXME: Compositor does not know anything about endDelay. | 481 // FIXME: Compositor does not know anything about endDelay. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
647 animation->SetTimeOffset(compositor_timing.scaled_time_offset); | 648 animation->SetTimeOffset(compositor_timing.scaled_time_offset); |
648 animation->SetDirection(compositor_timing.direction); | 649 animation->SetDirection(compositor_timing.direction); |
649 animation->SetPlaybackRate(compositor_timing.playback_rate); | 650 animation->SetPlaybackRate(compositor_timing.playback_rate); |
650 animation->SetFillMode(compositor_timing.fill_mode); | 651 animation->SetFillMode(compositor_timing.fill_mode); |
651 animations.push_back(std::move(animation)); | 652 animations.push_back(std::move(animation)); |
652 } | 653 } |
653 DCHECK(!animations.IsEmpty()); | 654 DCHECK(!animations.IsEmpty()); |
654 } | 655 } |
655 | 656 |
656 } // namespace blink | 657 } // namespace blink |
OLD | NEW |