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 3100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3111 return navigation_state; | 3111 return navigation_state; |
3112 } | 3112 } |
3113 | 3113 |
3114 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { | 3114 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { |
3115 bool enable_viewport = | 3115 bool enable_viewport = |
3116 command_line.HasSwitch(switches::kEnableViewport); | 3116 command_line.HasSwitch(switches::kEnableViewport); |
3117 bool enable_fixed_layout = | 3117 bool enable_fixed_layout = |
3118 command_line.HasSwitch(switches::kEnableFixedLayout); | 3118 command_line.HasSwitch(switches::kEnableFixedLayout); |
3119 bool enable_pinch = enable_viewport || | 3119 bool enable_pinch = enable_viewport || |
3120 command_line.HasSwitch(switches::kEnablePinch); | 3120 command_line.HasSwitch(switches::kEnablePinch); |
| 3121 bool enable_pinch_in_compositor = |
| 3122 command_line.HasSwitch(switches::kEnablePinchInCompositor); |
3121 | 3123 |
3122 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); | 3124 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); |
3123 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); | 3125 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); |
3124 if (!enable_pinch && | 3126 if (!enable_pinch && |
3125 webview()->isAcceleratedCompositingActive() && | 3127 webview()->isAcceleratedCompositingActive() && |
3126 webkit_preferences_.apply_default_device_scale_factor_in_compositor && | 3128 webkit_preferences_.apply_default_device_scale_factor_in_compositor && |
3127 device_scale_factor_ != 1) { | 3129 device_scale_factor_ != 1) { |
3128 // Page scaling is disabled by default when applying a scale factor in the | 3130 // Page scaling is disabled by default when applying a scale factor in the |
3129 // compositor since they are currently incompatible. | 3131 // compositor since they are currently incompatible. |
3130 webview()->setPageScaleFactorLimits(1, 1); | 3132 webview()->setPageScaleFactorLimits(1, 1); |
3131 } | 3133 } |
3132 | 3134 |
| 3135 if (enable_pinch_in_compositor && |
| 3136 webview()->isAcceleratedCompositingActive()) |
| 3137 webview()->setPageScaleFactorLimits(1, 4); |
| 3138 |
3133 if (enable_viewport) { | 3139 if (enable_viewport) { |
3134 webview()->settings()->setViewportEnabled(true); | 3140 webview()->settings()->setViewportEnabled(true); |
3135 } else if (enable_fixed_layout) { | 3141 } else if (enable_fixed_layout) { |
3136 std::string str = | 3142 std::string str = |
3137 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); | 3143 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); |
3138 std::vector<std::string> tokens; | 3144 std::vector<std::string> tokens; |
3139 base::SplitString(str, ',', &tokens); | 3145 base::SplitString(str, ',', &tokens); |
3140 if (tokens.size() == 2) { | 3146 if (tokens.size() == 2) { |
3141 int width, height; | 3147 int width, height; |
3142 if (base::StringToInt(tokens[0], &width) && | 3148 if (base::StringToInt(tokens[0], &width) && |
(...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6284 | 6290 |
6285 updating_frame_tree_ = true; | 6291 updating_frame_tree_ = true; |
6286 active_frame_id_map_.clear(); | 6292 active_frame_id_map_.clear(); |
6287 | 6293 |
6288 target_process_id_ = process_id; | 6294 target_process_id_ = process_id; |
6289 target_routing_id_ = route_id; | 6295 target_routing_id_ = route_id; |
6290 CreateFrameTree(webview()->mainFrame(), frames); | 6296 CreateFrameTree(webview()->mainFrame(), frames); |
6291 | 6297 |
6292 updating_frame_tree_ = false; | 6298 updating_frame_tree_ = false; |
6293 } | 6299 } |
OLD | NEW |