| 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 "cc/layer_tree_host_common.h" | 7 #include "cc/layer_tree_host_common.h" |
| 8 #include "cc/layer_tree_host_impl.h" | 8 #include "cc/layer_tree_host_impl.h" |
| 9 #include "cc/pinch_zoom_scrollbars_manager.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 13 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
| 13 : layer_tree_host_impl_(layer_tree_host_impl) | 14 : layer_tree_host_impl_(layer_tree_host_impl) |
| 14 , source_frame_number_(-1) | 15 , source_frame_number_(-1) |
| 15 , hud_layer_(0) | 16 , hud_layer_(0) |
| 17 , pinch_zoom_scrollbar_vertical_(0) |
| 18 , pinch_zoom_scrollbar_horizontal_(0) |
| 16 , root_scroll_layer_(0) | 19 , root_scroll_layer_(0) |
| 17 , currently_scrolling_layer_(0) | 20 , currently_scrolling_layer_(0) |
| 18 , scrolling_layer_id_from_previous_tree_(0) { | 21 , scrolling_layer_id_from_previous_tree_(0) { |
| 22 if (settings().pageScalePinchZoomEnabled) |
| 23 pinch_zoom_scrollbars_ = PinchZoomScrollbarsManager::create(); |
| 19 } | 24 } |
| 20 | 25 |
| 21 LayerTreeImpl::~LayerTreeImpl() { | 26 LayerTreeImpl::~LayerTreeImpl() { |
| 22 } | 27 } |
| 23 | 28 |
| 24 static LayerImpl* findRootScrollLayer(LayerImpl* layer) | 29 static LayerImpl* findRootScrollLayer(LayerImpl* layer) |
| 25 { | 30 { |
| 26 if (!layer) | 31 if (!layer) |
| 27 return 0; | 32 return 0; |
| 28 | 33 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 47 currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree( | 52 currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree( |
| 48 root_layer_.get(), | 53 root_layer_.get(), |
| 49 scrolling_layer_id_from_previous_tree_); | 54 scrolling_layer_id_from_previous_tree_); |
| 50 } | 55 } |
| 51 | 56 |
| 52 scrolling_layer_id_from_previous_tree_ = 0; | 57 scrolling_layer_id_from_previous_tree_ = 0; |
| 53 | 58 |
| 54 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); | 59 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 55 } | 60 } |
| 56 | 61 |
| 62 void LayerTreeImpl::set_pinch_zoom_scrollbar_vertical(ScrollbarLayerImpl* layer_
impl) |
| 63 { |
| 64 pinch_zoom_scrollbar_vertical_ = layer_impl; |
| 65 if (pinch_zoom_scrollbars_) |
| 66 pinch_zoom_scrollbars_->setScrollbarVertical(layer_impl); |
| 67 } |
| 68 |
| 69 void LayerTreeImpl::set_pinch_zoom_scrollbar_horizontal(ScrollbarLayerImpl* laye
r_impl) |
| 70 { |
| 71 pinch_zoom_scrollbar_horizontal_ = layer_impl; |
| 72 if (pinch_zoom_scrollbars_) |
| 73 pinch_zoom_scrollbars_->setScrollbarHorizontal(layer_impl); |
| 74 } |
| 75 |
| 57 scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { | 76 scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { |
| 58 // Clear all data structures that have direct references to the layer tree. | 77 // Clear all data structures that have direct references to the layer tree. |
| 59 scrolling_layer_id_from_previous_tree_ = | 78 scrolling_layer_id_from_previous_tree_ = |
| 60 currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; | 79 currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
| 61 currently_scrolling_layer_ = NULL; | 80 currently_scrolling_layer_ = NULL; |
| 62 | 81 |
| 63 return root_layer_.Pass(); | 82 return root_layer_.Pass(); |
| 64 } | 83 } |
| 65 | 84 |
| 66 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { | 85 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 std::string LayerTreeImpl::layer_tree_as_text() const { | 134 std::string LayerTreeImpl::layer_tree_as_text() const { |
| 116 return layer_tree_host_impl_->layerTreeAsText(); | 135 return layer_tree_host_impl_->layerTreeAsText(); |
| 117 } | 136 } |
| 118 | 137 |
| 119 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { | 138 DebugRectHistory* LayerTreeImpl::debug_rect_history() const { |
| 120 return layer_tree_host_impl_->debugRectHistory(); | 139 return layer_tree_host_impl_->debugRectHistory(); |
| 121 } | 140 } |
| 122 | 141 |
| 123 | 142 |
| 124 } // namespace cc | 143 } // namespace cc |
| OLD | NEW |