summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 14:42:13 +0000
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-19 14:42:13 +0000
commitfaec7b126dbfbea3c144c199b41257cfe98ce721 (patch)
treeaca10cfd30ae84f902f34ee2383b2e00333a7f1d /content
parentf97900b99b7097cdd2dec6c023691cdf139c73ff (diff)
downloadchromium_src-faec7b126dbfbea3c144c199b41257cfe98ce721.zip
chromium_src-faec7b126dbfbea3c144c199b41257cfe98ce721.tar.gz
chromium_src-faec7b126dbfbea3c144c199b41257cfe98ce721.tar.bz2
Allow non integer device scale factors in render widget
Currently we force device scale factors to integers in render widget preventing us from experimenting with non integer default device scale factors. This patch fixes that. BUG=None TEST=Use a default device scale factor of 1.5 Review URL: https://chromiumcodereview.appspot.com/10537128 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142951 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc1
-rw-r--r--content/renderer/render_widget.cc11
-rw-r--r--content/renderer/render_widget.h2
3 files changed, 11 insertions, 3 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 67bf8b98..47bccbd 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -708,6 +708,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kEnableTouchEvents,
switches::kEnableVideoTrack,
switches::kEnableViewport,
+ switches::kForceDeviceScaleFactor,
switches::kFullMemoryCrashReport,
#if !defined (GOOGLE_CHROME_BUILD)
// These are unsupported and not fully tested modes, so don't enable them
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 3449f3e5..ddfde20 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -33,6 +33,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
#include "third_party/skia/include/core/SkShader.h"
+#include "ui/base/ui_base_switches.h"
#include "ui/gfx/point.h"
#include "ui/gfx/size.h"
#include "ui/gfx/skia_util.h"
@@ -70,7 +71,7 @@ using WebKit::WebVector;
using WebKit::WebWidget;
using content::RenderThread;
-static const int kStandardDPI = 160;
+static const float kStandardDPI = 160;
RenderWidget::RenderWidget(WebKit::WebPopupType popup_type,
const WebKit::WebScreenInfo& screen_info,
@@ -113,7 +114,13 @@ 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_ = std::max(1, screen_info.verticalDPI / kStandardDPI);
+ device_scale_factor_ = screen_info.verticalDPI / kStandardDPI;
+ // Unless an explicit scale factor was provided for testing, ensure the scale
+ // is integral.
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceDeviceScaleFactor))
+ device_scale_factor_ = static_cast<int>(device_scale_factor_);
+ device_scale_factor_ = std::max(1.0f, device_scale_factor_);
#endif
}
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index b048558..1e418e0 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -556,7 +556,7 @@ class CONTENT_EXPORT RenderWidget
// The device scale factor. This value is computed from the DPI entries in
// |screen_info_| on some platforms, and defaults to 1 on other platforms.
- int device_scale_factor_;
+ float device_scale_factor_;
DISALLOW_COPY_AND_ASSIGN(RenderWidget);
};