Commit 9d1300e7 authored by Ian Clelland's avatar Ian Clelland Committed by Commit Bot

Remove WebCString dependency from WebFallbackFont

WebCString was used in two places -- for the font family name, and for
the filename. Font family name is more properly represented as a
WebString, as it contains UTF8 data. Filenames do not have any intrinsic
character set, so that field is switched to a WebVector<char>.

BUG=568803

Change-Id: I48d84ec791877657a7c23a441a12c5064e97153a
Reviewed-on: https://chromium-review.googlesource.com/579691Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491015}
parent a4aa9d6c
......@@ -16,6 +16,8 @@
#include "base/sys_byteorder.h"
#include "base/trace_event/trace_event.h"
#include "content/common/sandbox_linux/sandbox_linux.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/platform/linux/WebFallbackFont.h"
#include "third_party/WebKit/public/platform/linux/WebFontRenderStyle.h"
......@@ -49,8 +51,8 @@ void GetFallbackFontForCharacter(int32_t character,
pickle_iter.ReadInt(&fontconfigInterfaceId) &&
pickle_iter.ReadInt(&ttcIndex) && pickle_iter.ReadBool(&isBold) &&
pickle_iter.ReadBool(&isItalic)) {
fallbackFont->name = family_name;
fallbackFont->filename = filename;
fallbackFont->name = blink::WebString::FromUTF8(family_name);
fallbackFont->filename = blink::WebVector<char>(filename);
fallbackFont->fontconfig_interface_id = fontconfigInterfaceId;
fallbackFont->ttc_index = ttcIndex;
fallbackFont->is_bold = isBold;
......
......@@ -130,9 +130,10 @@ PpapiBlinkPlatformImpl::~PpapiBlinkPlatformImpl() {
void PpapiBlinkPlatformImpl::Shutdown() {
#if !defined(OS_ANDROID) && !defined(OS_WIN)
// SandboxSupport contains a map of WebFontFamily objects, which hold
// WebCStrings, which become invalidated when blink is shut down. Hence, we
// need to clear that map now, just before blink::shutdown() is called.
// SandboxSupport contains a map of WebFallbackFont objects, which hold
// WebStrings and WebVectors, which become invalidated when blink is shut
// down. Hence, we need to clear that map now, just before blink::shutdown()
// is called.
sandbox_support_.reset();
#endif
}
......
......@@ -301,9 +301,10 @@ RendererBlinkPlatformImpl::~RendererBlinkPlatformImpl() {
void RendererBlinkPlatformImpl::Shutdown() {
#if !defined(OS_ANDROID) && !defined(OS_WIN)
// SandboxSupport contains a map of WebFontFamily objects, which hold
// WebCStrings, which become invalidated when blink is shut down. Hence, we
// need to clear that map now, just before blink::shutdown() is called.
// SandboxSupport contains a map of WebFallbackFont objects, which hold
// WebStrings and WebVectors, which become invalidated when blink is shut
// down. Hence, we need to clear that map now, just before blink::shutdown()
// is called.
sandbox_support_.reset();
#endif
}
......
......@@ -62,8 +62,9 @@ void FontCache::GetFontForCharacter(
WebFallbackFont web_fallback_font;
Platform::Current()->GetSandboxSupport()->GetFallbackFontForCharacter(
c, preferred_locale, &web_fallback_font);
fallback_font->name = String::FromUTF8(CString(web_fallback_font.name));
fallback_font->filename = web_fallback_font.filename;
fallback_font->name = web_fallback_font.name;
fallback_font->filename = CString(web_fallback_font.filename.Data(),
web_fallback_font.filename.size());
fallback_font->fontconfig_interface_id =
web_fallback_font.fontconfig_interface_id;
fallback_font->ttc_index = web_fallback_font.ttc_index;
......
......@@ -31,21 +31,22 @@
#ifndef WebFallbackFont_h
#define WebFallbackFont_h
#include "public/platform/WebCString.h"
#include "public/platform/WebCommon.h"
#include "public/platform/WebString.h"
#include "public/platform/WebVector.h"
namespace blink {
struct WebFallbackFont {
WebFallbackFont()
: name(WebCString()),
filename(WebCString()),
: name(WebString()),
filename(WebVector<char>()),
fontconfig_interface_id(0),
ttc_index(0),
is_bold(false),
is_italic(false) {}
WebCString name;
WebCString filename;
WebString name;
WebVector<char> filename;
int fontconfig_interface_id;
int ttc_index;
bool is_bold;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment