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

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

Issue 1456753002: Compute the popup location/size correctly when use-zoom-for-dsf is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 if (RenderThreadImpl::current()) { 727 if (RenderThreadImpl::current()) {
728 RenderThreadImpl::current()->WidgetCreated(); 728 RenderThreadImpl::current()->WidgetCreated();
729 if (is_hidden_) 729 if (is_hidden_)
730 RenderThreadImpl::current()->WidgetHidden(); 730 RenderThreadImpl::current()->WidgetHidden();
731 } 731 }
732 732
733 // If this is a popup, we must wait for the CreatingNew_ACK message before 733 // If this is a popup, we must wait for the CreatingNew_ACK message before
734 // completing initialization. Otherwise, we can finish it now. 734 // completing initialization. Otherwise, we can finish it now.
735 if (opener_id_ == MSG_ROUTING_NONE) 735 if (opener_id_ == MSG_ROUTING_NONE)
736 did_show_ = true; 736 did_show_ = true;
737 UpdateDeviceScaleFactor(); 737 UpdateWebViewWithDeviceScaleFactor();
738 webview()->setDisplayMode(display_mode_); 738 webview()->setDisplayMode(display_mode_);
739 webview()->settings()->setPreferCompositingToLCDTextEnabled( 739 webview()->settings()->setPreferCompositingToLCDTextEnabled(
740 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_)); 740 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
741 webview()->settings()->setThreadedScrollingEnabled( 741 webview()->settings()->setThreadedScrollingEnabled(
742 !command_line.HasSwitch(switches::kDisableThreadedScrolling)); 742 !command_line.HasSwitch(switches::kDisableThreadedScrolling));
743 webview()->settings()->setRootLayerScrolls( 743 webview()->settings()->setRootLayerScrolls(
744 command_line.HasSwitch(switches::kRootLayerScrolls)); 744 command_line.HasSwitch(switches::kRootLayerScrolls));
745 745
746 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_); 746 ApplyWebPreferencesInternal(webkit_preferences_, webview(), compositor_deps_);
747 747
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 frame, replacement_range.start(), replacement_range.length()); 3196 frame, replacement_range.start(), replacement_range.length());
3197 if (!webrange.isNull()) 3197 if (!webrange.isNull())
3198 frame->selectRange(webrange); 3198 frame->selectRange(webrange);
3199 } 3199 }
3200 } 3200 }
3201 RenderWidget::OnImeConfirmComposition(text, 3201 RenderWidget::OnImeConfirmComposition(text,
3202 replacement_range, 3202 replacement_range,
3203 keep_selection); 3203 keep_selection);
3204 } 3204 }
3205 3205
3206 void RenderViewImpl::SetDeviceScaleFactor(float device_scale_factor) {
3207 RenderWidget::SetDeviceScaleFactor(device_scale_factor);
3208 if (webview()) {
3209 UpdateDeviceScaleFactor();
3210 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3211 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3212 }
3213 if (auto_resize_mode_)
3214 AutoResizeCompositor();
3215 }
3216
3217 bool RenderViewImpl::SetDeviceColorProfile( 3206 bool RenderViewImpl::SetDeviceColorProfile(
3218 const std::vector<char>& profile) { 3207 const std::vector<char>& profile) {
3219 bool changed = RenderWidget::SetDeviceColorProfile(profile); 3208 bool changed = RenderWidget::SetDeviceColorProfile(profile);
3220 if (changed && webview()) { 3209 if (changed && webview()) {
3221 WebVector<char> colorProfile = profile; 3210 WebVector<char> colorProfile = profile;
3222 webview()->setDeviceColorProfile(colorProfile); 3211 webview()->setDeviceColorProfile(colorProfile);
3223 } 3212 }
3224 return changed; 3213 return changed;
3225 } 3214 }
3226 3215
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
3309 if (focused_pepper_plugin_) 3298 if (focused_pepper_plugin_)
3310 return focused_pepper_plugin_->IsPluginAcceptingCompositionEvents(); 3299 return focused_pepper_plugin_->IsPluginAcceptingCompositionEvents();
3311 #endif 3300 #endif
3312 return true; 3301 return true;
3313 } 3302 }
3314 3303
3315 void RenderViewImpl::DidCompletePageScaleAnimation() { 3304 void RenderViewImpl::DidCompletePageScaleAnimation() {
3316 FocusChangeComplete(); 3305 FocusChangeComplete();
3317 } 3306 }
3318 3307
3308 void RenderViewImpl::OnDeviceScaleFactorChanged() {
3309 RenderWidget::OnDeviceScaleFactorChanged();
3310 UpdateWebViewWithDeviceScaleFactor();
3311 if (auto_resize_mode_)
3312 AutoResizeCompositor();
3313 }
3314
3319 void RenderViewImpl::SetScreenMetricsEmulationParameters( 3315 void RenderViewImpl::SetScreenMetricsEmulationParameters(
3320 bool enabled, 3316 bool enabled,
3321 const blink::WebDeviceEmulationParams& params) { 3317 const blink::WebDeviceEmulationParams& params) {
3322 if (webview() && compositor()) { 3318 if (webview() && compositor()) {
3323 if (enabled) 3319 if (enabled)
3324 webview()->enableDeviceEmulation(params); 3320 webview()->enableDeviceEmulation(params);
3325 else 3321 else
3326 webview()->disableDeviceEmulation(); 3322 webview()->disableDeviceEmulation();
3327 } 3323 }
3328 } 3324 }
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
3699 WebURL url = icon_urls[i].iconURL(); 3695 WebURL url = icon_urls[i].iconURL();
3700 std::vector<gfx::Size> sizes; 3696 std::vector<gfx::Size> sizes;
3701 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 3697 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
3702 if (!url.isEmpty()) 3698 if (!url.isEmpty())
3703 urls.push_back( 3699 urls.push_back(
3704 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 3700 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
3705 } 3701 }
3706 SendUpdateFaviconURL(urls); 3702 SendUpdateFaviconURL(urls);
3707 } 3703 }
3708 3704
3709 void RenderViewImpl::UpdateDeviceScaleFactor() { 3705 void RenderViewImpl::UpdateWebViewWithDeviceScaleFactor() {
3706 if (!webview())
3707 return;
3710 if (IsUseZoomForDSFEnabled()) { 3708 if (IsUseZoomForDSFEnabled()) {
3711 compositor_->SetPaintedDeviceScaleFactor(device_scale_factor_); 3709 webview()->setZoomFactorForDeviceScaleFactor(device_scale_factor_);
3712 webview()->setZoomFactorForDeviceScaleFactor(
3713 device_scale_factor_);
3714 } else { 3710 } else {
3715 webview()->setDeviceScaleFactor(device_scale_factor_); 3711 webview()->setDeviceScaleFactor(device_scale_factor_);
3716 } 3712 }
3713 webview()->settings()->setPreferCompositingToLCDTextEnabled(
3714 PreferCompositingToLCDText(compositor_deps_, device_scale_factor_));
3717 } 3715 }
3718 3716
3719 } // namespace content 3717 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698