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

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 2846653002: cc : Stop pushing layers from hidden subtrees at commit
Patch Set: . Created 3 years, 7 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 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_impl.h" 5 #include "cc/trees/layer_tree_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 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 gfx::SizeF content_size = root_scroll_layer->BoundsForScrolling(); 1216 gfx::SizeF content_size = root_scroll_layer->BoundsForScrolling();
1217 content_size.SetToMax(root_container_layer->BoundsForScrolling()); 1217 content_size.SetToMax(root_container_layer->BoundsForScrolling());
1218 return content_size; 1218 return content_size;
1219 } 1219 }
1220 1220
1221 LayerImpl* LayerTreeImpl::LayerById(int id) const { 1221 LayerImpl* LayerTreeImpl::LayerById(int id) const {
1222 LayerImplMap::const_iterator iter = layer_id_map_.find(id); 1222 LayerImplMap::const_iterator iter = layer_id_map_.find(id);
1223 return iter != layer_id_map_.end() ? iter->second : nullptr; 1223 return iter != layer_id_map_.end() ? iter->second : nullptr;
1224 } 1224 }
1225 1225
1226 void LayerTreeImpl::SetSurfaceLayerIds(
1227 const std::vector<SurfaceId>& surface_layer_ids) {
1228 DCHECK(surface_layer_ids_.empty());
1229 surface_layer_ids_ = surface_layer_ids;
1230 }
1231
1232 const std::vector<SurfaceId>& LayerTreeImpl::SurfaceLayerIds() const {
1233 return surface_layer_ids_;
1234 }
1235
1236 void LayerTreeImpl::ClearSurfaceLayerIds() {
1237 surface_layer_ids_.clear();
1238 }
1239
1226 void LayerTreeImpl::AddLayerShouldPushProperties(LayerImpl* layer) { 1240 void LayerTreeImpl::AddLayerShouldPushProperties(LayerImpl* layer) {
1227 layers_that_should_push_properties_.insert(layer); 1241 layers_that_should_push_properties_.insert(layer);
1228 } 1242 }
1229 1243
1230 void LayerTreeImpl::RemoveLayerShouldPushProperties(LayerImpl* layer) { 1244 void LayerTreeImpl::RemoveLayerShouldPushProperties(LayerImpl* layer) {
1231 layers_that_should_push_properties_.erase(layer); 1245 layers_that_should_push_properties_.erase(layer);
1232 } 1246 }
1233 1247
1234 std::unordered_set<LayerImpl*>& 1248 std::unordered_set<LayerImpl*>&
1235 LayerTreeImpl::LayersThatShouldPushProperties() { 1249 LayerTreeImpl::LayersThatShouldPushProperties() {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1735 layer->set_needs_show_scrollbars(true); 1749 layer->set_needs_show_scrollbars(true);
1736 } 1750 }
1737 1751
1738 void LayerTreeImpl::UnregisterScrollLayer(LayerImpl* layer) { 1752 void LayerTreeImpl::UnregisterScrollLayer(LayerImpl* layer) {
1739 if (layer->scroll_clip_layer_id() == Layer::INVALID_ID) 1753 if (layer->scroll_clip_layer_id() == Layer::INVALID_ID)
1740 return; 1754 return;
1741 1755
1742 clip_scroll_map_.erase(layer->scroll_clip_layer_id()); 1756 clip_scroll_map_.erase(layer->scroll_clip_layer_id());
1743 } 1757 }
1744 1758
1745 void LayerTreeImpl::AddSurfaceLayer(LayerImpl* layer) {
1746 DCHECK(std::find(surface_layers_.begin(), surface_layers_.end(), layer) ==
1747 surface_layers_.end());
1748 surface_layers_.push_back(layer);
1749 }
1750
1751 void LayerTreeImpl::RemoveSurfaceLayer(LayerImpl* layer) {
1752 LayerImplList::iterator it =
1753 std::find(surface_layers_.begin(), surface_layers_.end(), layer);
1754 DCHECK(it != surface_layers_.end());
1755 surface_layers_.erase(it);
1756 }
1757
1758 static bool PointHitsRect( 1759 static bool PointHitsRect(
1759 const gfx::PointF& screen_space_point, 1760 const gfx::PointF& screen_space_point,
1760 const gfx::Transform& local_space_to_screen_space_transform, 1761 const gfx::Transform& local_space_to_screen_space_transform,
1761 const gfx::Rect& local_space_rect, 1762 const gfx::Rect& local_space_rect,
1762 float* distance_to_camera) { 1763 float* distance_to_camera) {
1763 // If the transform is not invertible, then assume that this point doesn't hit 1764 // If the transform is not invertible, then assume that this point doesn't hit
1764 // this rect. 1765 // this rect.
1765 gfx::Transform inverse_local_space_to_screen_space( 1766 gfx::Transform inverse_local_space_to_screen_space(
1766 gfx::Transform::kSkipInitialization); 1767 gfx::Transform::kSkipInitialization);
1767 if (!local_space_to_screen_space_transform.GetInverse( 1768 if (!local_space_to_screen_space_transform.GetInverse(
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 2123
2123 void LayerTreeImpl::ResetAllChangeTracking() { 2124 void LayerTreeImpl::ResetAllChangeTracking() {
2124 layers_that_should_push_properties_.clear(); 2125 layers_that_should_push_properties_.clear();
2125 // Iterate over all layers, including masks. 2126 // Iterate over all layers, including masks.
2126 for (auto& layer : *layers_) 2127 for (auto& layer : *layers_)
2127 layer->ResetChangeTracking(); 2128 layer->ResetChangeTracking();
2128 property_trees_.ResetAllChangeTracking(); 2129 property_trees_.ResetAllChangeTracking();
2129 } 2130 }
2130 2131
2131 } // namespace cc 2132 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698