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

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: Rebaselined to 160422. 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
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | webkit/compositor_bindings/WebCompositorImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 } 2458 }
2459 2459
2460 void RenderViewImpl::didActivateCompositor(int input_handler_identifier) { 2460 void RenderViewImpl::didActivateCompositor(int input_handler_identifier) {
2461 CompositorThread* compositor_thread = 2461 CompositorThread* compositor_thread =
2462 RenderThreadImpl::current()->compositor_thread(); 2462 RenderThreadImpl::current()->compositor_thread();
2463 if (compositor_thread) 2463 if (compositor_thread)
2464 compositor_thread->AddInputHandler( 2464 compositor_thread->AddInputHandler(
2465 routing_id_, input_handler_identifier, AsWeakPtr()); 2465 routing_id_, input_handler_identifier, AsWeakPtr());
2466 2466
2467 RenderWidget::didActivateCompositor(input_handler_identifier); 2467 RenderWidget::didActivateCompositor(input_handler_identifier);
2468
2469 ProcessAcceleratedPinchZoomFlags(*CommandLine::ForCurrentProcess());
2468 } 2470 }
2469 2471
2470 // WebKit::WebFrameClient ----------------------------------------------------- 2472 // WebKit::WebFrameClient -----------------------------------------------------
2471 2473
2472 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame, 2474 WebPlugin* RenderViewImpl::createPlugin(WebFrame* frame,
2473 const WebPluginParams& params) { 2475 const WebPluginParams& params) {
2474 WebPlugin* plugin = NULL; 2476 WebPlugin* plugin = NULL;
2475 if (content::GetContentClient()->renderer()->OverrideCreatePlugin( 2477 if (content::GetContentClient()->renderer()->OverrideCreatePlugin(
2476 this, frame, params, &plugin)) { 2478 this, frame, params, &plugin)) {
2477 return plugin; 2479 return plugin;
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
3137 navigation_state = NavigationState::CreateContentInitiated(); 3139 navigation_state = NavigationState::CreateContentInitiated();
3138 } 3140 }
3139 return navigation_state; 3141 return navigation_state;
3140 } 3142 }
3141 3143
3142 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) { 3144 void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
3143 bool enable_viewport = 3145 bool enable_viewport =
3144 command_line.HasSwitch(switches::kEnableViewport); 3146 command_line.HasSwitch(switches::kEnableViewport);
3145 bool enable_fixed_layout = 3147 bool enable_fixed_layout =
3146 command_line.HasSwitch(switches::kEnableFixedLayout); 3148 command_line.HasSwitch(switches::kEnableFixedLayout);
3147 bool enable_pinch = enable_viewport ||
3148 command_line.HasSwitch(switches::kEnablePinch);
3149 3149
3150 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport); 3150 webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport);
3151 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true); 3151 webview()->settings()->setFixedElementsLayoutRelativeToFrame(true);
3152 if (!enable_pinch &&
3153 webview()->isAcceleratedCompositingActive() &&
3154 webkit_preferences_.apply_default_device_scale_factor_in_compositor &&
3155 device_scale_factor_ != 1) {
3156 // Page scaling is disabled by default when applying a scale factor in the
3157 // compositor since they are currently incompatible.
3158 webview()->setPageScaleFactorLimits(1, 1);
3159 }
3160 3152
3161 if (enable_viewport) { 3153 if (enable_viewport) {
3162 webview()->settings()->setViewportEnabled(true); 3154 webview()->settings()->setViewportEnabled(true);
3163 } else if (enable_fixed_layout) { 3155 } else if (enable_fixed_layout) {
3164 std::string str = 3156 std::string str =
3165 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout); 3157 command_line.GetSwitchValueASCII(switches::kEnableFixedLayout);
3166 std::vector<std::string> tokens; 3158 std::vector<std::string> tokens;
3167 base::SplitString(str, ',', &tokens); 3159 base::SplitString(str, ',', &tokens);
3168 if (tokens.size() == 2) { 3160 if (tokens.size() == 2) {
3169 int width, height; 3161 int width, height;
3170 if (base::StringToInt(tokens[0], &width) && 3162 if (base::StringToInt(tokens[0], &width) &&
3171 base::StringToInt(tokens[1], &height)) 3163 base::StringToInt(tokens[1], &height))
3172 webview()->setFixedLayoutSize(WebSize(width, height)); 3164 webview()->setFixedLayoutSize(WebSize(width, height));
3173 } 3165 }
3174 } 3166 }
3167
3168 ProcessAcceleratedPinchZoomFlags(command_line);
3169 }
3170
3171 void RenderViewImpl::ProcessAcceleratedPinchZoomFlags(
3172 const CommandLine& command_line) {
3173 bool enable_viewport =
3174 command_line.HasSwitch(switches::kEnableViewport);
3175 bool enable_pinch = enable_viewport ||
3176 command_line.HasSwitch(switches::kEnablePinch);
3177 bool enable_pinch_in_compositor =
3178 command_line.HasSwitch(switches::kEnablePinchInCompositor);
3179
3180 if (!enable_pinch &&
3181 webview()->isAcceleratedCompositingActive() &&
3182 webkit_preferences_.apply_default_device_scale_factor_in_compositor &&
3183 device_scale_factor_ != 1) {
3184 // Page scaling is disabled by default when applying a scale factor in the
3185 // compositor since they are currently incompatible.
3186 webview()->setPageScaleFactorLimits(1, 1);
3187 }
3188
3189 if (enable_pinch_in_compositor &&
3190 webview()->isAcceleratedCompositingActive())
3191 webview()->setPageScaleFactorLimits(1, 4);
3175 } 3192 }
3176 3193
3177 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { 3194 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) {
3178 WebDataSource* ds = frame->provisionalDataSource(); 3195 WebDataSource* ds = frame->provisionalDataSource();
3179 DocumentState* document_state = DocumentState::FromDataSource(ds); 3196 DocumentState* document_state = DocumentState::FromDataSource(ds);
3180 3197
3181 // Update the request time if WebKit has better knowledge of it. 3198 // Update the request time if WebKit has better knowledge of it.
3182 if (document_state->request_time().is_null()) { 3199 if (document_state->request_time().is_null()) {
3183 double event_time = ds->triggeringEventTime(); 3200 double event_time = ds->triggeringEventTime();
3184 if (event_time != 0.0) 3201 if (event_time != 0.0)
(...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after
6321 6338
6322 updating_frame_tree_ = true; 6339 updating_frame_tree_ = true;
6323 active_frame_id_map_.clear(); 6340 active_frame_id_map_.clear();
6324 6341
6325 target_process_id_ = process_id; 6342 target_process_id_ = process_id;
6326 target_routing_id_ = route_id; 6343 target_routing_id_ = route_id;
6327 CreateFrameTree(webview()->mainFrame(), frames); 6344 CreateFrameTree(webview()->mainFrame(), frames);
6328 6345
6329 updating_frame_tree_ = false; 6346 updating_frame_tree_ = false;
6330 } 6347 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.h ('k') | webkit/compositor_bindings/WebCompositorImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698