| 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_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 next_ui_resource_id_(1), | 110 next_ui_resource_id_(1), |
| 111 inside_begin_main_frame_(false), | 111 inside_begin_main_frame_(false), |
| 112 needs_full_tree_sync_(true), | 112 needs_full_tree_sync_(true), |
| 113 client_(client), | 113 client_(client), |
| 114 source_frame_number_(0), | 114 source_frame_number_(0), |
| 115 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), | 115 rendering_stats_instrumentation_(RenderingStatsInstrumentation::Create()), |
| 116 output_surface_lost_(true), | 116 output_surface_lost_(true), |
| 117 num_failed_recreate_attempts_(0), | 117 num_failed_recreate_attempts_(0), |
| 118 settings_(settings), | 118 settings_(settings), |
| 119 debug_state_(settings.initial_debug_state), | 119 debug_state_(settings.initial_debug_state), |
| 120 top_controls_layout_height_(0.f), | 120 top_controls_shrink_blink_size_(false), |
| 121 top_controls_height_(0.f), |
| 121 top_controls_content_offset_(0.f), | 122 top_controls_content_offset_(0.f), |
| 122 device_scale_factor_(1.f), | 123 device_scale_factor_(1.f), |
| 123 visible_(true), | 124 visible_(true), |
| 124 page_scale_factor_(1.f), | 125 page_scale_factor_(1.f), |
| 125 min_page_scale_factor_(1.f), | 126 min_page_scale_factor_(1.f), |
| 126 max_page_scale_factor_(1.f), | 127 max_page_scale_factor_(1.f), |
| 127 has_gpu_rasterization_trigger_(false), | 128 has_gpu_rasterization_trigger_(false), |
| 128 content_is_suitable_for_gpu_rasterization_(true), | 129 content_is_suitable_for_gpu_rasterization_(true), |
| 129 gpu_rasterization_histogram_recorded_(false), | 130 gpu_rasterization_histogram_recorded_(false), |
| 130 background_color_(SK_ColorWHITE), | 131 background_color_(SK_ColorWHITE), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 : Layer::INVALID_ID, | 354 : Layer::INVALID_ID, |
| 354 page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), | 355 page_scale_layer_->id(), inner_viewport_scroll_layer_->id(), |
| 355 outer_viewport_scroll_layer_.get() ? outer_viewport_scroll_layer_->id() | 356 outer_viewport_scroll_layer_.get() ? outer_viewport_scroll_layer_->id() |
| 356 : Layer::INVALID_ID); | 357 : Layer::INVALID_ID); |
| 357 } else { | 358 } else { |
| 358 sync_tree->ClearViewportLayers(); | 359 sync_tree->ClearViewportLayers(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 sync_tree->RegisterSelection(selection_start_, selection_end_); | 362 sync_tree->RegisterSelection(selection_start_, selection_end_); |
| 362 | 363 |
| 363 float page_scale_delta = | 364 sync_tree->PushPageScaleFromMainThread( |
| 364 sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta(); | 365 page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_); |
| 365 sync_tree->SetPageScaleValues(page_scale_factor_, | |
| 366 min_page_scale_factor_, | |
| 367 max_page_scale_factor_, | |
| 368 page_scale_delta); | |
| 369 sync_tree->set_sent_page_scale_delta(1.f); | |
| 370 | 366 |
| 371 sync_tree->PassSwapPromises(&swap_promise_list_); | 367 sync_tree->PassSwapPromises(&swap_promise_list_); |
| 372 | 368 |
| 373 sync_tree->set_top_controls_layout_height(top_controls_layout_height_); | 369 // Track the change in top controls height to offset the top_controls_delta |
| 370 // properly. This is so that the top controls offset will be maintained |
| 371 // across height changes. |
| 372 float top_controls_height_delta = |
| 373 sync_tree->top_controls_height() - top_controls_height_; |
| 374 |
| 375 sync_tree->set_top_controls_shrink_blink_size( |
| 376 top_controls_shrink_blink_size_); |
| 377 sync_tree->set_top_controls_height(top_controls_height_); |
| 374 sync_tree->set_top_controls_content_offset(top_controls_content_offset_); | 378 sync_tree->set_top_controls_content_offset(top_controls_content_offset_); |
| 375 sync_tree->set_top_controls_delta(sync_tree->top_controls_delta() - | 379 sync_tree->set_top_controls_delta(sync_tree->top_controls_delta() - |
| 376 sync_tree->sent_top_controls_delta()); | 380 sync_tree->sent_top_controls_delta() - |
| 381 top_controls_height_delta); |
| 377 sync_tree->set_sent_top_controls_delta(0.f); | 382 sync_tree->set_sent_top_controls_delta(0.f); |
| 378 | 383 |
| 379 host_impl->SetUseGpuRasterization(UseGpuRasterization()); | 384 host_impl->SetUseGpuRasterization(UseGpuRasterization()); |
| 380 host_impl->set_gpu_rasterization_status(GetGpuRasterizationStatus()); | 385 host_impl->set_gpu_rasterization_status(GetGpuRasterizationStatus()); |
| 381 RecordGpuRasterizationHistogram(); | 386 RecordGpuRasterizationHistogram(); |
| 382 | 387 |
| 383 host_impl->SetViewportSize(device_viewport_size_); | 388 host_impl->SetViewportSize(device_viewport_size_); |
| 384 host_impl->SetDeviceScaleFactor(device_scale_factor_); | 389 host_impl->SetDeviceScaleFactor(device_scale_factor_); |
| 385 host_impl->SetDebugState(debug_state_); | 390 host_impl->SetDebugState(debug_state_); |
| 386 if (pending_page_scale_animation_) { | 391 if (pending_page_scale_animation_) { |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 671 |
| 667 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { | 672 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { |
| 668 if (device_viewport_size == device_viewport_size_) | 673 if (device_viewport_size == device_viewport_size_) |
| 669 return; | 674 return; |
| 670 | 675 |
| 671 device_viewport_size_ = device_viewport_size; | 676 device_viewport_size_ = device_viewport_size; |
| 672 | 677 |
| 673 SetNeedsCommit(); | 678 SetNeedsCommit(); |
| 674 } | 679 } |
| 675 | 680 |
| 676 void LayerTreeHost::SetTopControlsLayoutHeight(float height) { | 681 void LayerTreeHost::SetTopControlsShrinkBlinkSize(bool shrink) { |
| 677 if (top_controls_layout_height_ == height) | 682 if (top_controls_shrink_blink_size_ == shrink) |
| 678 return; | 683 return; |
| 679 | 684 |
| 680 top_controls_layout_height_ = height; | 685 top_controls_shrink_blink_size_ = shrink; |
| 681 SetNeedsCommit(); | 686 SetNeedsCommit(); |
| 682 } | 687 } |
| 683 | 688 |
| 689 void LayerTreeHost::SetTopControlsHeight(float height) { |
| 690 if (top_controls_height_ == height) |
| 691 return; |
| 692 |
| 693 top_controls_height_ = height; |
| 694 SetNeedsCommit(); |
| 695 } |
| 696 |
| 684 void LayerTreeHost::SetTopControlsContentOffset(float offset) { | 697 void LayerTreeHost::SetTopControlsContentOffset(float offset) { |
| 685 if (top_controls_content_offset_ == offset) | 698 if (top_controls_content_offset_ == offset) |
| 686 return; | 699 return; |
| 687 | 700 |
| 688 top_controls_content_offset_ = offset; | 701 top_controls_content_offset_ = offset; |
| 689 SetNeedsCommit(); | 702 SetNeedsCommit(); |
| 690 } | 703 } |
| 691 | 704 |
| 692 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { | 705 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { |
| 693 DCHECK(CommitRequested()); | 706 DCHECK(CommitRequested()); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 bool children_need_begin_frames) const { | 1386 bool children_need_begin_frames) const { |
| 1374 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | 1387 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); |
| 1375 } | 1388 } |
| 1376 | 1389 |
| 1377 void LayerTreeHost::SendBeginFramesToChildren( | 1390 void LayerTreeHost::SendBeginFramesToChildren( |
| 1378 const BeginFrameArgs& args) const { | 1391 const BeginFrameArgs& args) const { |
| 1379 client_->SendBeginFramesToChildren(args); | 1392 client_->SendBeginFramesToChildren(args); |
| 1380 } | 1393 } |
| 1381 | 1394 |
| 1382 } // namespace cc | 1395 } // namespace cc |
| OLD | NEW |