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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)
Patch Set: Address wkroman suggestions Created 4 years, 2 months 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: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 6c86ce92d863e140f42445988c3325b06ed7d0c0..f105edc2825663bfd538fe22d6e9d6e55f7c2184 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -4531,7 +4531,9 @@ LayoutRect LayoutBox::localCaretRect(InlineBox* box,
// giant tall-as-window insertion point
//
// FIXME: ignoring :first-line, missing good reason to take care of
- LayoutUnit fontHeight = LayoutUnit(style()->getFontMetrics().height());
+ const SimpleFontData* fontData = style()->font().primaryFont();
+ LayoutUnit fontHeight =
+ LayoutUnit(fontData ? fontData->getFontMetrics().height() : 0);
if (fontHeight > rect.height() || (!isAtomicInlineLevel() && !isTable()))
rect.setHeight(fontHeight);
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698