#include "ui/base/models/simple_menu_model.h"
#include "ui/base/x/active_window_watcher_x.h"
#include "ui/base/x/x11_util.h"
+#include "ui/gfx/font_render_params_linux.h"
#include "ui/gfx/gtk_util.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/skia_utils_gtk.h"
}
}
+content::RendererPreferencesHintingEnum GetRendererPreferencesHintingEnum(
+ gfx::FontRenderParams::Hinting hinting) {
+ switch (hinting) {
+ case gfx::FontRenderParams::HINTING_NONE:
+ return content::RENDERER_PREFERENCES_HINTING_NONE;
+ case gfx::FontRenderParams::HINTING_SLIGHT:
+ return content::RENDERER_PREFERENCES_HINTING_SLIGHT;
+ case gfx::FontRenderParams::HINTING_MEDIUM:
+ return content::RENDERER_PREFERENCES_HINTING_MEDIUM;
+ case gfx::FontRenderParams::HINTING_FULL:
+ return content::RENDERER_PREFERENCES_HINTING_FULL;
+ default:
+ NOTREACHED() << "Unhandled hinting style " << hinting;
+ return content::RENDERER_PREFERENCES_HINTING_SYSTEM_DEFAULT;
+ }
+}
+
+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
NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
}
SetWebKitColorStyle();
+ SetFontRenderering();
}
NativeWindowGtk::~NativeWindowGtk() {
0;
}
+void NativeWindowGtk::SetFontRenderering() {
+ content::RendererPreferences* prefs =
+ GetWebContents()->GetMutableRendererPrefs();
+ const gfx::FontRenderParams& params = gfx::GetDefaultWebKitFontRenderParams();
+ prefs->should_antialias_text = params.antialiasing;
+ prefs->use_subpixel_positioning = params.subpixel_positioning;
+ prefs->hinting = GetRendererPreferencesHintingEnum(params.hinting);
+ prefs->use_autohinter = params.autohinter;
+ prefs->use_bitmaps = params.use_bitmaps;
+ prefs->subpixel_rendering =
+ GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering);
+}
+
bool NativeWindowGtk::IsMaximized() const {
return state_ & GDK_WINDOW_STATE_MAXIMIZED;
}