| 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 static bool PreferCompositingToLCDText(float device_scale_factor) { | 402 static bool PreferCompositingToLCDText(float device_scale_factor) { |
| 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 404 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) | 404 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) |
| 405 return false; | 405 return false; |
| 406 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) | 406 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) |
| 407 return true; | 407 return true; |
| 408 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 408 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 409 } | 409 } |
| 410 | 410 |
| 411 static bool ShouldUseAcceleratedCompositingForOverflowScroll( | |
| 412 float device_scale_factor) { | |
| 413 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 414 | |
| 415 if (command_line.HasSwitch(switches::kDisableAcceleratedOverflowScroll)) | |
| 416 return false; | |
| 417 | |
| 418 if (command_line.HasSwitch(switches::kEnableAcceleratedOverflowScroll)) | |
| 419 return true; | |
| 420 | |
| 421 return DeviceScaleEnsuresTextQuality(device_scale_factor); | |
| 422 } | |
| 423 | |
| 424 static bool ShouldUseCompositedScrollingForFrames( | 411 static bool ShouldUseCompositedScrollingForFrames( |
| 425 float device_scale_factor) { | 412 float device_scale_factor) { |
| 426 if (RenderThreadImpl::current() && | 413 if (RenderThreadImpl::current() && |
| 427 !RenderThreadImpl::current()->is_lcd_text_enabled()) | 414 !RenderThreadImpl::current()->is_lcd_text_enabled()) |
| 428 return true; | 415 return true; |
| 429 | 416 |
| 430 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 417 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 431 } | 418 } |
| 432 | 419 |
| 433 static bool ShouldUseTransitionCompositing(float device_scale_factor) { | 420 static bool ShouldUseTransitionCompositing(float device_scale_factor) { |
| 434 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 421 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 435 | 422 |
| 436 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) | 423 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) |
| 437 return false; | 424 return false; |
| 438 | 425 |
| 439 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) | 426 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) |
| 440 return true; | 427 return true; |
| 441 | 428 |
| 442 // TODO(ajuma): Re-enable this by default for high-DPI once the problem | 429 // TODO(ajuma): Re-enable this by default for high-DPI once the problem |
| 443 // of excessive layer promotion caused by overlap has been addressed. | 430 // of excessive layer promotion caused by overlap has been addressed. |
| 444 // http://crbug.com/178119. | 431 // http://crbug.com/178119. |
| 445 return false; | 432 return false; |
| 446 } | 433 } |
| 447 | 434 |
| 448 static bool ShouldUseAcceleratedFixedRootBackground(float device_scale_factor) { | |
| 449 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 450 | |
| 451 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) | |
| 452 return false; | |
| 453 | |
| 454 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) | |
| 455 return true; | |
| 456 | |
| 457 return DeviceScaleEnsuresTextQuality(device_scale_factor); | |
| 458 } | |
| 459 | |
| 460 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { | 435 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { |
| 461 switch (type) { | 436 switch (type) { |
| 462 case blink::WebIconURL::TypeFavicon: | 437 case blink::WebIconURL::TypeFavicon: |
| 463 return FaviconURL::FAVICON; | 438 return FaviconURL::FAVICON; |
| 464 case blink::WebIconURL::TypeTouch: | 439 case blink::WebIconURL::TypeTouch: |
| 465 return FaviconURL::TOUCH_ICON; | 440 return FaviconURL::TOUCH_ICON; |
| 466 case blink::WebIconURL::TypeTouchPrecomposed: | 441 case blink::WebIconURL::TypeTouchPrecomposed: |
| 467 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 442 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
| 468 case blink::WebIconURL::TypeInvalid: | 443 case blink::WebIconURL::TypeInvalid: |
| 469 return FaviconURL::INVALID_ICON; | 444 return FaviconURL::INVALID_ICON; |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 did_show_ = true; | 762 did_show_ = true; |
| 788 CompleteInit(); | 763 CompleteInit(); |
| 789 } | 764 } |
| 790 | 765 |
| 791 g_view_map.Get().insert(std::make_pair(webview(), this)); | 766 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 792 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 767 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 793 webview()->setDeviceScaleFactor(device_scale_factor_); | 768 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 794 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 769 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 795 PreferCompositingToLCDText(device_scale_factor_)); | 770 PreferCompositingToLCDText(device_scale_factor_)); |
| 796 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 771 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 797 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 772 PreferCompositingToLCDText(device_scale_factor_)); |
| 798 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 773 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 799 ShouldUseTransitionCompositing(device_scale_factor_)); | 774 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 800 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( | 775 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 801 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 776 PreferCompositingToLCDText(device_scale_factor_)); |
| 802 webview()->settings()->setCompositedScrollingForFramesEnabled( | 777 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 803 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 778 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 804 | 779 |
| 805 ApplyWebPreferences(webkit_preferences_, webview()); | 780 ApplyWebPreferences(webkit_preferences_, webview()); |
| 806 | 781 |
| 807 webview()->settings()->setAllowConnectingInsecureWebSocket( | 782 webview()->settings()->setAllowConnectingInsecureWebSocket( |
| 808 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 783 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
| 809 | 784 |
| 810 RenderFrameProxy* proxy = NULL; | 785 RenderFrameProxy* proxy = NULL; |
| 811 if (params->proxy_routing_id != MSG_ROUTING_NONE) { | 786 if (params->proxy_routing_id != MSG_ROUTING_NONE) { |
| (...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3759 keep_selection); | 3734 keep_selection); |
| 3760 } | 3735 } |
| 3761 | 3736 |
| 3762 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3737 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 3763 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3738 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 3764 if (webview()) { | 3739 if (webview()) { |
| 3765 webview()->setDeviceScaleFactor(device_scale_factor); | 3740 webview()->setDeviceScaleFactor(device_scale_factor); |
| 3766 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3741 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3767 PreferCompositingToLCDText(device_scale_factor_)); | 3742 PreferCompositingToLCDText(device_scale_factor_)); |
| 3768 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( | 3743 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 3769 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); | 3744 PreferCompositingToLCDText(device_scale_factor_)); |
| 3770 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 3745 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 3771 ShouldUseTransitionCompositing(device_scale_factor_)); | 3746 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 3772 webview()->settings()-> | 3747 webview() |
| 3773 setAcceleratedCompositingForFixedRootBackgroundEnabled( | 3748 ->settings() |
| 3774 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); | 3749 ->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 3750 PreferCompositingToLCDText(device_scale_factor_)); |
| 3775 webview()->settings()->setCompositedScrollingForFramesEnabled( | 3751 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 3776 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 3752 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 3777 } | 3753 } |
| 3778 if (auto_resize_mode_) | 3754 if (auto_resize_mode_) |
| 3779 AutoResizeCompositor(); | 3755 AutoResizeCompositor(); |
| 3780 | 3756 |
| 3781 if (browser_plugin_manager_.get()) | 3757 if (browser_plugin_manager_.get()) |
| 3782 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); | 3758 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); |
| 3783 } | 3759 } |
| 3784 | 3760 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4332 std::vector<gfx::Size> sizes; | 4308 std::vector<gfx::Size> sizes; |
| 4333 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4309 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 4334 if (!url.isEmpty()) | 4310 if (!url.isEmpty()) |
| 4335 urls.push_back( | 4311 urls.push_back( |
| 4336 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4312 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 4337 } | 4313 } |
| 4338 SendUpdateFaviconURL(urls); | 4314 SendUpdateFaviconURL(urls); |
| 4339 } | 4315 } |
| 4340 | 4316 |
| 4341 } // namespace content | 4317 } // namespace content |
| OLD | NEW |