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 PreferCompositingToLCDText(float device_scale_factor) { | 402 static bool ShouldUseFixedPositionCompositing(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 |
403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 405 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
404 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) | 406 |
| 407 if (command_line.HasSwitch(switches::kDisableCompositingForFixedPosition)) |
405 return false; | 408 return false; |
406 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) | 409 |
| 410 if (command_line.HasSwitch(switches::kEnableCompositingForFixedPosition)) |
407 return true; | 411 return true; |
| 412 |
408 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 413 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
409 } | 414 } |
410 | 415 |
411 static bool ShouldUseAcceleratedCompositingForOverflowScroll( | 416 static bool ShouldUseAcceleratedCompositingForOverflowScroll( |
412 float device_scale_factor) { | 417 float device_scale_factor) { |
413 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 418 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
414 | 419 |
415 if (command_line.HasSwitch(switches::kDisableAcceleratedOverflowScroll)) | 420 if (command_line.HasSwitch(switches::kDisableAcceleratedOverflowScroll)) |
416 return false; | 421 return false; |
417 | 422 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 // If this is a popup, we must wait for the CreatingNew_ACK message before | 789 // If this is a popup, we must wait for the CreatingNew_ACK message before |
785 // completing initialization. Otherwise, we can finish it now. | 790 // completing initialization. Otherwise, we can finish it now. |
786 if (opener_id_ == MSG_ROUTING_NONE) { | 791 if (opener_id_ == MSG_ROUTING_NONE) { |
787 did_show_ = true; | 792 did_show_ = true; |
788 CompleteInit(); | 793 CompleteInit(); |
789 } | 794 } |
790 | 795 |
791 g_view_map.Get().insert(std::make_pair(webview(), this)); | 796 g_view_map.Get().insert(std::make_pair(webview(), this)); |
792 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 797 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
793 webview()->setDeviceScaleFactor(device_scale_factor_); | 798 webview()->setDeviceScaleFactor(device_scale_factor_); |
794 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 799 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
795 PreferCompositingToLCDText(device_scale_factor_)); | 800 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
796 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 801 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
797 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 802 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
798 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 803 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
799 ShouldUseTransitionCompositing(device_scale_factor_)); | 804 ShouldUseTransitionCompositing(device_scale_factor_)); |
800 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 805 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
801 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 806 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
802 webview()->settings()->setCompositedScrollingForFramesEnabled( | 807 webview()->settings()->setCompositedScrollingForFramesEnabled( |
803 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 808 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
804 | 809 |
805 ApplyWebPreferences(webkit_preferences_, webview()); | 810 ApplyWebPreferences(webkit_preferences_, webview()); |
(...skipping 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3756 } | 3761 } |
3757 RenderWidget::OnImeConfirmComposition(text, | 3762 RenderWidget::OnImeConfirmComposition(text, |
3758 replacement_range, | 3763 replacement_range, |
3759 keep_selection); | 3764 keep_selection); |
3760 } | 3765 } |
3761 | 3766 |
3762 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3767 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
3763 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3768 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
3764 if (webview()) { | 3769 if (webview()) { |
3765 webview()->setDeviceScaleFactor(device_scale_factor); | 3770 webview()->setDeviceScaleFactor(device_scale_factor); |
3766 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3771 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
3767 PreferCompositingToLCDText(device_scale_factor_)); | 3772 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
3768 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 3773 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
3769 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 3774 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
3770 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 3775 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
3771 ShouldUseTransitionCompositing(device_scale_factor_)); | 3776 ShouldUseTransitionCompositing(device_scale_factor_)); |
3772 webview()->settings()-> | 3777 webview()->settings()-> |
3773 setAcceleratedCompositingForFixedRootBackgroundEnabled( | 3778 setAcceleratedCompositingForFixedRootBackgroundEnabled( |
3774 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 3779 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
3775 webview()->settings()->setCompositedScrollingForFramesEnabled( | 3780 webview()->settings()->setCompositedScrollingForFramesEnabled( |
3776 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 3781 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
3777 } | 3782 } |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4332 std::vector<gfx::Size> sizes; | 4337 std::vector<gfx::Size> sizes; |
4333 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4338 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4334 if (!url.isEmpty()) | 4339 if (!url.isEmpty()) |
4335 urls.push_back( | 4340 urls.push_back( |
4336 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4341 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4337 } | 4342 } |
4338 SendUpdateFaviconURL(urls); | 4343 SendUpdateFaviconURL(urls); |
4339 } | 4344 } |
4340 | 4345 |
4341 } // namespace content | 4346 } // namespace content |
OLD | NEW |