| 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/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 // antialiasing won't have a noticeable effect on text quality. | 357 // antialiasing won't have a noticeable effect on text quality. |
| 358 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { | 358 static bool DeviceScaleEnsuresTextQuality(float device_scale_factor) { |
| 359 #if defined(OS_ANDROID) | 359 #if defined(OS_ANDROID) |
| 360 // On Android, we never have subpixel antialiasing. | 360 // On Android, we never have subpixel antialiasing. |
| 361 return true; | 361 return true; |
| 362 #else | 362 #else |
| 363 // 1.5 is a common touchscreen tablet device scale factor. For such | 363 // 1.5 is a common touchscreen tablet device scale factor. For such |
| 364 // devices main thread antialiasing is a heavy burden. | 364 // devices main thread antialiasing is a heavy burden. |
| 365 return device_scale_factor >= 1.5f; | 365 return device_scale_factor >= 1.5f; |
| 366 #endif | 366 #endif |
| 367 | |
| 368 } | 367 } |
| 369 | 368 |
| 370 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps, | 369 static bool PreferCompositingToLCDText(CompositorDependencies* compositor_deps, |
| 371 float device_scale_factor) { | 370 float device_scale_factor) { |
| 372 const base::CommandLine& command_line = | 371 const base::CommandLine& command_line = |
| 373 *base::CommandLine::ForCurrentProcess(); | 372 *base::CommandLine::ForCurrentProcess(); |
| 374 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) | 373 if (command_line.HasSwitch(switches::kDisablePreferCompositingToLCDText)) |
| 375 return false; | 374 return false; |
| 376 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) | 375 if (command_line.HasSwitch(switches::kEnablePreferCompositingToLCDText)) |
| 377 return true; | 376 return true; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, | 665 void RenderViewImpl::Initialize(const ViewMsg_New_Params& params, |
| 667 bool was_created_by_renderer) { | 666 bool was_created_by_renderer) { |
| 668 routing_id_ = params.view_id; | 667 routing_id_ = params.view_id; |
| 669 | 668 |
| 670 int opener_view_routing_id; | 669 int opener_view_routing_id; |
| 671 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( | 670 WebFrame* opener_frame = RenderFrameImpl::ResolveOpener( |
| 672 params.opener_frame_route_id, &opener_view_routing_id); | 671 params.opener_frame_route_id, &opener_view_routing_id); |
| 673 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) | 672 if (opener_view_routing_id != MSG_ROUTING_NONE && was_created_by_renderer) |
| 674 opener_id_ = opener_view_routing_id; | 673 opener_id_ = opener_view_routing_id; |
| 675 | 674 |
| 676 display_mode_= params.initial_size.display_mode; | 675 display_mode_ = params.initial_size.display_mode; |
| 677 | 676 |
| 678 // Ensure we start with a valid next_page_id_ from the browser. | 677 // Ensure we start with a valid next_page_id_ from the browser. |
| 679 DCHECK_GE(next_page_id_, 0); | 678 DCHECK_GE(next_page_id_, 0); |
| 680 | 679 |
| 681 webwidget_ = WebView::create(this); | 680 webwidget_ = WebView::create(this); |
| 682 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); | 681 webwidget_mouse_lock_target_.reset(new WebWidgetLockTarget(webwidget_)); |
| 683 | 682 |
| 684 g_view_map.Get().insert(std::make_pair(webview(), this)); | 683 g_view_map.Get().insert(std::make_pair(webview(), this)); |
| 685 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); | 684 g_routing_id_view_map.Get().insert(std::make_pair(routing_id_, this)); |
| 686 | 685 |
| (...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 if (plugin_find_handler_) | 2262 if (plugin_find_handler_) |
| 2264 return plugin_find_handler_->container()->plugin(); | 2263 return plugin_find_handler_->container()->plugin(); |
| 2265 #endif | 2264 #endif |
| 2266 | 2265 |
| 2267 return NULL; | 2266 return NULL; |
| 2268 } | 2267 } |
| 2269 | 2268 |
| 2270 void RenderViewImpl::OnFind(int request_id, | 2269 void RenderViewImpl::OnFind(int request_id, |
| 2271 const base::string16& search_text, | 2270 const base::string16& search_text, |
| 2272 const WebFindOptions& options) { | 2271 const WebFindOptions& options) { |
| 2272 DCHECK(!search_text.empty()); |
| 2273 |
| 2273 WebFrame* main_frame = webview()->mainFrame(); | 2274 WebFrame* main_frame = webview()->mainFrame(); |
| 2274 blink::WebPlugin* plugin = GetWebPluginForFind(); | 2275 blink::WebPlugin* plugin = GetWebPluginForFind(); |
| 2275 // Check if the plugin still exists in the document. | 2276 // Check if the plugin still exists in the document. |
| 2276 if (plugin) { | 2277 if (plugin) { |
| 2277 if (options.findNext) { | 2278 if (options.findNext) { |
| 2278 // Just navigate back/forward. | 2279 // Just navigate back/forward. |
| 2279 plugin->selectFindResult(options.forward); | 2280 plugin->selectFindResult(options.forward); |
| 2280 } else { | 2281 } else { |
| 2281 if (!plugin->startFind( | 2282 if (!plugin->startFind( |
| 2282 search_text, options.matchCase, request_id)) { | 2283 search_text, options.matchCase, request_id)) { |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3036 (*i)->PageVisibilityChanged(false); | 3037 (*i)->PageVisibilityChanged(false); |
| 3037 | 3038 |
| 3038 #if defined(OS_MACOSX) | 3039 #if defined(OS_MACOSX) |
| 3039 // Inform NPAPI plugins that their container is no longer visible. | 3040 // Inform NPAPI plugins that their container is no longer visible. |
| 3040 std::set<WebPluginDelegateProxy*>::iterator plugin_it; | 3041 std::set<WebPluginDelegateProxy*>::iterator plugin_it; |
| 3041 for (plugin_it = plugin_delegates_.begin(); | 3042 for (plugin_it = plugin_delegates_.begin(); |
| 3042 plugin_it != plugin_delegates_.end(); ++plugin_it) { | 3043 plugin_it != plugin_delegates_.end(); ++plugin_it) { |
| 3043 (*plugin_it)->SetContainerVisibility(false); | 3044 (*plugin_it)->SetContainerVisibility(false); |
| 3044 } | 3045 } |
| 3045 #endif // OS_MACOSX | 3046 #endif // OS_MACOSX |
| 3046 #endif // ENABLE_PLUGINS | 3047 #endif // ENABLE_PLUGINS |
| 3047 } | 3048 } |
| 3048 | 3049 |
| 3049 void RenderViewImpl::OnWasShown(bool needs_repainting, | 3050 void RenderViewImpl::OnWasShown(bool needs_repainting, |
| 3050 const ui::LatencyInfo& latency_info) { | 3051 const ui::LatencyInfo& latency_info) { |
| 3051 RenderWidget::OnWasShown(needs_repainting, latency_info); | 3052 RenderWidget::OnWasShown(needs_repainting, latency_info); |
| 3052 | 3053 |
| 3053 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) | 3054 #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) |
| 3054 RenderThreadImpl::current()->video_capture_impl_manager()-> | 3055 RenderThreadImpl::current()->video_capture_impl_manager()-> |
| 3055 SuspendDevices(false); | 3056 SuspendDevices(false); |
| 3056 #endif | 3057 #endif |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3719 if (IsUseZoomForDSFEnabled()) { | 3720 if (IsUseZoomForDSFEnabled()) { |
| 3720 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); | 3721 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); |
| 3721 webview()->setZoomFactorForDeviceScaleFactor( | 3722 webview()->setZoomFactorForDeviceScaleFactor( |
| 3722 device_scale_factor_); | 3723 device_scale_factor_); |
| 3723 } else { | 3724 } else { |
| 3724 webview()->setDeviceScaleFactor(device_scale_factor_); | 3725 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3725 } | 3726 } |
| 3726 } | 3727 } |
| 3727 | 3728 |
| 3728 } // namespace content | 3729 } // namespace content |
| OLD | NEW |