| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 reset_raster_scale_to_unknown(); | 108 reset_raster_scale_to_unknown(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 if (host && layer_animation_controller_->has_any_animation()) | 111 if (host && layer_animation_controller_->has_any_animation()) |
| 112 host->SetNeedsCommit(); | 112 host->SetNeedsCommit(); |
| 113 if (host && | 113 if (host && |
| 114 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_)) | 114 (!filters_.IsEmpty() || !background_filters_.IsEmpty() || filter_)) |
| 115 layer_tree_host_->set_needs_filter_context(); | 115 layer_tree_host_->set_needs_filter_context(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void Layer::SetNeedsUpdate() { |
| 119 if (layer_tree_host_) |
| 120 layer_tree_host_->SetNeedsUpdateLayers(); |
| 121 } |
| 122 |
| 118 void Layer::SetNeedsCommit() { | 123 void Layer::SetNeedsCommit() { |
| 119 if (ignore_set_needs_commit_) | 124 if (ignore_set_needs_commit_) |
| 120 return; | 125 return; |
| 121 if (layer_tree_host_) | 126 if (layer_tree_host_) |
| 122 layer_tree_host_->SetNeedsCommit(); | 127 layer_tree_host_->SetNeedsCommit(); |
| 123 } | 128 } |
| 124 | 129 |
| 125 void Layer::SetNeedsFullTreeSync() { | 130 void Layer::SetNeedsFullTreeSync() { |
| 126 if (layer_tree_host_) | 131 if (layer_tree_host_) |
| 127 layer_tree_host_->SetNeedsFullTreeSync(); | 132 layer_tree_host_->SetNeedsFullTreeSync(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { | 515 void Layer::SetScrollOffset(gfx::Vector2d scroll_offset) { |
| 511 DCHECK(IsPropertyChangeAllowed()); | 516 DCHECK(IsPropertyChangeAllowed()); |
| 512 if (scroll_offset_ == scroll_offset) | 517 if (scroll_offset_ == scroll_offset) |
| 513 return; | 518 return; |
| 514 scroll_offset_ = scroll_offset; | 519 scroll_offset_ = scroll_offset; |
| 515 SetNeedsCommit(); | 520 SetNeedsCommit(); |
| 516 } | 521 } |
| 517 | 522 |
| 518 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { | 523 void Layer::SetScrollOffsetFromImplSide(gfx::Vector2d scroll_offset) { |
| 519 DCHECK(IsPropertyChangeAllowed()); | 524 DCHECK(IsPropertyChangeAllowed()); |
| 525 // This function only gets called during a begin frame, so there |
| 526 // is no need to call SetNeedsUpdate here. |
| 520 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); | 527 DCHECK(layer_tree_host_ && layer_tree_host_->CommitRequested()); |
| 521 if (scroll_offset_ == scroll_offset) | 528 if (scroll_offset_ == scroll_offset) |
| 522 return; | 529 return; |
| 523 scroll_offset_ = scroll_offset; | 530 scroll_offset_ = scroll_offset; |
| 524 if (!did_scroll_callback_.is_null()) | 531 if (!did_scroll_callback_.is_null()) |
| 525 did_scroll_callback_.Run(); | 532 did_scroll_callback_.Run(); |
| 526 // Note: didScroll() could potentially change the layer structure. | 533 // Note: didScroll() could potentially change the layer structure. |
| 527 // "this" may have been destroyed during the process. | 534 // "this" may have been destroyed during the process. |
| 528 } | 535 } |
| 529 | 536 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 return; | 620 return; |
| 614 | 621 |
| 615 hide_layer_and_subtree_ = hide; | 622 hide_layer_and_subtree_ = hide; |
| 616 SetNeedsCommit(); | 623 SetNeedsCommit(); |
| 617 } | 624 } |
| 618 | 625 |
| 619 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { | 626 void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { |
| 620 update_rect_.Union(dirty_rect); | 627 update_rect_.Union(dirty_rect); |
| 621 needs_display_ = true; | 628 needs_display_ = true; |
| 622 | 629 |
| 623 // Simply mark the contents as dirty. For non-root layers, the call to | |
| 624 // SetNeedsCommit will schedule a fresh compositing pass. | |
| 625 // For the root layer, SetNeedsCommit has no effect. | |
| 626 if (DrawsContent() && !update_rect_.IsEmpty()) | 630 if (DrawsContent() && !update_rect_.IsEmpty()) |
| 627 SetNeedsCommit(); | 631 SetNeedsUpdate(); |
| 628 } | 632 } |
| 629 | 633 |
| 630 bool Layer::DescendantIsFixedToContainerLayer() const { | 634 bool Layer::DescendantIsFixedToContainerLayer() const { |
| 631 for (size_t i = 0; i < children_.size(); ++i) { | 635 for (size_t i = 0; i < children_.size(); ++i) { |
| 632 if (children_[i]->position_constraint_.is_fixed_position() || | 636 if (children_[i]->position_constraint_.is_fixed_position() || |
| 633 children_[i]->DescendantIsFixedToContainerLayer()) | 637 children_[i]->DescendantIsFixedToContainerLayer()) |
| 634 return true; | 638 return true; |
| 635 } | 639 } |
| 636 return false; | 640 return false; |
| 637 } | 641 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 901 |
| 898 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { | 902 RenderingStatsInstrumentation* Layer::rendering_stats_instrumentation() const { |
| 899 return layer_tree_host_->rendering_stats_instrumentation(); | 903 return layer_tree_host_->rendering_stats_instrumentation(); |
| 900 } | 904 } |
| 901 | 905 |
| 902 bool Layer::SupportsLCDText() const { | 906 bool Layer::SupportsLCDText() const { |
| 903 return false; | 907 return false; |
| 904 } | 908 } |
| 905 | 909 |
| 906 } // namespace cc | 910 } // namespace cc |
| OLD | NEW |