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

Side by Side Diff: content/renderer/gpu/render_widget_compositor.cc

Issue 714003002: Allow changing top controls height (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added more invalidates when setting the height Created 6 years, 1 month 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" 5 #include "content/renderer/gpu/render_widget_compositor.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 render_thread->is_gpu_rasterization_enabled(); 232 render_thread->is_gpu_rasterization_enabled();
233 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled(); 233 settings.can_use_lcd_text = render_thread->is_lcd_text_enabled();
234 settings.use_distance_field_text = 234 settings.use_distance_field_text =
235 render_thread->is_distance_field_text_enabled(); 235 render_thread->is_distance_field_text_enabled();
236 settings.use_zero_copy = render_thread->is_zero_copy_enabled(); 236 settings.use_zero_copy = render_thread->is_zero_copy_enabled();
237 settings.use_one_copy = render_thread->is_one_copy_enabled(); 237 settings.use_one_copy = render_thread->is_one_copy_enabled();
238 } 238 }
239 239
240 settings.calculate_top_controls_position = 240 settings.calculate_top_controls_position =
241 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); 241 cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation);
242 if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) {
243 std::string controls_height_str =
244 cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight);
245 double controls_height;
246 if (base::StringToDouble(controls_height_str, &controls_height) &&
247 controls_height > 0)
248 settings.top_controls_height = controls_height;
249 }
250
251 if (settings.calculate_top_controls_position &&
252 settings.top_controls_height <= 0) {
253 DCHECK(false)
254 << "Top controls repositioning enabled without valid height set.";
255 settings.calculate_top_controls_position = false;
256 }
257
258 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { 242 if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) {
259 std::string top_threshold_str = 243 std::string top_threshold_str =
260 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); 244 cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold);
261 double show_threshold; 245 double show_threshold;
262 if (base::StringToDouble(top_threshold_str, &show_threshold) && 246 if (base::StringToDouble(top_threshold_str, &show_threshold) &&
263 show_threshold >= 0.f && show_threshold <= 1.f) 247 show_threshold >= 0.f && show_threshold <= 1.f)
264 settings.top_controls_show_threshold = show_threshold; 248 settings.top_controls_show_threshold = show_threshold;
265 } 249 }
266 250
267 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { 251 if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 438
455 void RenderWidgetCompositor::UpdateTopControlsState( 439 void RenderWidgetCompositor::UpdateTopControlsState(
456 cc::TopControlsState constraints, 440 cc::TopControlsState constraints,
457 cc::TopControlsState current, 441 cc::TopControlsState current,
458 bool animate) { 442 bool animate) {
459 layer_tree_host_->UpdateTopControlsState(constraints, 443 layer_tree_host_->UpdateTopControlsState(constraints,
460 current, 444 current,
461 animate); 445 animate);
462 } 446 }
463 447
464 void RenderWidgetCompositor::SetTopControlsLayoutHeight(float height) { 448 void RenderWidgetCompositor::SetTopControlsShrinkBlinkSize(bool shrink) {
465 layer_tree_host_->SetTopControlsLayoutHeight(height); 449 layer_tree_host_->SetTopControlsShrinkBlinkSize(shrink);
450 }
451
452 void RenderWidgetCompositor::SetTopControlsHeight(float height) {
453 layer_tree_host_->SetTopControlsHeight(height);
466 } 454 }
467 455
468 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { 456 void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) {
469 layer_tree_host_->SetNeedsRedrawRect(damage_rect); 457 layer_tree_host_->SetNeedsRedrawRect(damage_rect);
470 } 458 }
471 459
472 void RenderWidgetCompositor::SetNeedsForcedRedraw() { 460 void RenderWidgetCompositor::SetNeedsForcedRedraw() {
473 layer_tree_host_->SetNextCommitForcesRedraw(); 461 layer_tree_host_->SetNextCommitForcesRedraw();
474 setNeedsAnimate(); 462 setNeedsAnimate();
475 } 463 }
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 widget_->OnSwapBuffersAborted(); 883 widget_->OnSwapBuffersAborted();
896 } 884 }
897 885
898 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { 886 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() {
899 cc::ContextProvider* provider = 887 cc::ContextProvider* provider =
900 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); 888 RenderThreadImpl::current()->SharedMainThreadContextProvider().get();
901 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM(); 889 provider->ContextGL()->RateLimitOffscreenContextCHROMIUM();
902 } 890 }
903 891
904 } // namespace content 892 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698