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

Unified Diff: content/ppapi_plugin/ppapi_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
Index: content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
diff --git a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
index a2acb5748489d7a16b1b9769ca6fdaa495e9d7b5..366f7e7ff712466ad25164203b57ef539463dbec 100644
--- a/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
+++ b/content/ppapi_plugin/ppapi_webkitplatformsupport_impl.cc
@@ -22,6 +22,7 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebSandboxSupport.h"
#elif defined(OS_POSIX)
#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
@@ -41,10 +42,11 @@ class PpapiWebKitPlatformSupportImpl::SandboxSupport : public WebSandboxSupport
virtual bool loadFont(
NSFont* srcFont, CGFontRef* out, uint32_t* fontID);
#elif defined(OS_POSIX)
- virtual WebString getFontFamilyForCharacters(
+ virtual void getFontFamilyForCharacters(
const 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);
@@ -54,7 +56,7 @@ class PpapiWebKitPlatformSupportImpl::SandboxSupport : public WebSandboxSupport
// 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
};
@@ -83,24 +85,29 @@ bool PpapiWebKitPlatformSupportImpl::SandboxSupport::loadFont(
#elif defined(OS_POSIX)
-WebString
+void
PpapiWebKitPlatformSupportImpl::SandboxSupport::getFontFamilyForCharacters(
const 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);
-
- const std::string family_name = content::GetFontFamilyForCharacters(
+ if (iter != unicode_font_families_.end()) {
+ family->name = iter->second.name;
+ family->isBold = iter->second.isBold;
+ family->isItalic = iter->second.isItalic;
+ return;
+ }
+
+ 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 PpapiWebKitPlatformSupportImpl::SandboxSupport::getRenderStyleForStrike(
« no previous file with comments | « content/common/child_process_sandbox_support_impl_linux.cc ('k') | content/renderer/renderer_webkitplatformsupport_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698