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 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) | 392 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) |
393 return false; | 393 return false; |
394 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) | 394 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) |
395 return true; | 395 return true; |
396 if (RenderThreadImpl::current() && | 396 if (RenderThreadImpl::current() && |
397 !RenderThreadImpl::current()->is_lcd_text_enabled()) | 397 !RenderThreadImpl::current()->is_lcd_text_enabled()) |
398 return true; | 398 return true; |
399 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 399 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
400 } | 400 } |
401 | 401 |
402 static bool ShouldUseTransitionCompositing(float device_scale_factor) { | |
403 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
404 | |
405 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) | |
406 return false; | |
407 | |
408 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) | |
409 return true; | |
410 | |
411 // TODO(ajuma): Re-enable this by default for high-DPI once the problem | |
412 // of excessive layer promotion caused by overlap has been addressed. | |
413 // http://crbug.com/178119. | |
414 return false; | |
415 } | |
416 | |
417 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { | 402 static FaviconURL::IconType ToFaviconType(blink::WebIconURL::Type type) { |
418 switch (type) { | 403 switch (type) { |
419 case blink::WebIconURL::TypeFavicon: | 404 case blink::WebIconURL::TypeFavicon: |
420 return FaviconURL::FAVICON; | 405 return FaviconURL::FAVICON; |
421 case blink::WebIconURL::TypeTouch: | 406 case blink::WebIconURL::TypeTouch: |
422 return FaviconURL::TOUCH_ICON; | 407 return FaviconURL::TOUCH_ICON; |
423 case blink::WebIconURL::TypeTouchPrecomposed: | 408 case blink::WebIconURL::TypeTouchPrecomposed: |
424 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 409 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
425 case blink::WebIconURL::TypeInvalid: | 410 case blink::WebIconURL::TypeInvalid: |
426 return FaviconURL::INVALID_ICON; | 411 return FaviconURL::INVALID_ICON; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 if (opener_id_ == MSG_ROUTING_NONE) { | 728 if (opener_id_ == MSG_ROUTING_NONE) { |
744 did_show_ = true; | 729 did_show_ = true; |
745 CompleteInit(); | 730 CompleteInit(); |
746 } | 731 } |
747 | 732 |
748 g_view_map.Get().insert(std::make_pair(webview(), this)); | 733 g_view_map.Get().insert(std::make_pair(webview(), this)); |
749 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 734 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
750 webview()->setDeviceScaleFactor(device_scale_factor_); | 735 webview()->setDeviceScaleFactor(device_scale_factor_); |
751 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 736 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
752 PreferCompositingToLCDText(device_scale_factor_)); | 737 PreferCompositingToLCDText(device_scale_factor_)); |
753 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | |
754 ShouldUseTransitionCompositing(device_scale_factor_)); | |
755 webview()->settings()->setThreadedScrollingEnabled( | 738 webview()->settings()->setThreadedScrollingEnabled( |
756 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 739 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
757 webview()->settings()->setRootLayerScrolls( | 740 webview()->settings()->setRootLayerScrolls( |
758 command_line.HasSwitch(switches::kRootLayerScrolls)); | 741 command_line.HasSwitch(switches::kRootLayerScrolls)); |
759 | 742 |
760 ApplyWebPreferences(webkit_preferences_, webview()); | 743 ApplyWebPreferences(webkit_preferences_, webview()); |
761 | 744 |
762 webview()->settings()->setAllowConnectingInsecureWebSocket( | 745 webview()->settings()->setAllowConnectingInsecureWebSocket( |
763 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); | 746 command_line.HasSwitch(switches::kAllowInsecureWebSocketFromHttpsOrigin)); |
764 | 747 |
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 replacement_range, | 3586 replacement_range, |
3604 keep_selection); | 3587 keep_selection); |
3605 } | 3588 } |
3606 | 3589 |
3607 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 3590 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
3608 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 3591 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
3609 if (webview()) { | 3592 if (webview()) { |
3610 webview()->setDeviceScaleFactor(device_scale_factor); | 3593 webview()->setDeviceScaleFactor(device_scale_factor); |
3611 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 3594 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
3612 PreferCompositingToLCDText(device_scale_factor_)); | 3595 PreferCompositingToLCDText(device_scale_factor_)); |
3613 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | |
3614 ShouldUseTransitionCompositing(device_scale_factor_)); | |
3615 } | 3596 } |
3616 if (auto_resize_mode_) | 3597 if (auto_resize_mode_) |
3617 AutoResizeCompositor(); | 3598 AutoResizeCompositor(); |
3618 | 3599 |
3619 if (browser_plugin_manager_.get()) | 3600 if (browser_plugin_manager_.get()) |
3620 browser_plugin_manager_->UpdateDeviceScaleFactor(); | 3601 browser_plugin_manager_->UpdateDeviceScaleFactor(); |
3621 } | 3602 } |
3622 | 3603 |
3623 bool RenderViewImpl::SetDeviceColorProfile( | 3604 bool RenderViewImpl::SetDeviceColorProfile( |
3624 const std::vector<char>& profile) { | 3605 const std::vector<char>& profile) { |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4128 std::vector<gfx::Size> sizes; | 4109 std::vector<gfx::Size> sizes; |
4129 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4110 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4130 if (!url.isEmpty()) | 4111 if (!url.isEmpty()) |
4131 urls.push_back( | 4112 urls.push_back( |
4132 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4113 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4133 } | 4114 } |
4134 SendUpdateFaviconURL(urls); | 4115 SendUpdateFaviconURL(urls); |
4135 } | 4116 } |
4136 | 4117 |
4137 } // namespace content | 4118 } // namespace content |
OLD | NEW |