OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 void Layer::SetHideLayerAndSubtree(bool hide) { | 656 void Layer::SetHideLayerAndSubtree(bool hide) { |
657 DCHECK(IsPropertyChangeAllowed()); | 657 DCHECK(IsPropertyChangeAllowed()); |
658 if (hide_layer_and_subtree_ == hide) | 658 if (hide_layer_and_subtree_ == hide) |
659 return; | 659 return; |
660 | 660 |
661 hide_layer_and_subtree_ = hide; | 661 hide_layer_and_subtree_ = hide; |
662 SetNeedsCommit(); | 662 SetNeedsCommit(); |
663 } | 663 } |
664 | 664 |
665 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { | 665 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { |
| 666 if (dirty_rect.IsEmpty()) |
| 667 return; |
| 668 |
666 update_rect_.Union(dirty_rect); | 669 update_rect_.Union(dirty_rect); |
667 needs_display_ = true; | 670 needs_display_ = true; |
668 | 671 |
669 // Simply mark the contents as dirty. For non-root layers, the call to | 672 if (DrawsContent()) |
670 // SetNeedsCommit will schedule a fresh compositing pass. | |
671 // For the root layer, SetNeedsCommit has no effect. | |
672 if (DrawsContent() && !update_rect_.IsEmpty()) | |
673 SetNeedsCommit(); | 673 SetNeedsCommit(); |
674 } | 674 } |
675 | 675 |
676 bool Layer::DescendantIsFixedToContainerLayer() const { | 676 bool Layer::DescendantIsFixedToContainerLayer() const { |
677 for (size_t i = 0; i < children_.size(); ++i) { | 677 for (size_t i = 0; i < children_.size(); ++i) { |
678 if (children_[i]->position_constraint_.is_fixed_position() || | 678 if (children_[i]->position_constraint_.is_fixed_position() || |
679 children_[i]->DescendantIsFixedToContainerLayer()) | 679 children_[i]->DescendantIsFixedToContainerLayer()) |
680 return true; | 680 return true; |
681 } | 681 } |
682 return false; | 682 return false; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 | 948 |
949 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 949 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
950 return layer_tree_host_->rendering_stats_instrumentation(); | 950 return layer_tree_host_->rendering_stats_instrumentation(); |
951 } | 951 } |
952 | 952 |
953 bool Layer::SupportsLCDText() const { | 953 bool Layer::SupportsLCDText() const { |
954 return false; | 954 return false; |
955 } | 955 } |
956 | 956 |
957 } // namespace cc | 957 } // namespace cc |
OLD | NEW |