summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 22:40:57 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 22:40:57 +0000
commit60051ecd861a6bb0ddb821a4e6dbce953fff9884 (patch)
tree6efbbcbc654900f3dd241ff47bc03d68e65b3cca
parent4326fe52ca81a709b944bbad8b7342b1da2a1d5e (diff)
downloadchromium_src-60051ecd861a6bb0ddb821a4e6dbce953fff9884.zip
chromium_src-60051ecd861a6bb0ddb821a4e6dbce953fff9884.tar.gz
chromium_src-60051ecd861a6bb0ddb821a4e6dbce953fff9884.tar.bz2
content: Set the default device scale factor on the WebView directly since setting it in WebSettings is now deprecated.
Also, remove WebPreferences::default_device_scale_factor. BUG=none TEST=manually Review URL: https://chromiumcodereview.appspot.com/10534025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141306 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/web_contents/web_contents_impl.cc9
-rw-r--r--content/common/view_messages.h1
-rw-r--r--content/renderer/render_view_impl.cc12
-rw-r--r--content/renderer/render_widget.cc2
-rw-r--r--webkit/glue/webpreferences.cc2
-rw-r--r--webkit/glue/webpreferences.h1
6 files changed, 8 insertions, 19 deletions
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 435f5b1..c0eb866 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -554,15 +554,6 @@ WebPreferences WebContentsImpl::GetWebkitPrefs(RenderViewHost* rvh,
prefs.accelerated_compositing_enabled = false;
prefs.accelerated_2d_canvas_enabled = false;
}
- if (rvh->GetView()) {
- gfx::Monitor monitor = gfx::Screen::GetMonitorNearestWindow(
- rvh->GetView()->GetNativeView());
- prefs.default_device_scale_factor =
- static_cast<int>(monitor.device_scale_factor());
- } else {
- prefs.default_device_scale_factor =
- gfx::Monitor::GetDefaultDeviceScaleFactor();;
- }
if (command_line.HasSwitch(switches::kDefaultTileWidth))
prefs.default_tile_width =
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 0d43b11..95f71e5 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -137,7 +137,6 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences)
IPC_STRUCT_TRAITS_MEMBER(fantasy_font_family_map)
IPC_STRUCT_TRAITS_MEMBER(default_font_size)
IPC_STRUCT_TRAITS_MEMBER(default_fixed_font_size)
- IPC_STRUCT_TRAITS_MEMBER(default_device_scale_factor)
IPC_STRUCT_TRAITS_MEMBER(apply_default_device_scale_factor_in_compositor)
IPC_STRUCT_TRAITS_MEMBER(minimum_font_size)
IPC_STRUCT_TRAITS_MEMBER(minimum_logical_font_size)
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 36a2413..d99ffb5 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -593,6 +593,7 @@ RenderViewImpl::RenderViewImpl(
}
g_view_map.Get().insert(std::make_pair(webview(), this));
+ webview()->setDeviceScaleFactor(device_scale_factor_);
webkit_preferences_.Apply(webview());
webview()->initializeMainFrame(this);
if (!frame_name.empty())
@@ -2859,8 +2860,9 @@ void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
webview()->enableFixedLayoutMode(enable_fixed_layout || enable_viewport);
webview()->settings()->setFixedElementsLayoutRelativeToFrame(true);
if (!enable_pinch &&
+ webview()->isAcceleratedCompositingActive() &&
webkit_preferences_.apply_default_device_scale_factor_in_compositor &&
- webkit_preferences_.default_device_scale_factor != 1) {
+ device_scale_factor_ != 1) {
// Page scaling is disabled by default when applying a scale factor in the
// compositor since they are currently incompatible.
webview()->setPageScaleFactorLimits(1, 1);
@@ -2880,8 +2882,6 @@ void RenderViewImpl::ProcessViewLayoutFlags(const CommandLine& command_line) {
webview()->setFixedLayoutSize(WebSize(width,height));
}
}
- webview()->setDeviceScaleFactor(
- webkit_preferences_.default_device_scale_factor);
}
void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) {
@@ -4891,9 +4891,11 @@ void RenderViewImpl::OnResize(const gfx::Size& new_size,
bool is_fullscreen) {
if (webview()) {
// This setting has no effect if fixed layout is not enabled.
- if (webkit_preferences_.default_device_scale_factor)
+ DCHECK(device_scale_factor_);
+ if (device_scale_factor_) {
webview()->settings()->setLayoutFallbackWidth(
- new_size.width() / webkit_preferences_.default_device_scale_factor);
+ new_size.width() / device_scale_factor_);
+ }
webview()->hidePopups();
if (send_preferred_size_changes_) {
webview()->mainFrame()->setCanHaveScrollbars(
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 69e7d73..64cd94a 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -115,7 +115,7 @@ RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
has_disable_gpu_vsync_switch_ = CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableGpuVsync);
#if defined(OS_CHROMEOS) || defined(OS_MACOSX)
- device_scale_factor_ = screen_info.verticalDPI / kStandardDPI;
+ device_scale_factor_ = std::max(1, screen_info.verticalDPI / kStandardDPI);
#endif
}
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 99bb7bf..1b8a02e 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -36,7 +36,6 @@ WebPreferences::WebPreferences()
default_fixed_font_size(13),
minimum_font_size(0),
minimum_logical_font_size(6),
- default_device_scale_factor(1),
default_encoding("ISO-8859-1"),
apply_default_device_scale_factor_in_compositor(false),
javascript_enabled(true),
@@ -203,7 +202,6 @@ void WebPreferences::Apply(WebView* web_view) const {
settings->setDefaultFixedFontSize(default_fixed_font_size);
settings->setMinimumFontSize(minimum_font_size);
settings->setMinimumLogicalFontSize(minimum_logical_font_size);
- settings->setDefaultDeviceScaleFactor(default_device_scale_factor);
settings->setDefaultTextEncodingName(ASCIIToUTF16(default_encoding));
settings->setApplyDefaultDeviceScaleFactorInCompositor(
apply_default_device_scale_factor_in_compositor);
diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h
index a17d5c0..89df284 100644
--- a/webkit/glue/webpreferences.h
+++ b/webkit/glue/webpreferences.h
@@ -45,7 +45,6 @@ struct WEBKIT_GLUE_EXPORT WebPreferences {
int default_fixed_font_size;
int minimum_font_size;
int minimum_logical_font_size;
- int default_device_scale_factor;
std::string default_encoding;
bool apply_default_device_scale_factor_in_compositor;
bool javascript_enabled;