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 "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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 } | 104 } |
105 | 105 |
106 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { | 106 void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) { |
107 // The request queue should have been processed and does not require a push. | 107 // The request queue should have been processed and does not require a push. |
108 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); | 108 DCHECK_EQ(ui_resource_request_queue_.size(), 0u); |
109 | 109 |
110 target_tree->SetLatencyInfo(latency_info_); | 110 target_tree->SetLatencyInfo(latency_info_); |
111 latency_info_.Clear(); | 111 latency_info_.Clear(); |
112 target_tree->SetPageScaleFactorAndLimits( | 112 target_tree->SetPageScaleFactorAndLimits( |
113 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); | 113 page_scale_factor(), min_page_scale_factor(), max_page_scale_factor()); |
114 target_tree->SetPageScaleDelta( | 114 target_tree->SetPageScaleDelta(page_scale_delta()); |
115 target_tree->page_scale_delta() / target_tree->sent_page_scale_delta()); | 115 target_tree->set_sent_page_scale_delta(sent_page_scale_delta()); |
enne (OOO)
2013/08/06 23:35:16
If you're going to change this code, can you DCHEC
| |
116 target_tree->set_sent_page_scale_delta(1); | |
117 | 116 |
118 // This should match the property synchronization in | 117 // This should match the property synchronization in |
119 // LayerTreeHost::finishCommitOnImplThread(). | 118 // LayerTreeHost::finishCommitOnImplThread(). |
120 target_tree->set_source_frame_number(source_frame_number()); | 119 target_tree->set_source_frame_number(source_frame_number()); |
121 target_tree->set_background_color(background_color()); | 120 target_tree->set_background_color(background_color()); |
122 target_tree->set_has_transparent_background(has_transparent_background()); | 121 target_tree->set_has_transparent_background(has_transparent_background()); |
123 | 122 |
124 if (ContentsTexturesPurged()) | 123 if (ContentsTexturesPurged()) |
125 target_tree->SetContentsTexturesPurged(); | 124 target_tree->SetContentsTexturesPurged(); |
126 else | 125 else |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 void LayerTreeImpl::SetPageScaleDelta(float delta) { | 182 void LayerTreeImpl::SetPageScaleDelta(float delta) { |
184 // Clamp to the current min/max limits. | 183 // Clamp to the current min/max limits. |
185 float total = page_scale_factor_ * delta; | 184 float total = page_scale_factor_ * delta; |
186 if (min_page_scale_factor_ && total < min_page_scale_factor_) | 185 if (min_page_scale_factor_ && total < min_page_scale_factor_) |
187 delta = min_page_scale_factor_ / page_scale_factor_; | 186 delta = min_page_scale_factor_ / page_scale_factor_; |
188 else if (max_page_scale_factor_ && total > max_page_scale_factor_) | 187 else if (max_page_scale_factor_ && total > max_page_scale_factor_) |
189 delta = max_page_scale_factor_ / page_scale_factor_; | 188 delta = max_page_scale_factor_ / page_scale_factor_; |
190 | 189 |
191 if (delta == page_scale_delta_) | 190 if (delta == page_scale_delta_) |
192 return; | 191 return; |
193 | |
194 page_scale_delta_ = delta; | 192 page_scale_delta_ = delta; |
195 | 193 |
196 if (IsActiveTree()) { | |
197 LayerTreeImpl* pending_tree = layer_tree_host_impl_->pending_tree(); | |
198 if (pending_tree) { | |
199 DCHECK_EQ(1, pending_tree->sent_page_scale_delta()); | |
200 pending_tree->SetPageScaleDelta( | |
enne (OOO)
2013/08/06 23:35:16
This is what keeps the pending tree's total page s
| |
201 page_scale_delta_ / sent_page_scale_delta_); | |
202 } | |
203 } | |
204 | |
205 UpdateMaxScrollOffset(); | 194 UpdateMaxScrollOffset(); |
206 set_needs_update_draw_properties(); | 195 set_needs_update_draw_properties(); |
207 } | 196 } |
208 | 197 |
209 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { | 198 gfx::SizeF LayerTreeImpl::ScrollableViewportSize() const { |
210 return gfx::ScaleSize(layer_tree_host_impl_->VisibleViewportSize(), | 199 return gfx::ScaleSize(layer_tree_host_impl_->VisibleViewportSize(), |
211 1.0f / total_page_scale_factor()); | 200 1.0f / total_page_scale_factor()); |
212 } | 201 } |
213 | 202 |
214 void LayerTreeImpl::UpdateMaxScrollOffset() { | 203 void LayerTreeImpl::UpdateMaxScrollOffset() { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
631 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() | 620 const std::vector<LayerImpl*> LayerTreeImpl::LayersWithCopyOutputRequest() |
632 const { | 621 const { |
633 // Only the active tree needs to know about layers with copy requests, as | 622 // Only the active tree needs to know about layers with copy requests, as |
634 // they are aborted if not serviced during draw. | 623 // they are aborted if not serviced during draw. |
635 DCHECK(IsActiveTree()); | 624 DCHECK(IsActiveTree()); |
636 | 625 |
637 return layers_with_copy_output_request_; | 626 return layers_with_copy_output_request_; |
638 } | 627 } |
639 | 628 |
640 } // namespace cc | 629 } // namespace cc |
OLD | NEW |