Commit fcab92b0 authored by avi's avatar avi Committed by Commit bot

Don't crash when using IME on an input field with a CSS-specified font.

BUG=471689
TEST=repro in bug 473859 no longer crashes

Review URL: https://codereview.chromium.org/1052523006

Cr-Commit-Position: refs/heads/master@{#323971}
parent 2d52933e
......@@ -100,10 +100,12 @@ AttributedStringCoder::FontAttribute::FontAttribute()
AttributedStringCoder::FontAttribute::~FontAttribute() {
}
NSDictionary* AttributedStringCoder::FontAttribute::ToAttributesDictionary(
void) const {
NSDictionary*
AttributedStringCoder::FontAttribute::ToAttributesDictionary() const {
DCHECK(ShouldEncode());
NSFont* font = font_descriptor_.ToNSFont();
if (!font)
return [NSDictionary dictionary];
return [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
}
......
......@@ -21,7 +21,9 @@ struct CONTENT_EXPORT FontDescriptor {
FontDescriptor() : font_point_size(0) {}
// Return an autoreleased NSFont corresponding to the font description.
// Return an autoreleased NSFont corresponding to the font description. Note
// that this will return nil if the font specified isn't available in this
// process.
NSFont* ToNSFont() const;
// Name of the font.
......
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