| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 if (RenderThreadImpl::current()) { | 737 if (RenderThreadImpl::current()) { |
| 738 RenderThreadImpl::current()->WidgetCreated(); | 738 RenderThreadImpl::current()->WidgetCreated(); |
| 739 if (is_hidden_) | 739 if (is_hidden_) |
| 740 RenderThreadImpl::current()->WidgetHidden(); | 740 RenderThreadImpl::current()->WidgetHidden(); |
| 741 } | 741 } |
| 742 | 742 |
| 743 // If this is a popup, we must wait for the CreatingNew_ACK message before | 743 // If this is a popup, we must wait for the CreatingNew_ACK message before |
| 744 // completing initialization. Otherwise, we can finish it now. | 744 // completing initialization. Otherwise, we can finish it now. |
| 745 if (opener_id_ == MSG_ROUTING_NONE) | 745 if (opener_id_ == MSG_ROUTING_NONE) |
| 746 did_show_ = true; | 746 did_show_ = true; |
| 747 UpdateDeviceScaleFactor(); | 747 UpdateWebViewWithDeviceScaleFactor(); |
| 748 webview()->setDisplayMode(display_mode_); | 748 webview()->setDisplayMode(display_mode_); |
| 749 webview()->settings()->setPreferCompositingToLCDTextEnabled( | 749 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 750 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | 750 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 751 webview()->settings()->setThreadedScrollingEnabled( | 751 webview()->settings()->setThreadedScrollingEnabled( |
| 752 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); | 752 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); |
| 753 webview()->settings()->setRootLayerScrolls( | 753 webview()->settings()->setRootLayerScrolls( |
| 754 command_line.HasSwitch(switches::kRootLayerScrolls)); | 754 command_line.HasSwitch(switches::kRootLayerScrolls)); |
| 755 | 755 |
| 756 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); | 756 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); |
| 757 | 757 |
| (...skipping 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3194 frame, replacement_range.start(), replacement_range.length()); | 3194 frame, replacement_range.start(), replacement_range.length()); |
| 3195 if (!webrange.isNull()) | 3195 if (!webrange.isNull()) |
| 3196 frame->selectRange(webrange); | 3196 frame->selectRange(webrange); |
| 3197 } | 3197 } |
| 3198 } | 3198 } |
| 3199 RenderWidget::OnImeConfirmComposition(text, | 3199 RenderWidget::OnImeConfirmComposition(text, |
| 3200 replacement_range, | 3200 replacement_range, |
| 3201 keep_selection); | 3201 keep_selection); |
| 3202 } | 3202 } |
| 3203 | 3203 |
| 3204 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) { | |
| 3205 RenderWidget::SetDeviceScaleFactor(device_scale_factor); | |
| 3206 if (webview()) { | |
| 3207 UpdateDeviceScaleFactor(); | |
| 3208 webview()->settings()->setPreferCompositingToLCDTextEnabled( | |
| 3209 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); | |
| 3210 } | |
| 3211 if (auto_resize_mode_) | |
| 3212 AutoResizeCompositor(); | |
| 3213 } | |
| 3214 | |
| 3215 bool RenderViewImpl::SetDeviceColorProfile( | 3204 bool RenderViewImpl::SetDeviceColorProfile( |
| 3216 const std::vector<char>& profile) { | 3205 const std::vector<char>& profile) { |
| 3217 bool changed = RenderWidget::SetDeviceColorProfile(profile); | 3206 bool changed = RenderWidget::SetDeviceColorProfile(profile); |
| 3218 if (changed && webview()) { | 3207 if (changed && webview()) { |
| 3219 WebVector<char> colorProfile = profile; | 3208 WebVector<char> colorProfile = profile; |
| 3220 webview()->setDeviceColorProfile(colorProfile); | 3209 webview()->setDeviceColorProfile(colorProfile); |
| 3221 } | 3210 } |
| 3222 return changed; | 3211 return changed; |
| 3223 } | 3212 } |
| 3224 | 3213 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3313 void RenderViewImpl::DidCompletePageScaleAnimation() { | 3302 void RenderViewImpl::DidCompletePageScaleAnimation() { |
| 3314 FocusChangeComplete(); | 3303 FocusChangeComplete(); |
| 3315 } | 3304 } |
| 3316 | 3305 |
| 3317 #if defined(OS_ANDROID) | 3306 #if defined(OS_ANDROID) |
| 3318 bool RenderViewImpl::DoesRecordFullLayer() const { | 3307 bool RenderViewImpl::DoesRecordFullLayer() const { |
| 3319 return webkit_preferences_.record_whole_document; | 3308 return webkit_preferences_.record_whole_document; |
| 3320 } | 3309 } |
| 3321 #endif | 3310 #endif |
| 3322 | 3311 |
| 3312 void RenderViewImpl::OnDeviceScaleFactorChanged() { |
| 3313 RenderWidget::OnDeviceScaleFactorChanged(); |
| 3314 UpdateWebViewWithDeviceScaleFactor(); |
| 3315 if (auto_resize_mode_) |
| 3316 AutoResizeCompositor(); |
| 3317 } |
| 3318 |
| 3323 void RenderViewImpl::SetScreenMetricsEmulationParameters( | 3319 void RenderViewImpl::SetScreenMetricsEmulationParameters( |
| 3324 bool enabled, | 3320 bool enabled, |
| 3325 const blink::WebDeviceEmulationParams& params) { | 3321 const blink::WebDeviceEmulationParams& params) { |
| 3326 if (webview() && compositor()) { | 3322 if (webview() && compositor()) { |
| 3327 if (enabled) | 3323 if (enabled) |
| 3328 webview()->enableDeviceEmulation(params); | 3324 webview()->enableDeviceEmulation(params); |
| 3329 else | 3325 else |
| 3330 webview()->disableDeviceEmulation(); | 3326 webview()->disableDeviceEmulation(); |
| 3331 } | 3327 } |
| 3332 } | 3328 } |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3704 WebURL url = icon_urls[i].iconURL(); | 3700 WebURL url = icon_urls[i].iconURL(); |
| 3705 std::vector<gfx::Size> sizes; | 3701 std::vector<gfx::Size> sizes; |
| 3706 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3702 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3707 if (!url.isEmpty()) | 3703 if (!url.isEmpty()) |
| 3708 urls.push_back( | 3704 urls.push_back( |
| 3709 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3705 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3710 } | 3706 } |
| 3711 SendUpdateFaviconURL(urls); | 3707 SendUpdateFaviconURL(urls); |
| 3712 } | 3708 } |
| 3713 | 3709 |
| 3714 void RenderViewImpl::UpdateDeviceScaleFactor() { | 3710 void RenderViewImpl::UpdateWebViewWithDeviceScaleFactor() { |
| 3711 if (!webview()) |
| 3712 return; |
| 3715 if (IsUseZoomForDSFEnabled()) { | 3713 if (IsUseZoomForDSFEnabled()) { |
| 3716 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); | 3714 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_); |
| 3717 webview()->setZoomFactorForDeviceScaleFactor( | |
| 3718 device_scale_factor_); | |
| 3719 } else { | 3715 } else { |
| 3720 webview()->setDeviceScaleFactor(device_scale_factor_); | 3716 webview()->setDeviceScaleFactor(device_scale_factor_); |
| 3721 } | 3717 } |
| 3718 webview()->settings()->setPreferCompositingToLCDTextEnabled( |
| 3719 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); |
| 3722 } | 3720 } |
| 3723 | 3721 |
| 3724 } // namespace content | 3722 } // namespace content |
| OLD | NEW |