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

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

Issue 901813002: Normalize top controls offset to (0, 1), Chromium-side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 settings_(settings), 117 settings_(settings),
118 debug_state_(settings.initial_debug_state), 118 debug_state_(settings.initial_debug_state),
119 top_controls_shrink_blink_size_(false), 119 top_controls_shrink_blink_size_(false),
120 top_controls_height_(0.f), 120 top_controls_height_(0.f),
121 top_controls_content_offset_(0.f), 121 top_controls_shown_ratio_(0.f),
122 device_scale_factor_(1.f), 122 device_scale_factor_(1.f),
123 visible_(true), 123 visible_(true),
124 page_scale_factor_(1.f), 124 page_scale_factor_(1.f),
125 min_page_scale_factor_(1.f), 125 min_page_scale_factor_(1.f),
126 max_page_scale_factor_(1.f), 126 max_page_scale_factor_(1.f),
127 has_gpu_rasterization_trigger_(false), 127 has_gpu_rasterization_trigger_(false),
128 content_is_suitable_for_gpu_rasterization_(true), 128 content_is_suitable_for_gpu_rasterization_(true),
129 gpu_rasterization_histogram_recorded_(false), 129 gpu_rasterization_histogram_recorded_(false),
130 background_color_(SK_ColorWHITE), 130 background_color_(SK_ColorWHITE),
131 has_transparent_background_(false), 131 has_transparent_background_(false),
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 sync_tree->RegisterSelection(selection_start_, selection_end_); 321 sync_tree->RegisterSelection(selection_start_, selection_end_);
322 322
323 sync_tree->PushPageScaleFromMainThread( 323 sync_tree->PushPageScaleFromMainThread(
324 page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_); 324 page_scale_factor_, min_page_scale_factor_, max_page_scale_factor_);
325 sync_tree->elastic_overscroll()->PushFromMainThread(elastic_overscroll_); 325 sync_tree->elastic_overscroll()->PushFromMainThread(elastic_overscroll_);
326 if (sync_tree->IsActiveTree()) 326 if (sync_tree->IsActiveTree())
327 sync_tree->elastic_overscroll()->PushPendingToActive(); 327 sync_tree->elastic_overscroll()->PushPendingToActive();
328 328
329 sync_tree->PassSwapPromises(&swap_promise_list_); 329 sync_tree->PassSwapPromises(&swap_promise_list_);
330 330
331 // Track the change in top controls height to offset the top_controls_delta
332 // properly. This is so that the top controls offset will be maintained
333 // across height changes.
334 float top_controls_height_delta =
335 sync_tree->top_controls_height() - top_controls_height_;
336
337 sync_tree->set_top_controls_shrink_blink_size( 331 sync_tree->set_top_controls_shrink_blink_size(
338 top_controls_shrink_blink_size_); 332 top_controls_shrink_blink_size_);
339 sync_tree->set_top_controls_height(top_controls_height_); 333 sync_tree->set_top_controls_height(top_controls_height_);
340 sync_tree->set_top_controls_content_offset(top_controls_content_offset_); 334 sync_tree->PushTopControlsFromMainThread(top_controls_shown_ratio_);
341 sync_tree->set_top_controls_delta(sync_tree->top_controls_delta() -
342 sync_tree->sent_top_controls_delta() -
343 top_controls_height_delta);
344 sync_tree->set_sent_top_controls_delta(0.f);
345 335
346 host_impl->SetUseGpuRasterization(UseGpuRasterization()); 336 host_impl->SetUseGpuRasterization(UseGpuRasterization());
347 host_impl->set_gpu_rasterization_status(GetGpuRasterizationStatus()); 337 host_impl->set_gpu_rasterization_status(GetGpuRasterizationStatus());
348 RecordGpuRasterizationHistogram(); 338 RecordGpuRasterizationHistogram();
349 339
350 host_impl->SetViewportSize(device_viewport_size_); 340 host_impl->SetViewportSize(device_viewport_size_);
351 host_impl->SetDeviceScaleFactor(device_scale_factor_); 341 host_impl->SetDeviceScaleFactor(device_scale_factor_);
352 host_impl->SetDebugState(debug_state_); 342 host_impl->SetDebugState(debug_state_);
353 if (pending_page_scale_animation_) { 343 if (pending_page_scale_animation_) {
354 sync_tree->SetPendingPageScaleAnimation( 344 sync_tree->SetPendingPageScaleAnimation(
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 667 }
678 668
679 void LayerTreeHost::SetTopControlsHeight(float height) { 669 void LayerTreeHost::SetTopControlsHeight(float height) {
680 if (top_controls_height_ == height) 670 if (top_controls_height_ == height)
681 return; 671 return;
682 672
683 top_controls_height_ = height; 673 top_controls_height_ = height;
684 SetNeedsCommit(); 674 SetNeedsCommit();
685 } 675 }
686 676
687 void LayerTreeHost::SetTopControlsContentOffset(float offset) { 677 void LayerTreeHost::SetTopControlsShownRatio(float ratio) {
688 if (top_controls_content_offset_ == offset) 678 if (top_controls_shown_ratio_ == ratio)
689 return; 679 return;
690 680
691 top_controls_content_offset_ = offset; 681 top_controls_shown_ratio_ = ratio;
692 SetNeedsCommit(); 682 SetNeedsCommit();
693 } 683 }
694 684
695 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) { 685 void LayerTreeHost::ApplyPageScaleDeltaFromImplSide(float page_scale_delta) {
696 DCHECK(CommitRequested()); 686 DCHECK(CommitRequested());
697 page_scale_factor_ *= page_scale_delta; 687 page_scale_factor_ *= page_scale_delta;
698 } 688 }
699 689
700 void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor, 690 void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor,
701 float min_page_scale_factor, 691 float min_page_scale_factor,
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 bool children_need_begin_frames) const { 1360 bool children_need_begin_frames) const {
1371 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); 1361 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames);
1372 } 1362 }
1373 1363
1374 void LayerTreeHost::SendBeginFramesToChildren( 1364 void LayerTreeHost::SendBeginFramesToChildren(
1375 const BeginFrameArgs& args) const { 1365 const BeginFrameArgs& args) const {
1376 client_->SendBeginFramesToChildren(args); 1366 client_->SendBeginFramesToChildren(args);
1377 } 1367 }
1378 1368
1379 } // namespace cc 1369 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698