| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 | 598 |
| 599 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) | 599 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) |
| 600 return false; | 600 return false; |
| 601 | 601 |
| 602 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) | 602 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) |
| 603 return true; | 603 return true; |
| 604 | 604 |
| 605 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 605 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 606 } | 606 } |
| 607 | 607 |
| 608 static bool ShouldUseAcceleratedFixedRootBackground(float device_scale_factor) { |
| 609 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 610 |
| 611 if (command_line.HasSwitch(switches::kDisableAcceleratedFixedRootBackground)) |
| 612 return false; |
| 613 |
| 614 if (command_line.HasSwitch(switches::kEnableAcceleratedFixedRootBackground)) |
| 615 return true; |
| 616 |
| 617 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 618 } |
| 619 |
| 608 static FaviconURL::IconType ToFaviconType(WebKit::WebIconURL::Type type) { | 620 static FaviconURL::IconType ToFaviconType(WebKit::WebIconURL::Type type) { |
| 609 switch (type) { | 621 switch (type) { |
| 610 case WebKit::WebIconURL::TypeFavicon: | 622 case WebKit::WebIconURL::TypeFavicon: |
| 611 return FaviconURL::FAVICON; | 623 return FaviconURL::FAVICON; |
| 612 case WebKit::WebIconURL::TypeTouch: | 624 case WebKit::WebIconURL::TypeTouch: |
| 613 return FaviconURL::TOUCH_ICON; | 625 return FaviconURL::TOUCH_ICON; |
| 614 case WebKit::WebIconURL::TypeTouchPrecomposed: | 626 case WebKit::WebIconURL::TypeTouchPrecomposed: |
| 615 return FaviconURL::TOUCH_PRECOMPOSED_ICON; | 627 return FaviconURL::TOUCH_PRECOMPOSED_ICON; |
| 616 case WebKit::WebIconURL::TypeInvalid: | 628 case WebKit::WebIconURL::TypeInvalid: |
| 617 return FaviconURL::INVALID_ICON; | 629 return FaviconURL::INVALID_ICON; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 CompleteInit(); | 883 CompleteInit(); |
| 872 } | 884 } |
| 873 | 885 |
| 874 g_view_map.Get().insert(std::make_pair(webview(), this)); | 886 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 875 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 887 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 876 webview()->setDeviceScaleFactor(device_scale_factor_); | 888 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 877 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 889 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
| 878 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 890 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
| 879 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 891 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 880 ShouldUseTransitionCompositing(device_scale_factor_)); | 892 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 893 webview()->settings()->setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 894 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
| 881 | 895 |
| 882 webkit_glue::ApplyWebPreferences(webkit_preferences_, webview()); | 896 webkit_glue::ApplyWebPreferences(webkit_preferences_, webview()); |
| 883 webview()->initializeMainFrame(this); | 897 webview()->initializeMainFrame(this); |
| 884 | 898 |
| 885 if (switches::IsTouchDragDropEnabled()) | 899 if (switches::IsTouchDragDropEnabled()) |
| 886 webview()->settings()->setTouchDragDropEnabled(true); | 900 webview()->settings()->setTouchDragDropEnabled(true); |
| 887 | 901 |
| 888 if (switches::IsTouchEditingEnabled()) | 902 if (switches::IsTouchEditingEnabled()) |
| 889 webview()->settings()->setTouchEditingEnabled(true); | 903 webview()->settings()->setTouchEditingEnabled(true); |
| 890 | 904 |
| (...skipping 5299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6190 } | 6204 } |
| 6191 | 6205 |
| 6192 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 6206 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 6193 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 6207 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 6194 if (webview()) { | 6208 if (webview()) { |
| 6195 webview()->setDeviceScaleFactor(device_scale_factor); | 6209 webview()->setDeviceScaleFactor(device_scale_factor); |
| 6196 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 6210 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
| 6197 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 6211 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
| 6198 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 6212 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 6199 ShouldUseTransitionCompositing(device_scale_factor_)); | 6213 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 6214 webview()->settings()-> |
| 6215 setAcceleratedCompositingForFixedRootBackgroundEnabled( |
| 6216 ShouldUseAcceleratedFixedRootBackground(device_scale_factor_)); |
| 6200 } | 6217 } |
| 6201 if (auto_resize_mode_) | 6218 if (auto_resize_mode_) |
| 6202 AutoResizeCompositor(); | 6219 AutoResizeCompositor(); |
| 6203 | 6220 |
| 6204 if (browser_plugin_manager_.get()) | 6221 if (browser_plugin_manager_.get()) |
| 6205 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); | 6222 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); |
| 6206 } | 6223 } |
| 6207 | 6224 |
| 6208 ui::TextInputType RenderViewImpl::GetTextInputType() { | 6225 ui::TextInputType RenderViewImpl::GetTextInputType() { |
| 6209 return pepper_helper_->IsPluginFocused() ? | 6226 return pepper_helper_->IsPluginFocused() ? |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6716 WebURL url = icon_urls[i].iconURL(); | 6733 WebURL url = icon_urls[i].iconURL(); |
| 6717 if (!url.isEmpty()) | 6734 if (!url.isEmpty()) |
| 6718 urls.push_back(FaviconURL(url, | 6735 urls.push_back(FaviconURL(url, |
| 6719 ToFaviconType(icon_urls[i].iconType()))); | 6736 ToFaviconType(icon_urls[i].iconType()))); |
| 6720 } | 6737 } |
| 6721 SendUpdateFaviconURL(urls); | 6738 SendUpdateFaviconURL(urls); |
| 6722 } | 6739 } |
| 6723 | 6740 |
| 6724 | 6741 |
| 6725 } // namespace content | 6742 } // namespace content |
| OLD | NEW |