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

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

Issue 1862623003: cc: Use scroll layer bounds as scrollable area size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 return gfx::SizeF(); 718 return gfx::SizeF();
719 719
720 return gfx::ScaleSize(InnerViewportContainerLayer()->BoundsForScrolling(), 720 return gfx::ScaleSize(InnerViewportContainerLayer()->BoundsForScrolling(),
721 1.0f / current_page_scale_factor()); 721 1.0f / current_page_scale_factor());
722 } 722 }
723 723
724 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const { 724 gfx::Rect LayerTreeImpl::RootScrollLayerDeviceViewportBounds() const {
725 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() 725 LayerImpl* root_scroll_layer = OuterViewportScrollLayer()
726 ? OuterViewportScrollLayer() 726 ? OuterViewportScrollLayer()
727 : InnerViewportScrollLayer(); 727 : InnerViewportScrollLayer();
728 if (!root_scroll_layer || root_scroll_layer->children().empty()) 728 if (!root_scroll_layer)
729 return gfx::Rect(); 729 return gfx::Rect();
730 LayerImpl* layer = root_scroll_layer->children()[0]; 730 return MathUtil::MapEnclosingClippedRect(
731 return MathUtil::MapEnclosingClippedRect(layer->ScreenSpaceTransform(), 731 root_scroll_layer->ScreenSpaceTransform(),
732 gfx::Rect(layer->bounds())); 732 gfx::Rect(root_scroll_layer->bounds()));
733 } 733 }
734 734
735 void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() { 735 void LayerTreeImpl::ApplySentScrollAndScaleDeltasFromAbortedCommit() {
736 DCHECK(IsActiveTree()); 736 DCHECK(IsActiveTree());
737 737
738 page_scale_factor()->AbortCommit(); 738 page_scale_factor()->AbortCommit();
739 top_controls_shown_ratio()->AbortCommit(); 739 top_controls_shown_ratio()->AbortCommit();
740 elastic_overscroll()->AbortCommit(); 740 elastic_overscroll()->AbortCommit();
741 741
742 if (!root_layer()) 742 if (!root_layer())
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 // If this assert triggers, then the render_surface_layer_list_ is dirty, so 981 // If this assert triggers, then the render_surface_layer_list_ is dirty, so
982 // the unoccluded_screen_space_region_ is not valid anymore. 982 // the unoccluded_screen_space_region_ is not valid anymore.
983 DCHECK(!needs_update_draw_properties_); 983 DCHECK(!needs_update_draw_properties_);
984 return unoccluded_screen_space_region_; 984 return unoccluded_screen_space_region_;
985 } 985 }
986 986
987 gfx::SizeF LayerTreeImpl::ScrollableSize() const { 987 gfx::SizeF LayerTreeImpl::ScrollableSize() const {
988 LayerImpl* root_scroll_layer = OuterViewportScrollLayer() 988 LayerImpl* root_scroll_layer = OuterViewportScrollLayer()
989 ? OuterViewportScrollLayer() 989 ? OuterViewportScrollLayer()
990 : InnerViewportScrollLayer(); 990 : InnerViewportScrollLayer();
991 if (!root_scroll_layer || root_scroll_layer->children().empty()) 991 if (!root_scroll_layer)
992 return gfx::SizeF(); 992 return gfx::SizeF();
993 993
994 gfx::SizeF content_size = 994 gfx::SizeF content_size = root_scroll_layer->BoundsForScrolling();
995 root_scroll_layer->children()[0]->BoundsForScrolling();
996 gfx::SizeF viewport_size = 995 gfx::SizeF viewport_size =
997 root_scroll_layer->scroll_clip_layer()->BoundsForScrolling(); 996 root_scroll_layer->scroll_clip_layer()->BoundsForScrolling();
998 997
999 content_size.SetToMax(viewport_size); 998 content_size.SetToMax(viewport_size);
1000 return content_size; 999 return content_size;
1001 } 1000 }
1002 1001
1003 LayerImpl* LayerTreeImpl::LayerById(int id) const { 1002 LayerImpl* LayerTreeImpl::LayerById(int id) const {
1004 LayerImplMap::const_iterator iter = layer_id_map_.find(id); 1003 LayerImplMap::const_iterator iter = layer_id_map_.find(id);
1005 return iter != layer_id_map_.end() ? iter->second : NULL; 1004 return iter != layer_id_map_.end() ? iter->second : NULL;
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 } 2093 }
2095 2094
2096 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) { 2095 void LayerTreeImpl::ResetAllChangeTracking(PropertyTrees::ResetFlags flag) {
2097 layers_that_should_push_properties_.clear(); 2096 layers_that_should_push_properties_.clear();
2098 for (auto* layer : *this) 2097 for (auto* layer : *this)
2099 layer->ResetChangeTracking(); 2098 layer->ResetChangeTracking();
2100 property_trees_.ResetAllChangeTracking(flag); 2099 property_trees_.ResetAllChangeTracking(flag);
2101 } 2100 }
2102 2101
2103 } // namespace cc 2102 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698