Chromium Code Reviews| 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/heads_up_display_layer_impl.h" | 8 #include "cc/heads_up_display_layer_impl.h" |
| 9 #include "cc/layer_tree_host_common.h" | 9 #include "cc/layer_tree_host_common.h" |
| 10 #include "cc/layer_tree_host_impl.h" | 10 #include "cc/layer_tree_host_impl.h" |
| 11 #include "cc/scrollbar_animation_controller.h" | |
| 11 #include "cc/scrollbar_layer_impl.h" | 12 #include "cc/scrollbar_layer_impl.h" |
| 12 #include "ui/gfx/size_conversions.h" | 13 #include "ui/gfx/size_conversions.h" |
| 13 #include "ui/gfx/vector2d_conversions.h" | 14 #include "ui/gfx/vector2d_conversions.h" |
| 14 | 15 |
| 15 namespace cc { | 16 namespace cc { |
| 16 | 17 |
| 17 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 18 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
| 18 : layer_tree_host_impl_(layer_tree_host_impl), | 19 : layer_tree_host_impl_(layer_tree_host_impl), |
| 19 source_frame_number_(-1), | 20 source_frame_number_(-1), |
| 20 hud_layer_(0), | 21 hud_layer_(0), |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 128 |
| 128 LayerImpl* LayerTreeImpl::RootClipLayer() const { | 129 LayerImpl* LayerTreeImpl::RootClipLayer() const { |
| 129 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL; | 130 return root_scroll_layer_ ? root_scroll_layer_->parent() : NULL; |
| 130 } | 131 } |
| 131 | 132 |
| 132 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { | 133 LayerImpl* LayerTreeImpl::CurrentlyScrollingLayer() const { |
| 133 DCHECK(IsActiveTree()); | 134 DCHECK(IsActiveTree()); |
| 134 return currently_scrolling_layer_; | 135 return currently_scrolling_layer_; |
| 135 } | 136 } |
| 136 | 137 |
| 138 void LayerTreeImpl::SetCurrentlyScrollingLayer(LayerImpl* layer) { | |
| 139 if (currently_scrolling_layer_ == layer) | |
| 140 return; | |
| 141 | |
| 142 if (currently_scrolling_layer_ && currently_scrolling_layer_->scrollbar_animat ion_controller()) | |
|
jamesr
2013/03/18 01:09:55
80col
| |
| 143 currently_scrolling_layer_->scrollbar_animation_controller()->didScrollGestu reEnd(base::TimeTicks::Now()); | |
|
jamesr
2013/03/18 01:09:55
80col
| |
| 144 currently_scrolling_layer_ = layer; | |
| 145 if (layer && layer->scrollbar_animation_controller()) | |
| 146 layer->scrollbar_animation_controller()->didScrollGestureBegin(); | |
| 147 } | |
| 148 | |
| 137 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { | 149 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { |
| 138 currently_scrolling_layer_ = NULL; | 150 SetCurrentlyScrollingLayer(NULL); |
| 139 scrolling_layer_id_from_previous_tree_ = 0; | 151 scrolling_layer_id_from_previous_tree_ = 0; |
| 140 } | 152 } |
| 141 | 153 |
| 142 void LayerTreeImpl::SetPageScaleFactorAndLimits(float page_scale_factor, | 154 void LayerTreeImpl::SetPageScaleFactorAndLimits(float page_scale_factor, |
| 143 float min_page_scale_factor, float max_page_scale_factor) | 155 float min_page_scale_factor, float max_page_scale_factor) |
| 144 { | 156 { |
| 145 if (!page_scale_factor) | 157 if (!page_scale_factor) |
| 146 return; | 158 return; |
| 147 | 159 |
| 148 min_page_scale_factor_ = min_page_scale_factor; | 160 min_page_scale_factor_ = min_page_scale_factor; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 347 layer_id_map_[layer->id()] = layer; | 359 layer_id_map_[layer->id()] = layer; |
| 348 } | 360 } |
| 349 | 361 |
| 350 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { | 362 void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) { |
| 351 DCHECK(LayerById(layer->id())); | 363 DCHECK(LayerById(layer->id())); |
| 352 layer_id_map_.erase(layer->id()); | 364 layer_id_map_.erase(layer->id()); |
| 353 } | 365 } |
| 354 | 366 |
| 355 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) { | 367 void LayerTreeImpl::PushPersistedState(LayerTreeImpl* pendingTree) { |
| 356 int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; | 368 int id = currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
| 357 pendingTree->set_currently_scrolling_layer( | 369 pendingTree->SetCurrentlyScrollingLayer( |
| 358 LayerTreeHostCommon::findLayerInSubtree(pendingTree->root_layer(), id)); | 370 LayerTreeHostCommon::findLayerInSubtree(pendingTree->root_layer(), id)); |
| 359 } | 371 } |
| 360 | 372 |
| 361 static void DidBecomeActiveRecursive(LayerImpl* layer) { | 373 static void DidBecomeActiveRecursive(LayerImpl* layer) { |
| 362 layer->DidBecomeActive(); | 374 layer->DidBecomeActive(); |
| 363 for (size_t i = 0; i < layer->children().size(); ++i) | 375 for (size_t i = 0; i < layer->children().size(); ++i) |
| 364 DidBecomeActiveRecursive(layer->children()[i]); | 376 DidBecomeActiveRecursive(layer->children()[i]); |
| 365 } | 377 } |
| 366 | 378 |
| 367 void LayerTreeImpl::DidBecomeActive() { | 379 void LayerTreeImpl::DidBecomeActive() { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 515 for (LayerIteratorType it = LayerIteratorType::begin( | 527 for (LayerIteratorType it = LayerIteratorType::begin( |
| 516 &render_surface_layer_list_); it != end; ++it) { | 528 &render_surface_layer_list_); it != end; ++it) { |
| 517 if (!it.representsItself()) | 529 if (!it.representsItself()) |
| 518 continue; | 530 continue; |
| 519 state->Append((*it)->AsValue().release()); | 531 state->Append((*it)->AsValue().release()); |
| 520 } | 532 } |
| 521 return state.PassAs<base::Value>(); | 533 return state.PassAs<base::Value>(); |
| 522 } | 534 } |
| 523 | 535 |
| 524 } // namespace cc | 536 } // namespace cc |
| OLD | NEW |