Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: cc/trees/layer_tree_host.cc

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 float page_scale_delta = 364 float page_scale_delta =
364 sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta(); 365 sync_tree->page_scale_delta() / sync_tree->sent_page_scale_delta();
365 sync_tree->SetPageScaleValues(page_scale_factor_, 366 sync_tree->SetPageScaleValues(page_scale_factor_,
366 min_page_scale_factor_, 367 min_page_scale_factor_,
367 max_page_scale_factor_, 368 max_page_scale_factor_,
368 page_scale_delta); 369 page_scale_delta);
369 sync_tree->set_sent_page_scale_delta(1.f); 370 sync_tree->set_sent_page_scale_delta(1.f);
370 371
371 sync_tree->PassSwapPromises(&swap_promise_list_); 372 sync_tree->PassSwapPromises(&swap_promise_list_);
372 373
373 sync_tree->set_top_controls_layout_height(top_controls_layout_height_); 374 // Track the change in top controls height to offset the top_controls_delta
375 // properly. This is so that the top controls offset will be maintained
376 // across height changes.
377 float top_controls_height_delta =
378 sync_tree->top_controls_height() - top_controls_height_;
379
380 sync_tree->set_top_controls_shrink_blink_size(
381 top_controls_shrink_blink_size_);
382 sync_tree->set_top_controls_height(top_controls_height_);
374 sync_tree->set_top_controls_content_offset(top_controls_content_offset_); 383 sync_tree->set_top_controls_content_offset(top_controls_content_offset_);
375 sync_tree->set_top_controls_delta(sync_tree->top_controls_delta() - 384 sync_tree->set_top_controls_delta(sync_tree->top_controls_delta() -
376 sync_tree->sent_top_controls_delta()); 385 sync_tree->sent_top_controls_delta() -
386 top_controls_height_delta);
377 sync_tree->set_sent_top_controls_delta(0.f); 387 sync_tree->set_sent_top_controls_delta(0.f);
378 388
379 host_impl->SetUseGpuRasterization(UseGpuRasterization()); 389 host_impl->SetUseGpuRasterization(UseGpuRasterization());
380 RecordGpuRasterizationHistogram(); 390 RecordGpuRasterizationHistogram();
381 391
382 host_impl->SetViewportSize(device_viewport_size_); 392 host_impl->SetViewportSize(device_viewport_size_);
383 host_impl->SetDeviceScaleFactor(device_scale_factor_); 393 host_impl->SetDeviceScaleFactor(device_scale_factor_);
384 host_impl->SetDebugState(debug_state_); 394 host_impl->SetDebugState(debug_state_);
385 if (pending_page_scale_animation_) { 395 if (pending_page_scale_animation_) {
386 sync_tree->SetPendingPageScaleAnimation( 396 sync_tree->SetPendingPageScaleAnimation(
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 660
651 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) { 661 void LayerTreeHost::SetViewportSize(const gfx::Size& device_viewport_size) {
652 if (device_viewport_size == device_viewport_size_) 662 if (device_viewport_size == device_viewport_size_)
653 return; 663 return;
654 664
655 device_viewport_size_ = device_viewport_size; 665 device_viewport_size_ = device_viewport_size;
656 666
657 SetNeedsCommit(); 667 SetNeedsCommit();
658 } 668 }
659 669
660 void LayerTreeHost::SetTopControlsLayoutHeight(float height) { 670 void LayerTreeHost::SetTopControlsShrinkBlinkSize(bool shrink) {
661 if (top_controls_layout_height_ == height) 671 if (top_controls_shrink_blink_size_ == shrink)
662 return; 672 return;
663 673
664 top_controls_layout_height_ = height; 674 top_controls_shrink_blink_size_ = shrink;
665 SetNeedsCommit(); 675 SetNeedsCommit();
666 } 676 }
667 677
678 void LayerTreeHost::SetTopControlsHeight(float height) {
679 if (top_controls_height_ == height)
680 return;
681
682 top_controls_height_ = height;
683 SetNeedsCommit();
684 }
685
668 void LayerTreeHost::SetTopControlsContentOffset(float offset) { 686 void LayerTreeHost::SetTopControlsContentOffset(float offset) {
669 if (top_controls_content_offset_ == offset) 687 if (top_controls_content_offset_ == offset)
670 return; 688 return;
671 689
672 top_controls_content_offset_ = offset; 690 top_controls_content_offset_ = offset;
673 SetNeedsCommit(); 691 SetNeedsCommit();
674 } 692 }
675 693
676 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { 694 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) {
677 DCHECK(CommitRequested()); 695 DCHECK(CommitRequested());
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 bool children_need_begin_frames) const { 1375 bool children_need_begin_frames) const {
1358 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); 1376 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames);
1359 } 1377 }
1360 1378
1361 void LayerTreeHost::SendBeginFramesToChildren( 1379 void LayerTreeHost::SendBeginFramesToChildren(
1362 const BeginFrameArgs& args) const { 1380 const BeginFrameArgs& args) const {
1363 client_->SendBeginFramesToChildren(args); 1381 client_->SendBeginFramesToChildren(args);
1364 } 1382 }
1365 1383
1366 } // namespace cc 1384 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698