Index: content/renderer/renderer_webkitplatformsupport_impl.cc |
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc |
index 2611add479528274868ebfdebdff3b7a059cbfbf..e30547ffa6d9ef9002bfd248f6c440f70302b53c 100644 |
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc |
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc |
@@ -62,6 +62,7 @@ |
#include "base/synchronization/lock.h" |
#include "content/common/child_process_sandbox_support_impl_linux.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebFontFamily.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/linux/WebSandboxSupport.h" |
#endif |
@@ -120,10 +121,11 @@ class RendererWebKitPlatformSupportImpl::SandboxSupport |
CGFontRef* container, |
uint32* font_id); |
#elif defined(OS_POSIX) |
- virtual WebKit::WebString getFontFamilyForCharacters( |
+ virtual void getFontFamilyForCharacters( |
const WebKit::WebUChar* characters, |
size_t numCharacters, |
- const char* preferred_locale); |
+ const char* preferred_locale, |
+ WebKit::WebFontFamily* family); |
virtual void getRenderStyleForStrike( |
const char* family, int sizeAndStyle, WebKit::WebFontRenderStyle* out); |
@@ -133,7 +135,7 @@ class RendererWebKitPlatformSupportImpl::SandboxSupport |
// here. The key in this map is an array of 16-bit UTF16 values from WebKit. |
// The value is a string containing the correct font family. |
base::Lock unicode_font_families_mutex_; |
- std::map<string16, std::string> unicode_font_families_; |
+ std::map<string16, WebKit::WebFontFamily> unicode_font_families_; |
#endif |
}; |
@@ -480,24 +482,29 @@ bool RendererWebKitPlatformSupportImpl::SandboxSupport::loadFont( |
#elif defined(OS_POSIX) |
-WebString |
+void |
RendererWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters( |
const WebKit::WebUChar* characters, |
size_t num_characters, |
- const char* preferred_locale) { |
+ const char* preferred_locale, |
+ WebKit::WebFontFamily* family) { |
base::AutoLock lock(unicode_font_families_mutex_); |
const string16 key(characters, num_characters); |
- const std::map<string16, std::string>::const_iterator iter = |
+ const std::map<string16, WebKit::WebFontFamily>::const_iterator iter = |
unicode_font_families_.find(key); |
- if (iter != unicode_font_families_.end()) |
- return WebString::fromUTF8(iter->second); |
+ if (iter != unicode_font_families_.end()) { |
+ family->name = iter->second.name; |
+ family->isBold = iter->second.isBold; |
+ family->isItalic = iter->second.isItalic; |
+ return; |
+ } |
- const std::string family_name = content::GetFontFamilyForCharacters( |
+ content::GetFontFamilyForCharacters( |
characters, |
num_characters, |
- preferred_locale); |
- unicode_font_families_.insert(make_pair(key, family_name)); |
- return WebString::fromUTF8(family_name); |
+ preferred_locale, |
+ family); |
+ unicode_font_families_.insert(make_pair(key, *family)); |
} |
void |