| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 3157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 base::StringToInt(tokens[1], &height)) | 3168 base::StringToInt(tokens[1], &height)) |
| 3169 webview()->setFixedLayoutSize(WebSize(width, height)); | 3169 webview()->setFixedLayoutSize(WebSize(width, height)); |
| 3170 } | 3170 } |
| 3171 } | 3171 } |
| 3172 | 3172 |
| 3173 ProcessAcceleratedPinchZoomFlags(command_line); | 3173 ProcessAcceleratedPinchZoomFlags(command_line); |
| 3174 } | 3174 } |
| 3175 | 3175 |
| 3176 void RenderViewImpl::ProcessAcceleratedPinchZoomFlags( | 3176 void RenderViewImpl::ProcessAcceleratedPinchZoomFlags( |
| 3177 const CommandLine& command_line) { | 3177 const CommandLine& command_line) { |
| 3178 bool enable_viewport = | 3178 if (!webview()->isAcceleratedCompositingActive()) |
| 3179 command_line.HasSwitch(switches::kEnableViewport); | 3179 return; |
| 3180 bool enable_pinch = enable_viewport || | |
| 3181 command_line.HasSwitch(switches::kEnablePinch); | |
| 3182 bool enable_pinch_in_compositor = | |
| 3183 command_line.HasSwitch(cc::switches::kEnablePinchInCompositor); | |
| 3184 | 3180 |
| 3185 if (!enable_pinch && | 3181 bool enable_viewport = command_line.HasSwitch(switches::kEnableViewport); |
| 3186 webview()->isAcceleratedCompositingActive() && | 3182 bool enable_pinch = command_line.HasSwitch(switches::kEnablePinch); |
| 3187 webkit_preferences_.apply_default_device_scale_factor_in_compositor && | 3183 |
| 3188 device_scale_factor_ != 1) { | 3184 if (enable_viewport) |
| 3189 // Page scaling is disabled by default when applying a scale factor in the | 3185 return; |
| 3190 // compositor since they are currently incompatible. | 3186 |
| 3187 if (enable_pinch) |
| 3188 webview()->setPageScaleFactorLimits(1, 4); |
| 3189 else |
| 3191 webview()->setPageScaleFactorLimits(1, 1); | 3190 webview()->setPageScaleFactorLimits(1, 1); |
| 3192 } | |
| 3193 | |
| 3194 if (enable_pinch_in_compositor && | |
| 3195 webview()->isAcceleratedCompositingActive()) | |
| 3196 webview()->setPageScaleFactorLimits(1, 4); | |
| 3197 } | 3191 } |
| 3198 | 3192 |
| 3199 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { | 3193 void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { |
| 3200 WebDataSource* ds = frame->provisionalDataSource(); | 3194 WebDataSource* ds = frame->provisionalDataSource(); |
| 3201 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3195 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3202 | 3196 |
| 3203 // Update the request time if WebKit has better knowledge of it. | 3197 // Update the request time if WebKit has better knowledge of it. |
| 3204 if (document_state->request_time().is_null()) { | 3198 if (document_state->request_time().is_null()) { |
| 3205 double event_time = ds->triggeringEventTime(); | 3199 double event_time = ds->triggeringEventTime(); |
| 3206 if (event_time != 0.0) | 3200 if (event_time != 0.0) |
| (...skipping 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6438 } | 6432 } |
| 6439 #endif | 6433 #endif |
| 6440 | 6434 |
| 6441 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( | 6435 void RenderViewImpl::OnReleaseDisambiguationPopupDIB( |
| 6442 TransportDIB::Handle dib_handle) { | 6436 TransportDIB::Handle dib_handle) { |
| 6443 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); | 6437 TransportDIB* dib = TransportDIB::CreateWithHandle(dib_handle); |
| 6444 RenderProcess::current()->ReleaseTransportDIB(dib); | 6438 RenderProcess::current()->ReleaseTransportDIB(dib); |
| 6445 } | 6439 } |
| 6446 | 6440 |
| 6447 } // namespace content | 6441 } // namespace content |
| OLD | NEW |