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

Unified Diff: content/renderer/renderer_webkitplatformsupport_impl.cc

Issue 8590028: Use new getFontFamilyForCharacters() API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698