| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 586 |
| 587 if (command_line.HasSwitch(switches::kDisableCompositingForFixedPosition)) | 587 if (command_line.HasSwitch(switches::kDisableCompositingForFixedPosition)) |
| 588 return false; | 588 return false; |
| 589 | 589 |
| 590 if (command_line.HasSwitch(switches::kEnableCompositingForFixedPosition)) | 590 if (command_line.HasSwitch(switches::kEnableCompositingForFixedPosition)) |
| 591 return true; | 591 return true; |
| 592 | 592 |
| 593 return DeviceScaleEnsuresTextQuality(device_scale_factor); | 593 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 594 } | 594 } |
| 595 | 595 |
| 596 static bool ShouldUseAcceleratedCompositingForOverflowScroll( |
| 597 float device_scale_factor) { |
| 598 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 599 |
| 600 if (command_line.HasSwitch(switches::kEnableAcceleratedOverflowScroll)) |
| 601 return true; |
| 602 |
| 603 return DeviceScaleEnsuresTextQuality(device_scale_factor); |
| 604 } |
| 605 |
| 596 static bool ShouldUseTransitionCompositing(float device_scale_factor) { | 606 static bool ShouldUseTransitionCompositing(float device_scale_factor) { |
| 597 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 607 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 598 | 608 |
| 599 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) | 609 if (command_line.HasSwitch(switches::kDisableCompositingForTransition)) |
| 600 return false; | 610 return false; |
| 601 | 611 |
| 602 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) | 612 if (command_line.HasSwitch(switches::kEnableCompositingForTransition)) |
| 603 return true; | 613 return true; |
| 604 | 614 |
| 605 // TODO(ajuma): Re-enable this by default for high-DPI once the problem | 615 // TODO(ajuma): Re-enable this by default for high-DPI once the problem |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 if (opener_id_ == MSG_ROUTING_NONE) { | 885 if (opener_id_ == MSG_ROUTING_NONE) { |
| 876 did_show_ = true; | 886 did_show_ = true; |
| 877 CompleteInit(); | 887 CompleteInit(); |
| 878 } | 888 } |
| 879 | 889 |
| 880 g_view_map.Get().insert(std::make_pair(webview(), this)); | 890 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 881 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 891 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 882 webview()->setDeviceScaleFactor(device_scale_factor_); | 892 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 883 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 893 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
| 884 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 894 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
| 895 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 896 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
| 885 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 897 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 886 ShouldUseTransitionCompositing(device_scale_factor_)); | 898 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 887 | 899 |
| 888 webkit_glue::ApplyWebPreferences(webkit_preferences_, webview()); | 900 webkit_glue::ApplyWebPreferences(webkit_preferences_, webview()); |
| 889 webview()->initializeMainFrame(this); | 901 webview()->initializeMainFrame(this); |
| 890 | 902 |
| 891 if (switches::IsTouchDragDropEnabled()) | 903 if (switches::IsTouchDragDropEnabled()) |
| 892 webview()->settings()->setTouchDragDropEnabled(true); | 904 webview()->settings()->setTouchDragDropEnabled(true); |
| 893 | 905 |
| 894 if (switches::IsTouchEditingEnabled()) | 906 if (switches::IsTouchEditingEnabled()) |
| (...skipping 5318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6213 RenderWidget::OnImeConfirmComposition(text, replacement_range); | 6225 RenderWidget::OnImeConfirmComposition(text, replacement_range); |
| 6214 } | 6226 } |
| 6215 } | 6227 } |
| 6216 | 6228 |
| 6217 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | 6229 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { |
| 6218 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | 6230 RenderWidget::SetDeviceScaleFactor(device_scale_factor); |
| 6219 if (webview()) { | 6231 if (webview()) { |
| 6220 webview()->setDeviceScaleFactor(device_scale_factor); | 6232 webview()->setDeviceScaleFactor(device_scale_factor); |
| 6221 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( | 6233 webview()->settings()->setAcceleratedCompositingForFixedPositionEnabled( |
| 6222 ShouldUseFixedPositionCompositing(device_scale_factor_)); | 6234 ShouldUseFixedPositionCompositing(device_scale_factor_)); |
| 6235 webview()->settings()->setAcceleratedCompositingForOverflowScrollEnabled( |
| 6236 ShouldUseAcceleratedCompositingForOverflowScroll(device_scale_factor_)); |
| 6223 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( | 6237 webview()->settings()->setAcceleratedCompositingForTransitionEnabled( |
| 6224 ShouldUseTransitionCompositing(device_scale_factor_)); | 6238 ShouldUseTransitionCompositing(device_scale_factor_)); |
| 6225 } | 6239 } |
| 6226 if (auto_resize_mode_) | 6240 if (auto_resize_mode_) |
| 6227 AutoResizeCompositor(); | 6241 AutoResizeCompositor(); |
| 6228 | 6242 |
| 6229 if (browser_plugin_manager_.get()) | 6243 if (browser_plugin_manager_.get()) |
| 6230 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); | 6244 browser_plugin_manager_->UpdateDeviceScaleFactor(device_scale_factor_); |
| 6231 } | 6245 } |
| 6232 | 6246 |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6765 WebURL url = icon_urls[i].iconURL(); | 6779 WebURL url = icon_urls[i].iconURL(); |
| 6766 if (!url.isEmpty()) | 6780 if (!url.isEmpty()) |
| 6767 urls.push_back(FaviconURL(url, | 6781 urls.push_back(FaviconURL(url, |
| 6768 ToFaviconType(icon_urls[i].iconType()))); | 6782 ToFaviconType(icon_urls[i].iconType()))); |
| 6769 } | 6783 } |
| 6770 SendUpdateFaviconURL(urls); | 6784 SendUpdateFaviconURL(urls); |
| 6771 } | 6785 } |
| 6772 | 6786 |
| 6773 | 6787 |
| 6774 } // namespace content | 6788 } // namespace content |
| OLD | NEW |