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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2755803003: cc: Remove SetNeedsCommitNoRebuild from Layer API (Closed)
Patch Set: check for LTH Created 3 years, 9 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
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/surface_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 479
480 int LayerImpl::num_copy_requests_in_target_subtree() { 480 int LayerImpl::num_copy_requests_in_target_subtree() {
481 return GetEffectTree() 481 return GetEffectTree()
482 .Node(effect_tree_index()) 482 .Node(effect_tree_index())
483 ->num_copy_requests_in_subtree; 483 ->num_copy_requests_in_subtree;
484 } 484 }
485 485
486 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) { 486 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) {
487 if (TransformNode* node = 487 if (TransformNode* node =
488 GetTransformTree().FindNodeFromOwningLayerId(id())) { 488 GetTransformTree().UpdateNodeFromOwningLayerId(id())) {
489 // A LayerImpl's own current state is insufficient for determining whether 489 // A LayerImpl's own current state is insufficient for determining whether
490 // it owns a TransformNode, since this depends on the state of the 490 // it owns a TransformNode, since this depends on the state of the
491 // corresponding Layer at the time of the last commit. For example, if 491 // corresponding Layer at the time of the last commit. For example, if
492 // |is_animated| is false, this might mean a transform animation just ticked 492 // |is_animated| is false, this might mean a transform animation just ticked
493 // past its finish point (so the LayerImpl still owns a TransformNode) or it 493 // past its finish point (so the LayerImpl still owns a TransformNode) or it
494 // might mean that a transform animation was removed during commit or 494 // might mean that a transform animation was removed during commit or
495 // activation (and, in that case, the LayerImpl will no longer own a 495 // activation (and, in that case, the LayerImpl will no longer own a
496 // TransformNode, unless it has non-animation-related reasons for owning a 496 // TransformNode, unless it has non-animation-related reasons for owning a
497 // node). 497 // node).
498 if (node->has_potential_animation != is_animated) { 498 if (node->has_potential_animation != is_animated) {
(...skipping 21 matching lines...) Expand all
520 } 520 }
521 521
522 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const { 522 gfx::ScrollOffset LayerImpl::ScrollOffsetForAnimation() const {
523 return CurrentScrollOffset(); 523 return CurrentScrollOffset();
524 } 524 }
525 525
526 void LayerImpl::OnIsAnimatingChanged(const PropertyAnimationState& mask, 526 void LayerImpl::OnIsAnimatingChanged(const PropertyAnimationState& mask,
527 const PropertyAnimationState& state) { 527 const PropertyAnimationState& state) {
528 DCHECK(layer_tree_impl_); 528 DCHECK(layer_tree_impl_);
529 529
530 TransformNode* transform_node =
531 GetTransformTree().FindNodeFromOwningLayerId(id());
532 EffectNode* effect_node = GetEffectTree().FindNodeFromOwningLayerId(id());
533 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; 530 for (int property = TargetProperty::FIRST_TARGET_PROPERTY;
534 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { 531 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) {
532 if (!mask.currently_running[property] &&
533 !mask.potentially_animating[property])
534 continue;
535
535 switch (property) { 536 switch (property) {
536 case TargetProperty::TRANSFORM: 537 case TargetProperty::TRANSFORM:
537 if (transform_node) { 538 if (TransformNode* transform_node =
539 GetTransformTree().UpdateNodeFromOwningLayerId(id())) {
538 if (mask.currently_running[property]) 540 if (mask.currently_running[property])
539 transform_node->is_currently_animating = 541 transform_node->is_currently_animating =
540 state.currently_running[property]; 542 state.currently_running[property];
541 if (mask.potentially_animating[property]) { 543 if (mask.potentially_animating[property]) {
542 UpdatePropertyTreeTransformIsAnimated( 544 UpdatePropertyTreeTransformIsAnimated(
543 state.potentially_animating[property]); 545 state.potentially_animating[property]);
544 was_ever_ready_since_last_transform_animation_ = false; 546 was_ever_ready_since_last_transform_animation_ = false;
545 } 547 }
546 } 548 }
547 break; 549 break;
548 case TargetProperty::OPACITY: 550 case TargetProperty::OPACITY:
549 if (effect_node) { 551 if (EffectNode* effect_node =
552 GetEffectTree().UpdateNodeFromOwningLayerId(id())) {
550 if (mask.currently_running[property]) 553 if (mask.currently_running[property])
551 effect_node->is_currently_animating_opacity = 554 effect_node->is_currently_animating_opacity =
552 state.currently_running[property]; 555 state.currently_running[property];
553 if (mask.potentially_animating[property]) { 556 if (mask.potentially_animating[property]) {
554 effect_node->has_potential_opacity_animation = 557 effect_node->has_potential_opacity_animation =
555 state.potentially_animating[property]; 558 state.potentially_animating[property];
556 GetEffectTree().set_needs_update(true); 559 GetEffectTree().set_needs_update(true);
557 } 560 }
558 } 561 }
559 break; 562 break;
560 case TargetProperty::FILTER: 563 case TargetProperty::FILTER:
561 if (effect_node) { 564 if (EffectNode* effect_node =
565 GetEffectTree().UpdateNodeFromOwningLayerId(id())) {
562 if (mask.currently_running[property]) 566 if (mask.currently_running[property])
563 effect_node->is_currently_animating_filter = 567 effect_node->is_currently_animating_filter =
564 state.currently_running[property]; 568 state.currently_running[property];
565 if (mask.potentially_animating[property]) 569 if (mask.potentially_animating[property])
566 effect_node->has_potential_filter_animation = 570 effect_node->has_potential_filter_animation =
567 state.potentially_animating[property]; 571 state.potentially_animating[property];
568 } 572 }
569 break; 573 break;
570 default: 574 default:
571 break; 575 break;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 property_trees->SetInnerViewportContainerBoundsDelta(bounds_delta); 615 property_trees->SetInnerViewportContainerBoundsDelta(bounds_delta);
612 else if (this == layer_tree_impl()->OuterViewportContainerLayer()) 616 else if (this == layer_tree_impl()->OuterViewportContainerLayer())
613 property_trees->SetOuterViewportContainerBoundsDelta(bounds_delta); 617 property_trees->SetOuterViewportContainerBoundsDelta(bounds_delta);
614 else if (this == layer_tree_impl()->InnerViewportScrollLayer()) 618 else if (this == layer_tree_impl()->InnerViewportScrollLayer())
615 property_trees->SetInnerViewportScrollBoundsDelta(bounds_delta); 619 property_trees->SetInnerViewportScrollBoundsDelta(bounds_delta);
616 620
617 layer_tree_impl()->DidUpdateScrollState(id()); 621 layer_tree_impl()->DidUpdateScrollState(id());
618 622
619 if (masks_to_bounds()) { 623 if (masks_to_bounds()) {
620 // If layer is clipping, then update the clip node using the new bounds. 624 // If layer is clipping, then update the clip node using the new bounds.
621 ClipNode* clip_node = property_trees->clip_tree.Node(clip_tree_index()); 625 if (ClipNode* clip_node =
622 if (clip_node) { 626 property_trees->clip_tree.UpdateNodeFromOwningLayerId(id())) {
623 DCHECK_EQ(clip_node, GetClipTree().FindNodeFromOwningLayerId(id())); 627 DCHECK_EQ(clip_node->id, clip_tree_index());
624 clip_node->clip = gfx::RectF(gfx::PointF() + offset_to_transform_parent(), 628 clip_node->clip = gfx::RectF(gfx::PointF() + offset_to_transform_parent(),
625 gfx::SizeF(bounds())); 629 gfx::SizeF(bounds()));
626 property_trees->clip_tree.set_needs_update(true); 630 property_trees->clip_tree.set_needs_update(true);
627 } 631 }
628 property_trees->full_tree_damaged = true; 632 property_trees->full_tree_damaged = true;
629 layer_tree_impl()->set_needs_update_draw_properties(); 633 layer_tree_impl()->set_needs_update_draw_properties();
630 } else { 634 } else {
631 NoteLayerPropertyChanged(); 635 NoteLayerPropertyChanged();
632 } 636 }
633 } 637 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 681
678 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { 682 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) {
679 masks_to_bounds_ = masks_to_bounds; 683 masks_to_bounds_ = masks_to_bounds;
680 } 684 }
681 685
682 void LayerImpl::SetContentsOpaque(bool opaque) { 686 void LayerImpl::SetContentsOpaque(bool opaque) {
683 contents_opaque_ = opaque; 687 contents_opaque_ = opaque;
684 } 688 }
685 689
686 float LayerImpl::Opacity() const { 690 float LayerImpl::Opacity() const {
687 if (EffectNode* node = GetEffectTree().FindNodeFromOwningLayerId(id())) 691 if (const EffectNode* node = GetEffectTree().FindNodeFromOwningLayerId(id()))
688 return node->opacity; 692 return node->opacity;
689 else 693 else
690 return 1.f; 694 return 1.f;
691 } 695 }
692 696
693 const gfx::Transform& LayerImpl::Transform() const { 697 const gfx::Transform& LayerImpl::Transform() const {
694 DCHECK_NE(GetTransformTree().FindNodeFromOwningLayerId(id()), nullptr); 698 DCHECK_NE(GetTransformTree().FindNodeFromOwningLayerId(id()), nullptr);
695 return GetTransformTree().FindNodeFromOwningLayerId(id())->local; 699 return GetTransformTree().FindNodeFromOwningLayerId(id())->local;
696 } 700 }
697 701
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1058
1055 ScrollTree& LayerImpl::GetScrollTree() const { 1059 ScrollTree& LayerImpl::GetScrollTree() const {
1056 return GetPropertyTrees()->scroll_tree; 1060 return GetPropertyTrees()->scroll_tree;
1057 } 1061 }
1058 1062
1059 TransformTree& LayerImpl::GetTransformTree() const { 1063 TransformTree& LayerImpl::GetTransformTree() const {
1060 return GetPropertyTrees()->transform_tree; 1064 return GetPropertyTrees()->transform_tree;
1061 } 1065 }
1062 1066
1063 } // namespace cc 1067 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/surface_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698