Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 10916279: Chromium compositor change implementing page-scale driven pinch-zoom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Rebaseline to 158365. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 return navigation_state; 3099 return navigation_state;
3100 } 3100 }
3101 3101
3102 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { 3102 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
3103 bool enable_viewport = 3103 bool enable_viewport =
3104 command_line.HasSwitch(switches::kEnableViewport); 3104 command_line.HasSwitch(switches::kEnableViewport);
3105 bool enable_fixed_layout = 3105 bool enable_fixed_layout =
3106 command_line.HasSwitch(switches::kEnableFixedLayout); 3106 command_line.HasSwitch(switches::kEnableFixedLayout);
3107 bool enable_pinch = enable_viewport || 3107 bool enable_pinch = enable_viewport ||
3108 command_line.HasSwitch(switches::kEnablePinch); 3108 command_line.HasSwitch(switches::kEnablePinch);
3109 bool enable_pinch_in_compositor =
3110 command_line.HasSwitch(switches::kEnablePinchInCompositor);
3109 3111
3110 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); 3112 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport);
3111 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); 3113 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true);
3112 if (!enable_pinch && 3114 if (!enable_pinch &&
3113 webview()->isAcceleratedCompositingActive() && 3115 webview()->isAcceleratedCompositingActive() &&
3114 webkit_preferences_.apply_default_device_scale_factor_in_compositor && 3116 webkit_preferences_.apply_default_device_scale_factor_in_compositor &&
3115 device_scale_factor_ != 1) { 3117 device_scale_factor_ != 1) {
3116 // Page scaling is disabled by default when applying a scale factor in the 3118 // Page scaling is disabled by default when applying a scale factor in the
3117 // compositor since they are currently incompatible. 3119 // compositor since they are currently incompatible.
3118 webview()->setPageScaleFactorLimits(1, 1); 3120 webview()->setPageScaleFactorLimits(1, 1);
3119 } 3121 }
3120 3122
3123 if (enable_pinch_in_compositor &&
3124 webview()->isAcceleratedCompositingActive()) {
3125 webview()->setPageScaleFactorLimits(1, 4);
3126 }
3127
3121 if (enable_viewport) { 3128 if (enable_viewport) {
3122 webview()->settings()->setViewportEnabled(true); 3129 webview()->settings()->setViewportEnabled(true);
3123 } else if (enable_fixed_layout) { 3130 } else if (enable_fixed_layout) {
3124 std::string str = 3131 std::string str =
3125 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); 3132 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout);
3126 std::vector<std::string> tokens; 3133 std::vector<std::string> tokens;
3127 base::SplitString(str, ',', &tokens); 3134 base::SplitString(str, ',', &tokens);
3128 if (tokens.size() == 2) { 3135 if (tokens.size() == 2) {
3129 int width, height; 3136 int width, height;
3130 if (base::StringToInt(tokens[0], &width) && 3137 if (base::StringToInt(tokens[0], &width) &&
(...skipping 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after
6272 6279
6273 updating_frame_tree_ = true; 6280 updating_frame_tree_ = true;
6274 active_frame_id_map_.clear(); 6281 active_frame_id_map_.clear();
6275 6282
6276 target_process_id_ = process_id; 6283 target_process_id_ = process_id;
6277 target_routing_id_ = route_id; 6284 target_routing_id_ = route_id;
6278 CreateFrameTree(webview()->mainFrame(), frames); 6285 CreateFrameTree(webview()->mainFrame(), frames);
6279 6286
6280 updating_frame_tree_ = false; 6287 updating_frame_tree_ = false;
6281 } 6288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698