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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.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/LayoutBlockFlowLine.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
index 522082bb94eb8e9005c6c6294da8f72b0f4bd903..c3e2f3fbb04d0b9bafb300f3a41e805723bf8f9e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp
@@ -621,9 +621,11 @@ static inline void setLogicalWidthForTextRun(
measuredWidth = 0;
}
- glyphOverflow.setFromBounds(glyphBounds, font.getFontMetrics().floatAscent(),
- font.getFontMetrics().floatDescent(),
- measuredWidth);
+ const SimpleFontData* fontData = font.primaryFont();
+ DCHECK(fontData);
+ glyphOverflow.setFromBounds(
+ glyphBounds, fontData ? fontData->getFontMetrics().floatAscent() : 0,
+ fontData ? fontData->getFontMetrics().floatDescent() : 0, measuredWidth);
run->m_box->setLogicalWidth(LayoutUnit(measuredWidth) + hyphenWidth);
if (!fallbackFonts.isEmpty()) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698