OLD | NEW |
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/layer_tree_impl.h" | 5 #include "cc/layer_tree_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
9 #include "cc/layer_tree_host_impl.h" | 9 #include "cc/layer_tree_host_impl.h" |
10 #include "ui/gfx/vector2d_conversions.h" | 10 #include "ui/gfx/vector2d_conversions.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 return true; | 181 return true; |
182 } | 182 } |
183 | 183 |
184 const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { | 184 const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { |
185 // If this assert triggers, then the list is dirty. | 185 // If this assert triggers, then the list is dirty. |
186 DCHECK(!layer_tree_host_impl_->needsUpdateDrawProperties()); | 186 DCHECK(!layer_tree_host_impl_->needsUpdateDrawProperties()); |
187 return render_surface_layer_list_; | 187 return render_surface_layer_list_; |
188 } | 188 } |
189 | 189 |
190 gfx::Size LayerTreeImpl::ContentSize() const { | 190 gfx::Size LayerTreeImpl::ContentSize() const { |
191 if (!root_scroll_layer_) | 191 if (!root_scroll_layer_ || root_scroll_layer_->children().empty()) |
192 return gfx::Size(); | 192 return gfx::Size(); |
193 return root_scroll_layer_->bounds(); | 193 return root_scroll_layer_->children()[0]->bounds(); |
194 } | 194 } |
195 | 195 |
196 LayerImpl* LayerTreeImpl::LayerById(int id) { | 196 LayerImpl* LayerTreeImpl::LayerById(int id) { |
197 LayerIdMap::iterator iter = layer_id_map_.find(id); | 197 LayerIdMap::iterator iter = layer_id_map_.find(id); |
198 return iter != layer_id_map_.end() ? iter->second : NULL; | 198 return iter != layer_id_map_.end() ? iter->second : NULL; |
199 } | 199 } |
200 | 200 |
201 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { | 201 void LayerTreeImpl::RegisterLayer(LayerImpl* layer) { |
202 DCHECK(!LayerById(layer->id())); | 202 DCHECK(!LayerById(layer->id())); |
203 layer_id_map_[layer->id()] = layer; | 203 layer_id_map_[layer->id()] = layer; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 330 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
331 return layer_tree_host_impl_->animationRegistrar(); | 331 return layer_tree_host_impl_->animationRegistrar(); |
332 } | 332 } |
333 | 333 |
334 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { | 334 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { |
335 return layer_tree_host_impl_->pinchZoomViewport(); | 335 return layer_tree_host_impl_->pinchZoomViewport(); |
336 } | 336 } |
337 | 337 |
338 } // namespace cc | 338 } // namespace cc |
OLD | NEW |