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

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

Issue 14221010: Make LayerTreeImpl::ScrollableArea more robust (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with a test. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | 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 "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/animation/animation.h" 8 #include "cc/animation/animation.h"
9 #include "cc/animation/animation_id_provider.h" 9 #include "cc/animation/animation_id_provider.h"
10 #include "cc/animation/keyframed_animation_curve.h" 10 #include "cc/animation/keyframed_animation_curve.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return true; 351 return true;
352 } 352 }
353 353
354 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 354 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
355 // If this assert triggers, then the list is dirty. 355 // If this assert triggers, then the list is dirty.
356 DCHECK(!needs_update_draw_properties_); 356 DCHECK(!needs_update_draw_properties_);
357 return render_surface_layer_list_; 357 return render_surface_layer_list_;
358 } 358 }
359 359
360 gfx::Size LayerTreeImpl::ScrollableSize() const { 360 gfx::Size LayerTreeImpl::ScrollableSize() const {
361 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) 361 if (!root_scroll_layer_)
362 return gfx::Size(); 362 return gfx::Size();
363 return root_scroll_layer_->children()[0]->bounds(); 363
364 gfx::Size scrollable_size;
365 for (size_t i = 0; i < root_scroll_layer_->children().size(); ++i)
366 scrollable_size.ClampToMin(root_scroll_layer_->children()[i]->bounds());
367
368 return scrollable_size;
364 } 369 }
365 370
366 LayerImpl* LayerTreeImpl::LayerById(int id) { 371 LayerImpl* LayerTreeImpl::LayerById(int id) {
367 LayerIdMap::iterator iter = layer_id_map_.find(id); 372 LayerIdMap::iterator iter = layer_id_map_.find(id);
368 return iter != layer_id_map_.end() ? iter->second : NULL; 373 return iter != layer_id_map_.end() ? iter->second : NULL;
369 } 374 }
370 375
371 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { 376 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) {
372 DCHECK(!LayerById(layer->id())); 377 DCHECK(!LayerById(layer->id()));
373 layer_id_map_[layer->id()] = layer; 378 layer_id_map_[layer->id()] = layer;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 gfx::Vector2dF original_viewport_size = 685 gfx::Vector2dF original_viewport_size =
681 gfx::RectF(root_clip->bounds()).bottom_right() - 686 gfx::RectF(root_clip->bounds()).bottom_right() -
682 gfx::PointF(); 687 gfx::PointF();
683 original_viewport_size.Scale(1 / page_scale_factor()); 688 original_viewport_size.Scale(1 / page_scale_factor());
684 689
685 root_scroll->SetFixedContainerSizeDelta( 690 root_scroll->SetFixedContainerSizeDelta(
686 scrollable_viewport_size - original_viewport_size); 691 scrollable_viewport_size - original_viewport_size);
687 } 692 }
688 693
689 } // namespace cc 694 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698