| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 3066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3077 return navigation_state; | 3077 return navigation_state; |
| 3078 } | 3078 } |
| 3079 | 3079 |
| 3080 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { | 3080 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { |
| 3081 bool enable_viewport = | 3081 bool enable_viewport = |
| 3082 command_line.HasSwitch(switches::kEnableViewport); | 3082 command_line.HasSwitch(switches::kEnableViewport); |
| 3083 bool enable_fixed_layout = | 3083 bool enable_fixed_layout = |
| 3084 command_line.HasSwitch(switches::kEnableFixedLayout); | 3084 command_line.HasSwitch(switches::kEnableFixedLayout); |
| 3085 bool enable_pinch = enable_viewport || | 3085 bool enable_pinch = enable_viewport || |
| 3086 command_line.HasSwitch(switches::kEnablePinch); | 3086 command_line.HasSwitch(switches::kEnablePinch); |
| 3087 bool enable_pinch_in_compositor = |
| 3088 command_line.HasSwitch(switches::kEnablePinchInCompositor); |
| 3087 | 3089 |
| 3088 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); | 3090 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); |
| 3089 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); | 3091 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); |
| 3090 if (!enable_pinch && | 3092 if (!enable_pinch && |
| 3091 webview()->isAcceleratedCompositingActive() && | 3093 webview()->isAcceleratedCompositingActive() && |
| 3092 webkit_preferences_.apply_default_device_scale_factor_in_compositor && | 3094 webkit_preferences_.apply_default_device_scale_factor_in_compositor && |
| 3093 device_scale_factor_ != 1) { | 3095 device_scale_factor_ != 1) { |
| 3094 // Page scaling is disabled by default when applying a scale factor in the | 3096 // Page scaling is disabled by default when applying a scale factor in the |
| 3095 // compositor since they are currently incompatible. | 3097 // compositor since they are currently incompatible. |
| 3096 webview()->setPageScaleFactorLimits(1, 1); | 3098 webview()->setPageScaleFactorLimits(1, 1); |
| 3097 } | 3099 } |
| 3098 | 3100 |
| 3101 if (enable_pinch_in_compositor && |
| 3102 webview()->isAcceleratedCompositingActive()) { |
| 3103 webview()->setPageScaleFactorLimits(1, 4); |
| 3104 } |
| 3105 |
| 3099 if (enable_viewport) { | 3106 if (enable_viewport) { |
| 3100 webview()->settings()->setViewportEnabled(true); | 3107 webview()->settings()->setViewportEnabled(true); |
| 3101 } else if (enable_fixed_layout) { | 3108 } else if (enable_fixed_layout) { |
| 3102 std::string str = | 3109 std::string str = |
| 3103 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); | 3110 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); |
| 3104 std::vector<std::string> tokens; | 3111 std::vector<std::string> tokens; |
| 3105 base::SplitString(str, ',', &tokens); | 3112 base::SplitString(str, ',', &tokens); |
| 3106 if (tokens.size() == 2) { | 3113 if (tokens.size() == 2) { |
| 3107 int width, height; | 3114 int width, height; |
| 3108 if (base::StringToInt(tokens[0], &width) && | 3115 if (base::StringToInt(tokens[0], &width) && |
| (...skipping 3130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6239 | 6246 |
| 6240 updating_frame_tree_ = true; | 6247 updating_frame_tree_ = true; |
| 6241 active_frame_id_map_.clear(); | 6248 active_frame_id_map_.clear(); |
| 6242 | 6249 |
| 6243 target_process_id_ = process_id; | 6250 target_process_id_ = process_id; |
| 6244 target_routing_id_ = route_id; | 6251 target_routing_id_ = route_id; |
| 6245 CreateFrameTree(webview()->mainFrame(), frames); | 6252 CreateFrameTree(webview()->mainFrame(), frames); |
| 6246 | 6253 |
| 6247 updating_frame_tree_ = false; | 6254 updating_frame_tree_ = false; |
| 6248 } | 6255 } |
| OLD | NEW |