| Index: ash/display/display_manager.cc
|
| diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc
|
| index b83a34528613589ea935b03ef8f0d75b205c5afc..194c1cb4e99c0005b2f395d081ab568ef26bec1a 100644
|
| --- a/ash/display/display_manager.cc
|
| +++ b/ash/display/display_manager.cc
|
| @@ -111,6 +111,40 @@ void MaybeInitInternalDisplay(int64 id) {
|
| gfx::Display::SetInternalDisplayId(id);
|
| }
|
|
|
| +class FontRenderParamsRewriterAsh : public gfx::FontRenderParamsRewriter {
|
| + public:
|
| + FontRenderParamsRewriterAsh() {}
|
| + ~FontRenderParamsRewriterAsh() override {}
|
| +
|
| + private:
|
| + bool IsBrowserTextSubpixelPositioningEnabled() {
|
| + DisplayManager* display_manager = Shell::GetInstance()->display_manager();
|
| + if (!display_manager->HasInternalDisplay())
|
| + return false;
|
| + int64 internal_id = gfx::Display::InternalDisplayId();
|
| + const gfx::Display& internal_display =
|
| + display_manager->GetDisplayForId(internal_id);
|
| + // The internal display ID exists but the display object does not exist in
|
| + // case of the docked mode.
|
| + if (!internal_display.is_valid())
|
| + return false;
|
| + const DisplayInfo& display_info =
|
| + display_manager->GetDisplayInfo(internal_id);
|
| + return display_info.GetEffectiveDeviceScaleFactor() > 1.0f;
|
| + }
|
| +
|
| + // gfx::FontRenderParamsRewriter:
|
| + void RewriteParams(gfx::FontRenderParams* params) override {
|
| +#if defined(OS_CHROMEOS)
|
| + if (params->antialiasing) {
|
| + params->subpixel_positioning = IsBrowserTextSubpixelPositioningEnabled();
|
| + if (params->subpixel_positioning)
|
| + params->hinting = gfx::FontRenderParams::HINTING_NONE;
|
| + }
|
| +#endif
|
| + }
|
| +};
|
| +
|
| } // namespace
|
|
|
| using std::string;
|
| @@ -152,10 +186,7 @@ DisplayManager::DisplayManager()
|
| }
|
|
|
| DisplayManager::~DisplayManager() {
|
| -#if defined(OS_CHROMEOS)
|
| - // Reset the font params.
|
| - gfx::SetFontRenderParamsDeviceScaleFactor(1.0f);
|
| -#endif
|
| + gfx::FontRenderParamsRewriter::Shutdown();
|
| }
|
|
|
| // static
|
| @@ -238,14 +269,7 @@ void DisplayManager::InitDefaultDisplay() {
|
| }
|
|
|
| void DisplayManager::InitFontParams() {
|
| -#if defined(OS_CHROMEOS)
|
| - if (!HasInternalDisplay())
|
| - return;
|
| - const DisplayInfo& display_info =
|
| - GetDisplayInfo(gfx::Display::InternalDisplayId());
|
| - gfx::SetFontRenderParamsDeviceScaleFactor(
|
| - display_info.GetEffectiveDeviceScaleFactor());
|
| -#endif // OS_CHROMEOS
|
| + gfx::FontRenderParamsRewriter::SetInstance(new FontRenderParamsRewriterAsh());
|
| }
|
|
|
| // static
|
|
|