OLD | NEW |
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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 #if defined(OS_ANDROID) | 378 #if defined(OS_ANDROID) |
379 bool using_synchronous_compositor = | 379 bool using_synchronous_compositor = |
380 GetContentClient()->UsingSynchronousCompositing(); | 380 GetContentClient()->UsingSynchronousCompositing(); |
381 | 381 |
382 // We can't use GPU rasterization on low-end devices, because the Ganesh | 382 // We can't use GPU rasterization on low-end devices, because the Ganesh |
383 // cache would consume too much memory. | 383 // cache would consume too much memory. |
384 if (base::SysInfo::IsLowEndDevice()) | 384 if (base::SysInfo::IsLowEndDevice()) |
385 settings.gpu_rasterization_enabled = false; | 385 settings.gpu_rasterization_enabled = false; |
386 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; | 386 settings.using_synchronous_renderer_compositor = using_synchronous_compositor; |
387 // Also hide scrollbars for Android WebView, since it uses system scrollbars. | 387 if (using_synchronous_compositor) { |
388 if (ui::ShouldHideScrollbars() || using_synchronous_compositor) { | 388 // Android WebView uses system scrollbars, so make ours invisible. |
389 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | 389 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; |
390 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | 390 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; |
391 } else { | 391 } else { |
392 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 392 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
393 settings.scrollbar_fade_delay_ms = 300; | 393 settings.scrollbar_fade_delay_ms = 300; |
394 settings.scrollbar_fade_resize_delay_ms = 2000; | 394 settings.scrollbar_fade_resize_delay_ms = 2000; |
395 settings.scrollbar_fade_duration_ms = 300; | 395 settings.scrollbar_fade_duration_ms = 300; |
396 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 396 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
397 } | 397 } |
398 settings.renderer_settings.highp_threshold_min = 2048; | 398 settings.renderer_settings.highp_threshold_min = 2048; |
(...skipping 20 matching lines...) Expand all Loading... |
419 settings.max_memory_for_prepaint_percentage = 50; | 419 settings.max_memory_for_prepaint_percentage = 50; |
420 } | 420 } |
421 // Webview does not own the surface so should not clear it. | 421 // Webview does not own the surface so should not clear it. |
422 settings.renderer_settings.should_clear_root_render_pass = | 422 settings.renderer_settings.should_clear_root_render_pass = |
423 !using_synchronous_compositor; | 423 !using_synchronous_compositor; |
424 | 424 |
425 // TODO(danakj): Only do this on low end devices. | 425 // TODO(danakj): Only do this on low end devices. |
426 settings.create_low_res_tiling = true; | 426 settings.create_low_res_tiling = true; |
427 #else // defined(OS_ANDROID) | 427 #else // defined(OS_ANDROID) |
428 #if !defined(OS_MACOSX) | 428 #if !defined(OS_MACOSX) |
429 if (ui::ShouldHideScrollbars()) { | 429 if (ui::IsOverlayScrollbarEnabled()) { |
430 settings.scrollbar_animator = cc::LayerTreeSettings::NO_ANIMATOR; | |
431 settings.solid_color_scrollbar_color = SK_ColorTRANSPARENT; | |
432 } else if (ui::IsOverlayScrollbarEnabled()) { | |
433 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; | 430 settings.scrollbar_animator = cc::LayerTreeSettings::THINNING; |
434 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 431 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
435 } else { | 432 } else { |
436 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; | 433 settings.scrollbar_animator = cc::LayerTreeSettings::LINEAR_FADE; |
437 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); | 434 settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); |
438 } | 435 } |
439 settings.scrollbar_fade_delay_ms = 500; | 436 settings.scrollbar_fade_delay_ms = 500; |
440 settings.scrollbar_fade_resize_delay_ms = 500; | 437 settings.scrollbar_fade_resize_delay_ms = 500; |
441 settings.scrollbar_fade_duration_ms = 300; | 438 settings.scrollbar_fade_duration_ms = 300; |
442 #endif // !defined(OS_MACOSX) | 439 #endif // !defined(OS_MACOSX) |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 float device_scale) { | 1121 float device_scale) { |
1125 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); | 1122 layer_tree_host_->GetLayerTree()->SetPaintedDeviceScaleFactor(device_scale); |
1126 } | 1123 } |
1127 | 1124 |
1128 void RenderWidgetCompositor::SetDeviceColorSpace( | 1125 void RenderWidgetCompositor::SetDeviceColorSpace( |
1129 const gfx::ColorSpace& color_space) { | 1126 const gfx::ColorSpace& color_space) { |
1130 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); | 1127 layer_tree_host_->GetLayerTree()->SetDeviceColorSpace(color_space); |
1131 } | 1128 } |
1132 | 1129 |
1133 } // namespace content | 1130 } // namespace content |
OLD | NEW |