Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Unified Diff: webkit/glue/webpreferences.cc

Issue 10107014: Migrate WebKit "global script" font prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix after sync Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/glue/webpreferences.cc
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 359e0b0c7fa2935e535a9e9a283e7e4b2373ada8..0379a5c462da0bc2130f4e93c5d0daaafe143c36 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -5,6 +5,7 @@
#include "webkit/glue/webpreferences.h"
#include <unicode/uchar.h>
+#include <unicode/uscript.h>
viettrungluu 2012/05/16 13:27:58 As I said elsewhere, these are really ICU includes
falken 2012/05/17 07:08:41 I've changed the existing include to "unicode/ucha
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -25,16 +26,14 @@ using WebKit::WebString;
using WebKit::WebURL;
using WebKit::WebView;
+namespace {
+const char* kCommonScript = uscript_getShortName(USCRIPT_COMMON);
viettrungluu 2012/05/16 13:27:58 Not wanting static initializers applies to all of
falken 2012/05/17 07:08:41 I've moved it back to the "Zyyy" constant. I think
+}
+
namespace webkit_glue {
WebPreferences::WebPreferences()
- : standard_font_family(ASCIIToUTF16("Times New Roman")),
- fixed_font_family(ASCIIToUTF16("Courier New")),
- serif_font_family(ASCIIToUTF16("Times New Roman")),
- sans_serif_font_family(ASCIIToUTF16("Arial")),
- cursive_font_family(ASCIIToUTF16("Script")),
- fantasy_font_family(), // Not sure what to use on Windows.
- default_font_size(16),
+ : default_font_size(16),
default_fixed_font_size(13),
minimum_font_size(0),
minimum_logical_font_size(6),
@@ -107,6 +106,18 @@ WebPreferences::WebPreferences()
per_tile_painting_enabled(false),
css_regions_enabled(false),
css_shaders_enabled(false) {
+ standard_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Times New Roman");
+ fixed_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Courier New");
+ serif_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Times New Roman");
+ sans_serif_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Arial");
+ cursive_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Script");
+ fantasy_font_family_map[kCommonScript] =
+ ASCIIToUTF16("Impact");
}
WebPreferences::~WebPreferences() {
@@ -168,12 +179,6 @@ void ApplyFontsFromMap(const WebPreferences::ScriptFontFamilyMap& map,
void WebPreferences::Apply(WebView* web_view) const {
WebSettings* settings = web_view->settings();
- settings->setStandardFontFamily(standard_font_family);
- settings->setFixedFontFamily(fixed_font_family);
- settings->setSerifFontFamily(serif_font_family);
- settings->setSansSerifFontFamily(sans_serif_font_family);
- settings->setCursiveFontFamily(cursive_font_family);
- settings->setFantasyFontFamily(fantasy_font_family);
ApplyFontsFromMap(standard_font_family_map, setStandardFontFamilyWrapper,
settings);
ApplyFontsFromMap(fixed_font_family_map, setFixedFontFamilyWrapper, settings);

Powered by Google App Engine
This is Rietveld 408576698