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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3144 return navigation_state; | 3144 return navigation_state; |
3145 } | 3145 } |
3146 | 3146 |
3147 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { | 3147 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { |
3148 bool enable_viewport = | 3148 bool enable_viewport = |
3149 command_line.HasSwitch(switches::kEnableViewport); | 3149 command_line.HasSwitch(switches::kEnableViewport); |
3150 bool enable_fixed_layout = | 3150 bool enable_fixed_layout = |
3151 command_line.HasSwitch(switches::kEnableFixedLayout); | 3151 command_line.HasSwitch(switches::kEnableFixedLayout); |
3152 bool enable_pinch = enable_viewport || | 3152 bool enable_pinch = enable_viewport || |
3153 command_line.HasSwitch(switches::kEnablePinch); | 3153 command_line.HasSwitch(switches::kEnablePinch); |
3154 bool enable_pinch_in_compositor = | |
3155 command_line.HasSwitch(switches::kEnablePinchInCompositor); | |
3154 | 3156 |
3155 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); | 3157 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); |
3156 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); | 3158 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); |
3157 if (!enable_pinch && | 3159 if (!enable_pinch && |
3158 webview()->isAcceleratedCompositingActive() && | 3160 webview()->isAcceleratedCompositingActive() && |
3159 webkit_preferences_.apply_default_device_scale_factor_in_compositor && | 3161 webkit_preferences_.apply_default_device_scale_factor_in_compositor && |
3160 device_scale_factor_ != 1) { | 3162 device_scale_factor_ != 1) { |
3161 // Page scaling is disabled by default when applying a scale factor in the | 3163 // Page scaling is disabled by default when applying a scale factor in the |
3162 // compositor since they are currently incompatible. | 3164 // compositor since they are currently incompatible. |
3163 webview()->setPageScaleFactorLimits(1, 1); | 3165 webview()->setPageScaleFactorLimits(1, 1); |
3164 } | 3166 } |
3165 | 3167 |
3168 if (enable_pinch_in_compositor && | |
3169 webview()->isAcceleratedCompositingActive()) | |
3170 webview()->setPageScaleFactorLimits(1, 4); | |
piman
2012/10/05 00:01:08
note: this is possibly racy. isAcceleratedComposit
Jeff Timanus
2012/10/05 00:05:34
If this is racey, are the other conditions also ra
piman
2012/10/05 00:25:51
Most likely, yes.
Jeff Timanus
2012/10/05 15:37:50
I'm not sure if fixing these races is appropriate
| |
3171 | |
3166 if (enable_viewport) { | 3172 if (enable_viewport) { |
3167 webview()->settings()->setViewportEnabled(true); | 3173 webview()->settings()->setViewportEnabled(true); |
3168 } else if (enable_fixed_layout) { | 3174 } else if (enable_fixed_layout) { |
3169 std::string str = | 3175 std::string str = |
3170 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); | 3176 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); |
3171 std::vector<std::string> tokens; | 3177 std::vector<std::string> tokens; |
3172 base::SplitString(str, ',', &tokens); | 3178 base::SplitString(str, ',', &tokens); |
3173 if (tokens.size() == 2) { | 3179 if (tokens.size() == 2) { |
3174 int width, height; | 3180 int width, height; |
3175 if (base::StringToInt(tokens[0], &width) && | 3181 if (base::StringToInt(tokens[0], &width) && |
(...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6325 | 6331 |
6326 updating_frame_tree_ = true; | 6332 updating_frame_tree_ = true; |
6327 active_frame_id_map_.clear(); | 6333 active_frame_id_map_.clear(); |
6328 | 6334 |
6329 target_process_id_ = process_id; | 6335 target_process_id_ = process_id; |
6330 target_routing_id_ = route_id; | 6336 target_routing_id_ = route_id; |
6331 CreateFrameTree(webview()->mainFrame(), frames); | 6337 CreateFrameTree(webview()->mainFrame(), frames); |
6332 | 6338 |
6333 updating_frame_tree_ = false; | 6339 updating_frame_tree_ = false; |
6334 } | 6340 } |
OLD | NEW |