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

Unified Diff: cc/layer_tree_impl.cc

Issue 12025031: Find root scroll layer at tree activation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/picture_layer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_impl.cc
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index 99ba2030a966873f35df2319664987071a75e35b..bfdcf50ca8c5e1b318472b3e6a5a390f99e4a012 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -70,6 +70,7 @@ scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() {
// Clear all data structures that have direct references to the layer tree.
scrolling_layer_id_from_previous_tree_ =
currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0;
+ root_scroll_layer_ = NULL;
currently_scrolling_layer_ = NULL;
render_surface_layer_list_.clear();
@@ -77,17 +78,27 @@ scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() {
return root_layer_.Pass();
}
+LayerImpl* LayerTreeImpl::RootScrollLayer() {
+ DCHECK(IsActiveTree());
+ return root_scroll_layer_;
+}
+
+LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() {
+ DCHECK(IsActiveTree());
+ return currently_scrolling_layer_;
+}
+
void LayerTreeImpl::ClearCurrentlyScrollingLayer() {
currently_scrolling_layer_ = NULL;
scrolling_layer_id_from_previous_tree_ = 0;
}
void LayerTreeImpl::UpdateMaxScrollOffset() {
- if (!root_scroll_layer() || !root_scroll_layer()->children().size())
+ if (!root_scroll_layer_ || !root_scroll_layer_->children().size())
return;
gfx::SizeF view_bounds = device_viewport_size();
- if (LayerImpl* clip_layer = root_scroll_layer()->parent()) {
+ if (LayerImpl* clip_layer = root_scroll_layer_->parent()) {
// Compensate for non-overlay scrollbars.
if (clip_layer->masksToBounds())
view_bounds = gfx::ScaleSize(clip_layer->bounds(), device_scale_factor());
@@ -113,7 +124,7 @@ void LayerTreeImpl::UpdateMaxScrollOffset() {
// having a vertical scrollbar but no horizontal overflow.
max_scroll.ClampToMin(gfx::Vector2dF());
- root_scroll_layer()->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll));
+ root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll));
}
void LayerTreeImpl::UpdateDrawProperties() {
@@ -121,8 +132,8 @@ void LayerTreeImpl::UpdateDrawProperties() {
if (!RootLayer())
return;
- if (root_scroll_layer()) {
- root_scroll_layer()->setImplTransform(
+ if (root_scroll_layer_) {
+ root_scroll_layer_->setImplTransform(
layer_tree_host_impl_->implTransform());
}
@@ -177,11 +188,9 @@ const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const {
}
gfx::Size LayerTreeImpl::ContentSize() const {
- // TODO(aelias): Hardcoding the first child here is weird. Think of
- // a cleaner way to get the contentBounds on the Impl side.
- if (!root_scroll_layer() || root_scroll_layer()->children().empty())
+ if (!root_scroll_layer_)
return gfx::Size();
- return root_scroll_layer()->children()[0]->contentBounds();
+ return root_scroll_layer_->bounds();
aelias_OOO_until_Jul13 2013/01/21 01:12:14 FYI, looks like this broke scrolling. I can rever
}
LayerImpl* LayerTreeImpl::LayerById(int id) {
@@ -214,6 +223,8 @@ static void DidBecomeActiveRecursive(LayerImpl* layer) {
void LayerTreeImpl::DidBecomeActive() {
if (RootLayer())
DidBecomeActiveRecursive(RootLayer());
+ FindRootScrollLayer();
+ UpdateMaxScrollOffset();
}
bool LayerTreeImpl::ContentsTexturesPurged() const {
« no previous file with comments | « cc/layer_tree_impl.h ('k') | cc/picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698