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

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

Issue 2175163005: Add flag to hide scrollbars completely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add tests for scrollbar behavior without animator. Created 4 years, 4 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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 #if defined(OS_ANDROID) 404 #if defined(OS_ANDROID)
405 bool using_synchronous_compositor = 405 bool using_synchronous_compositor =
406 GetContentClient()->UsingSynchronousCompositing(); 406 GetContentClient()->UsingSynchronousCompositing();
407 407
408 // We can't use GPU rasterization on low-end devices, because the Ganesh 408 // We can't use GPU rasterization on low-end devices, because the Ganesh
409 // cache would consume too much memory. 409 // cache would consume too much memory.
410 if (base::SysInfo::IsLowEndDevice()) 410 if (base::SysInfo::IsLowEndDevice())
411 settings.gpu_rasterization_enabled = false; 411 settings.gpu_rasterization_enabled = false;
412 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; 412 settings.using_synchronous_renderer_compositor = using_synchronous_compositor;
413 if (using_synchronous_compositor) { 413 if (using_synchronous_compositor || ui::IsHiddenScrollbarEnabled()) {
414 // Android WebView uses system scrollbars, so make ours invisible. 414 // Android WebView uses system scrollbars, so make ours invisible.
skobes 2016/08/02 17:55:55 Update this comment since there is a new reason fo
Eric Seckler 2016/08/03 17:34:54 Done.
415 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; 415 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
416 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; 416 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
417 } else { 417 } else {
418 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; 418 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
419 settings.scrollbar_fade_delay_ms = 300; 419 settings.scrollbar_fade_delay_ms = 300;
420 settings.scrollbar_fade_resize_delay_ms = 2000; 420 settings.scrollbar_fade_resize_delay_ms = 2000;
421 settings.scrollbar_fade_duration_ms = 300; 421 settings.scrollbar_fade_duration_ms = 300;
422 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 422 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
423 } 423 }
424 settings.renderer_settings.highp_threshold_min = 2048; 424 settings.renderer_settings.highp_threshold_min = 2048;
(...skipping 23 matching lines...) Expand all
448 settings.renderer_settings.should_clear_root_render_pass = 448 settings.renderer_settings.should_clear_root_render_pass =
449 !using_synchronous_compositor; 449 !using_synchronous_compositor;
450 450
451 // TODO(danakj): Only do this on low end devices. 451 // TODO(danakj): Only do this on low end devices.
452 settings.create_low_res_tiling = true; 452 settings.create_low_res_tiling = true;
453 453
454 settings.use_external_begin_frame_source = true; 454 settings.use_external_begin_frame_source = true;
455 455
456 #else // defined(OS_ANDROID) 456 #else // defined(OS_ANDROID)
457 #if !defined(OS_MACOSX) 457 #if !defined(OS_MACOSX)
458 if (ui::IsOverlayScrollbarEnabled()) { 458 if (ui::IsHiddenScrollbarEnabled()) {
459 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR;
skobes 2016/08/02 17:55:55 Note that this implementation only hides native co
Eric Seckler 2016/08/03 17:34:54 I think just supporting native composited scrollba
460 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT;
461 } else if (ui::IsOverlayScrollbarEnabled()) {
459 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; 462 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING;
460 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 463 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
461 } else { 464 } else {
462 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; 465 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE;
463 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 466 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128);
464 } 467 }
465 settings.scrollbar_fade_delay_ms = 500; 468 settings.scrollbar_fade_delay_ms = 500;
466 settings.scrollbar_fade_resize_delay_ms = 500; 469 settings.scrollbar_fade_resize_delay_ms = 500;
467 settings.scrollbar_fade_duration_ms = 300; 470 settings.scrollbar_fade_duration_ms = 300;
468 #endif // !defined(OS_MACOSX) 471 #endif // !defined(OS_MACOSX)
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1145
1143 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized)); 1146 remote_proto_channel_receiver_->OnProtoReceived(std::move(deserialized));
1144 } 1147 }
1145 1148
1146 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor( 1149 void RenderWidgetCompositor::SetPaintedDeviceScaleFactor(
1147 float device_scale) { 1150 float device_scale) {
1148 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale); 1151 layer_tree_host_->SetPaintedDeviceScaleFactor(device_scale);
1149 } 1152 }
1150 1153
1151 } // namespace content 1154 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698