Chromium Code Reviews| Index: android_webview/native/aw_contents.cc |
| diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
| index e920cf872ab431e137a109f57b048a177252385f..9b0ed8ac362b741906065ef8f6c720724f96050d 100644 |
| --- a/android_webview/native/aw_contents.cc |
| +++ b/android_webview/native/aw_contents.cc |
| @@ -51,6 +51,7 @@ |
| #include "third_party/skia/include/core/SkPicture.h" |
| #include "ui/base/l10n/l10n_util_android.h" |
| #include "ui/gfx/android/java_bitmap.h" |
| +#include "ui/gfx/font_render_params_linux.h" |
| #include "ui/gfx/image/image.h" |
| struct AwDrawSWFunctionTable; |
| @@ -111,6 +112,28 @@ class AwContentsUserData : public base::SupportsUserData::Data { |
| base::subtle::Atomic32 g_instance_count = 0; |
| +// TODO(boliu): Deduplicate with chrome/ code. |
| +content::RendererPreferencesSubpixelRenderingEnum |
| +GetRendererPreferencesSubpixelRenderingEnum( |
| + gfx::FontRenderParams::SubpixelRendering subpixel_rendering) { |
| + switch (subpixel_rendering) { |
| + case gfx::FontRenderParams::SUBPIXEL_RENDERING_NONE: |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_NONE; |
| + case gfx::FontRenderParams::SUBPIXEL_RENDERING_RGB: |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_RGB; |
| + case gfx::FontRenderParams::SUBPIXEL_RENDERING_BGR: |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_BGR; |
| + case gfx::FontRenderParams::SUBPIXEL_RENDERING_VRGB: |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VRGB; |
| + case gfx::FontRenderParams::SUBPIXEL_RENDERING_VBGR: |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_VBGR; |
| + default: |
| + NOTREACHED() << "Unhandled subpixel rendering style " |
| + << subpixel_rendering; |
| + return content::RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT; |
| + } |
| +} |
| + |
| } // namespace |
| // static |
| @@ -217,10 +240,20 @@ void AwContents::InitAutofillIfNecessary(bool enabled) { |
| void AwContents::SetAndroidWebViewRendererPrefs() { |
| content::RendererPreferences* prefs = |
| web_contents_->GetMutableRendererPrefs(); |
| - prefs->hinting = content::RENDERER_PREFERENCES_HINTING_SLIGHT; |
| prefs->tap_multiple_targets_strategy = |
| content::TAP_MULTIPLE_TARGETS_STRATEGY_NONE; |
| - prefs->use_subpixel_positioning = true; |
| + |
| + // TODO(boliu): Deduplicate with chrome/ code. |
| + const gfx::FontRenderParams& params = gfx::GetDefaultWebKitFontRenderParams(); |
| + prefs->should_antialias_text = params.antialiasing; |
| + prefs->use_subpixel_positioning = params.subpixel_positioning; |
| + prefs->use_autohinter = params.autohinter; |
| + prefs->use_bitmaps = params.use_bitmaps; |
| + prefs->subpixel_rendering = |
| + GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); |
| + // Intentionally not using default from gfx. |
| + prefs->hinting = content::RENDERER_PREFERENCES_HINTING_SLIGHT; |
|
benm (inactive)
2013/09/14 18:26:24
actually - it looks like the default on android is
boliu
2013/09/14 18:35:00
Bah, misread again, was looking at SUBPIXEL_RENDER
|
| + |
| content::RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| if (host) |
| host->SyncRendererPrefs(); |