| Index: third_party/WebKit/Source/core/layout/LayoutTextControl.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTextControl.cpp b/third_party/WebKit/Source/core/layout/LayoutTextControl.cpp
|
| index 2ea7fdd791a91b9d5012a6c0114b86f9ab797807..75c6f46e35a136c9489103022003e4fac1d10322 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTextControl.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTextControl.cpp
|
| @@ -210,12 +210,14 @@ bool LayoutTextControl::hasValidAvgCharWidth(const AtomicString& family)
|
|
|
| float LayoutTextControl::getAvgCharWidth(const AtomicString& family) const
|
| {
|
| - if (hasValidAvgCharWidth(family))
|
| - return roundf(style()->font().primaryFont()->avgCharWidth());
|
| + const Font& font = style()->font();
|
| + if (hasValidAvgCharWidth(family)) {
|
| + ASSERT(font.primaryFont());
|
| + return roundf(font.primaryFont()->avgCharWidth());
|
| + }
|
|
|
| const UChar ch = '0';
|
| const String str = String(&ch, 1);
|
| - const Font& font = style()->font();
|
| TextRun textRun = constructTextRun(font, str, styleRef(), TextRun::AllowTrailingExpansion);
|
| return font.width(textRun);
|
| }
|
|
|