| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { | 392 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { |
| 393 #if defined(OS_ANDROID) | 393 #if defined(OS_ANDROID) |
| 394 // On Android, we never have subpixel antialiasing. | 394 // On Android, we never have subpixel antialiasing. |
| 395 return true; | 395 return true; |
| 396 #else | 396 #else |
| 397 return device_scale_factor > 1.5f; | 397 return device_scale_factor > 1.5f; |
| 398 #endif | 398 #endif |
| 399 | 399 |
| 400 } | 400 } |
| 401 | 401 |
| 402 static bool ShouldUseFixedPositionCompositing(float device_scale_factor) { | 402 static bool PreferCompositingToLCDText(float device_scale_factor) { |
| 403 // Compositing for fixed-position elements is dependent on | |
| 404 // device_scale_factor if no flag is set. http://crbug.com/172738 | |
| 405 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 406 | 404 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) |
| 407 if (command_line.HasSwitch(switches::kDisableCompositingForFixedPosition)) | |
| 408 return false; | 405 return false; |
| 409 | 406 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) |
| 410 if (command_line.HasSwitch(switches::kEnableCompositingForFixedPosition)) | |
| 411 return true; | 407 return true; |
| 412 | |
| 413 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 408 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 414 } | 409 } |
| 415 | 410 |
| 416 static bool ShouldUseAcceleratedCompositingForOverflowScroll( | 411 static bool ShouldUseAcceleratedCompositingForOverflowScroll( |
| 417 float device_scale_factor) { | 412 float device_scale_factor) { |
| 418 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 413 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 419 | 414 |
| 420 if (command_line.HasSwitch(switches::kDisableAcceleratedOverflowScroll)) | 415 if (command_line.HasSwitch(switches::kDisableAcceleratedOverflowScroll)) |
| 421 return false; | 416 return false; |
| 422 | 417 |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 // If this is a popup, we must wait for the CreatingNew_ACK message before | 784 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 790 // completing initialization. Otherwise, we can finish it now. | 785 // completing initialization. Otherwise, we can finish it now. |
| 791 if (opener_id_ == MSG_ROUTING_NONE) { | 786 if (opener_id_ == MSG_ROUTING_NONE) { |
| 792 did_show_ = true; | 787 did_show_ = true; |
| 793 CompleteInit(); | 788 CompleteInit(); |
| 794 } | 789 } |
| 795 | 790 |
| 796 g_view_map.Get().insert(std::make_pair(webview(), this)); | 791 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 797 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 792 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 798 webview()->setDeviceScaleFactor(device_scale_factor_); | 793 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 799 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 794 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 800 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 795 PreferCompositingToLCDText(device_scale_factor_)); |
| 801 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 796 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 802 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 797 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
| 803 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 798 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 804 ShouldUseTransitionCompositing(device_scale_factor_)); | 799 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 805 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 800 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 806 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 801 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
| 807 webview()->settings()->setCompositedScrollingForFramesEnabled( | 802 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 808 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 803 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 809 | 804 |
| 810 ApplyWebPreferences(webkit_preferences_, webview()); | 805 ApplyWebPreferences(webkit_preferences_, webview()); |
| (...skipping 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3761 } | 3756 } |
| 3762 RenderWidget::OnImeConfirmComposition(text, | 3757 RenderWidget::OnImeConfirmComposition(text, |
| 3763 replacement_range, | 3758 replacement_range, |
| 3764 keep_selection); | 3759 keep_selection); |
| 3765 } | 3760 } |
| 3766 | 3761 |
| 3767 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3762 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 3768 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3763 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 3769 if (webview()) { | 3764 if (webview()) { |
| 3770 webview()->setDeviceScaleFactor(device_scale_factor); | 3765 webview()->setDeviceScaleFactor(device_scale_factor); |
| 3771 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 3766 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3772 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 3767 PreferCompositingToLCDText(device_scale_factor_)); |
| 3773 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 3768 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 3774 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 3769 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
| 3775 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 3770 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 3776 ShouldUseTransitionCompositing(device_scale_factor_)); | 3771 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 3777 webview()->settings()-> | 3772 webview()->settings()-> |
| 3778 setAcceleratedCompositingForFixedRootBackgroundEnabled( | 3773 setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 3779 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 3774 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
| 3780 webview()->settings()->setCompositedScrollingForFramesEnabled( | 3775 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 3781 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 3776 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 3782 } | 3777 } |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4337 std::vector<gfx::Size> sizes; | 4332 std::vector<gfx::Size> sizes; |
| 4338 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4333 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4339 if (!url.isEmpty()) | 4334 if (!url.isEmpty()) |
| 4340 urls.push_back( | 4335 urls.push_back( |
| 4341 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4336 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4342 } | 4337 } |
| 4343 SendUpdateFaviconURL(urls); | 4338 SendUpdateFaviconURL(urls); |
| 4344 } | 4339 } |
| 4345 | 4340 |
| 4346 } // namespace content | 4341 } // namespace content |
| OLD | NEW |