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/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 min_page_scale_factor_(0), | 89 min_page_scale_factor_(0), |
90 max_page_scale_factor_(0), | 90 max_page_scale_factor_(0), |
91 scrolling_layer_id_from_previous_tree_(0), | 91 scrolling_layer_id_from_previous_tree_(0), |
92 contents_textures_purged_(false), | 92 contents_textures_purged_(false), |
93 viewport_size_invalid_(false), | 93 viewport_size_invalid_(false), |
94 needs_update_draw_properties_(true), | 94 needs_update_draw_properties_(true), |
95 needs_full_tree_sync_(true), | 95 needs_full_tree_sync_(true), |
96 next_activation_forces_redraw_(false), | 96 next_activation_forces_redraw_(false), |
97 has_ever_been_drawn_(false), | 97 has_ever_been_drawn_(false), |
98 render_surface_layer_list_id_(0), | 98 render_surface_layer_list_id_(0), |
99 top_controls_layout_height_(0), | 99 top_controls_shrink_blink_size_(false), |
| 100 top_controls_height_(0), |
100 top_controls_content_offset_(0), | 101 top_controls_content_offset_(0), |
101 top_controls_delta_(0), | 102 top_controls_delta_(0), |
102 sent_top_controls_delta_(0) { | 103 sent_top_controls_delta_(0) { |
103 } | 104 } |
104 | 105 |
105 LayerTreeImpl::~LayerTreeImpl() { | 106 LayerTreeImpl::~LayerTreeImpl() { |
106 BreakSwapPromises(SwapPromise::SWAP_FAILS); | 107 BreakSwapPromises(SwapPromise::SWAP_FAILS); |
107 | 108 |
108 // Need to explicitly clear the tree prior to destroying this so that | 109 // Need to explicitly clear the tree prior to destroying this so that |
109 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 110 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // The request queue should have been processed and does not require a push. | 203 // The request queue should have been processed and does not require a push. |
203 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 204 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
204 | 205 |
205 if (next_activation_forces_redraw_) { | 206 if (next_activation_forces_redraw_) { |
206 target_tree->ForceRedrawNextActivation(); | 207 target_tree->ForceRedrawNextActivation(); |
207 next_activation_forces_redraw_ = false; | 208 next_activation_forces_redraw_ = false; |
208 } | 209 } |
209 | 210 |
210 target_tree->PassSwapPromises(&swap_promise_list_); | 211 target_tree->PassSwapPromises(&swap_promise_list_); |
211 | 212 |
212 target_tree->top_controls_layout_height_ = top_controls_layout_height_; | 213 // Track the change in top controls height to offset the top_controls_delta |
| 214 // properly. This is so that the top controls offset will be maintained |
| 215 // across height changes. |
| 216 float top_controls_height_delta = |
| 217 target_tree->top_controls_height_ - top_controls_height_; |
| 218 |
| 219 target_tree->top_controls_shrink_blink_size_ = |
| 220 top_controls_shrink_blink_size_; |
| 221 target_tree->top_controls_height_ = top_controls_height_; |
213 target_tree->top_controls_content_offset_ = top_controls_content_offset_; | 222 target_tree->top_controls_content_offset_ = top_controls_content_offset_; |
214 target_tree->top_controls_delta_ = | 223 target_tree->top_controls_delta_ = target_tree->top_controls_delta_ - |
215 target_tree->top_controls_delta_ - | 224 target_tree->sent_top_controls_delta_ - |
216 target_tree->sent_top_controls_delta_; | 225 top_controls_height_delta; |
217 target_tree->sent_top_controls_delta_ = 0.f; | 226 target_tree->sent_top_controls_delta_ = 0.f; |
218 | 227 |
219 target_tree->SetPageScaleValues( | 228 target_tree->SetPageScaleValues( |
220 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor(), | 229 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor(), |
221 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); | 230 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); |
222 target_tree->set_sent_page_scale_delta(1); | 231 target_tree->set_sent_page_scale_delta(1); |
223 | 232 |
224 target_tree->pending_page_scale_animation_ = | 233 target_tree->pending_page_scale_animation_ = |
225 pending_page_scale_animation_.Pass(); | 234 pending_page_scale_animation_.Pass(); |
226 | 235 |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 scoped_ptr<PendingPageScaleAnimation> pending_animation) { | 1497 scoped_ptr<PendingPageScaleAnimation> pending_animation) { |
1489 pending_page_scale_animation_ = pending_animation.Pass(); | 1498 pending_page_scale_animation_ = pending_animation.Pass(); |
1490 } | 1499 } |
1491 | 1500 |
1492 scoped_ptr<PendingPageScaleAnimation> | 1501 scoped_ptr<PendingPageScaleAnimation> |
1493 LayerTreeImpl::TakePendingPageScaleAnimation() { | 1502 LayerTreeImpl::TakePendingPageScaleAnimation() { |
1494 return pending_page_scale_animation_.Pass(); | 1503 return pending_page_scale_animation_.Pass(); |
1495 } | 1504 } |
1496 | 1505 |
1497 } // namespace cc | 1506 } // namespace cc |
OLD | NEW |