summaryrefslogtreecommitdiffstats
path: root/content/renderer/render_widget.cc
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/renderer/render_widget.cc
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/renderer/render_widget.cc')
-rw-r--r--content/renderer/render_widget.cc11
1 files changed, 9 insertions, 2 deletions
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
}