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 3129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 return navigation_state; | 3140 return navigation_state; |
3141 } | 3141 } |
3142 | 3142 |
3143 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { | 3143 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { |
3144 bool enable_viewport = | 3144 bool enable_viewport = |
3145 command_line.HasSwitch(switches::kEnableViewport); | 3145 command_line.HasSwitch(switches::kEnableViewport); |
3146 bool enable_fixed_layout = | 3146 bool enable_fixed_layout = |
3147 command_line.HasSwitch(switches::kEnableFixedLayout); | 3147 command_line.HasSwitch(switches::kEnableFixedLayout); |
3148 bool enable_pinch = enable_viewport || | 3148 bool enable_pinch = enable_viewport || |
3149 command_line.HasSwitch(switches::kEnablePinch); | 3149 command_line.HasSwitch(switches::kEnablePinch); |
| 3150 bool enable_pinch_in_compositor = |
| 3151 command_line.HasSwitch(switches::kEnablePinchInCompositor); |
3150 | 3152 |
3151 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); | 3153 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); |
3152 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); | 3154 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); |
3153 if (!enable_pinch && | 3155 if (!enable_pinch && |
3154 webview()->isAcceleratedCompositingActive() && | 3156 webview()->isAcceleratedCompositingActive() && |
3155 webkit_preferences_.apply_default_device_scale_factor_in_compositor && | 3157 webkit_preferences_.apply_default_device_scale_factor_in_compositor && |
3156 device_scale_factor_ != 1) { | 3158 device_scale_factor_ != 1) { |
3157 // Page scaling is disabled by default when applying a scale factor in the | 3159 // Page scaling is disabled by default when applying a scale factor in the |
3158 // compositor since they are currently incompatible. | 3160 // compositor since they are currently incompatible. |
3159 webview()->setPageScaleFactorLimits(1, 1); | 3161 webview()->setPageScaleFactorLimits(1, 1); |
3160 } | 3162 } |
3161 | 3163 |
| 3164 if (enable_pinch_in_compositor && |
| 3165 webview()->isAcceleratedCompositingActive()) |
| 3166 webview()->setPageScaleFactorLimits(1, 4); |
| 3167 |
3162 if (enable_viewport) { | 3168 if (enable_viewport) { |
3163 webview()->settings()->setViewportEnabled(true); | 3169 webview()->settings()->setViewportEnabled(true); |
3164 } else if (enable_fixed_layout) { | 3170 } else if (enable_fixed_layout) { |
3165 std::string str = | 3171 std::string str = |
3166 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); | 3172 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); |
3167 std::vector<std::string> tokens; | 3173 std::vector<std::string> tokens; |
3168 base::SplitString(str, ',', &tokens); | 3174 base::SplitString(str, ',', &tokens); |
3169 if (tokens.size() == 2) { | 3175 if (tokens.size() == 2) { |
3170 int width, height; | 3176 int width, height; |
3171 if (base::StringToInt(tokens[0], &width) && | 3177 if (base::StringToInt(tokens[0], &width) && |
(...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6313 | 6319 |
6314 updating_frame_tree_ = true; | 6320 updating_frame_tree_ = true; |
6315 active_frame_id_map_.clear(); | 6321 active_frame_id_map_.clear(); |
6316 | 6322 |
6317 target_process_id_ = process_id; | 6323 target_process_id_ = process_id; |
6318 target_routing_id_ = route_id; | 6324 target_routing_id_ = route_id; |
6319 CreateFrameTree(webview()->mainFrame(), frames); | 6325 CreateFrameTree(webview()->mainFrame(), frames); |
6320 | 6326 |
6321 updating_frame_tree_ = false; | 6327 updating_frame_tree_ = false; |
6322 } | 6328 } |
OLD | NEW |