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

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

Issue 18202006: Make scrollable viewport size no longer depend on clip layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove DCHECK(IsActiveTree()) on RootScrollLayer Created 7 years, 5 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
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/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/scrollbar_animation_controller.h" 9 #include "cc/animation/scrollbar_animation_controller.h"
10 #include "cc/debug/traced_value.h" 10 #include "cc/debug/traced_value.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 129
130 if (hud_layer()) 130 if (hud_layer())
131 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>( 131 target_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(
132 LayerTreeHostCommon::FindLayerInSubtree( 132 LayerTreeHostCommon::FindLayerInSubtree(
133 target_tree->root_layer(), hud_layer()->id()))); 133 target_tree->root_layer(), hud_layer()->id())));
134 else 134 else
135 target_tree->set_hud_layer(NULL); 135 target_tree->set_hud_layer(NULL);
136 } 136 }
137 137
138 LayerImpl* LayerTreeImpl::RootScrollLayer() const { 138 LayerImpl* LayerTreeImpl::RootScrollLayer() const {
139 DCHECK(IsActiveTree());
140 return root_scroll_layer_; 139 return root_scroll_layer_;
141 } 140 }
142 141
143 LayerImpl* LayerTreeImpl::RootClipLayer() const { 142 LayerImpl* LayerTreeImpl::RootClipLayer() const {
144 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL; 143 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL;
145 } 144 }
146 145
147 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { 146 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const {
148 DCHECK(IsActiveTree()); 147 DCHECK(IsActiveTree());
149 return currently_scrolling_layer_; 148 return currently_scrolling_layer_;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 "CalcDrawProperties should not set_needs_update_draw_properties()"; 298 "CalcDrawProperties should not set_needs_update_draw_properties()";
300 } 299 }
301 300
302 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 301 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
303 // If this assert triggers, then the list is dirty. 302 // If this assert triggers, then the list is dirty.
304 DCHECK(!needs_update_draw_properties_); 303 DCHECK(!needs_update_draw_properties_);
305 return render_surface_layer_list_; 304 return render_surface_layer_list_;
306 } 305 }
307 306
308 gfx::Size LayerTreeImpl::ScrollableSize() const { 307 gfx::Size LayerTreeImpl::ScrollableSize() const {
309 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) 308 LayerImpl* root_scroll = RootScrollLayer();
309 if (!root_scroll || root_scroll->children().empty())
310 return gfx::Size(); 310 return gfx::Size();
311 return root_scroll_layer_->children()[0]->bounds(); 311 gfx::Size content_size = root_scroll->children()[0]->bounds();
312
313 // For the purposes of scrolling, non-overlay scrollbars are considered to
enne (OOO) 2013/07/12 17:19:27 This code looks a bit suspicious to me and I need
aelias_OOO_until_Jul13 2013/07/12 18:18:23 Note that this code is adding to the scrollable si
enne (OOO) 2013/07/12 18:30:27 I don't think the scroll layer size is at all rela
314 // occupy a placeholder area on the right and bottom of the document, instead
315 // of shrinking the viewport size.
316 ScrollbarLayerImpl* horiz = root_scroll->horizontal_scrollbar_layer();
317 ScrollbarLayerImpl* vertical = root_scroll->vertical_scrollbar_layer();
318 if (horiz && !horiz->is_overlay_scrollbar())
319 content_size.set_height(content_size.height() + horiz->thumb_thickness());
320 if (vertical && !vertical->is_overlay_scrollbar())
321 content_size.set_width(content_size.width() + vertical->thumb_thickness());
322
323 return content_size;
312 } 324 }
313 325
314 LayerImpl* LayerTreeImpl::LayerById(int id) { 326 LayerImpl* LayerTreeImpl::LayerById(int id) {
315 LayerIdMap::iterator iter = layer_id_map_.find(id); 327 LayerIdMap::iterator iter = layer_id_map_.find(id);
316 return iter != layer_id_map_.end() ? iter->second : NULL; 328 return iter != layer_id_map_.end() ? iter->second : NULL;
317 } 329 }
318 330
319 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { 331 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) {
320 DCHECK(!LayerById(layer->id())); 332 DCHECK(!LayerById(layer->id()));
321 layer_id_map_[layer->id()] = layer; 333 layer_id_map_[layer->id()] = layer;
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() 598 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest()
587 const { 599 const {
588 // Only the active tree needs to know about layers with copy requests, as 600 // Only the active tree needs to know about layers with copy requests, as
589 // they are aborted if not serviced during draw. 601 // they are aborted if not serviced during draw.
590 DCHECK(IsActiveTree()); 602 DCHECK(IsActiveTree());
591 603
592 return layers_with_copy_output_request_; 604 return layers_with_copy_output_request_;
593 } 605 }
594 606
595 } // namespace cc 607 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698